Problems Reading in Data from Mainframe Created Flat File

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 11
Accepted Solution

Problems Reading in Data from Mainframe Created Flat File

I am attempting to read in a flat file that was created from a mainframe.  Most of the read in is fine but where I am trying to read in a signed number field I am not getting the correct result.  When I read in the bytes for this field as a character I see "0006061A" (this is also what I see if I open the file in Notepad).  The proper value of the field is 000606.11.  It appears that the sign is being included as part of the last byte.  If the number was negative then the value in the flat fiel would appear as "0006161J".  I have a work around in place that checks the last byte and translates the number correctly but it seems like there should be an informat for this.  I have tried the various S370 informats and none work.  Does anyone have a way of reading this in correctly?


Accepted Solutions
Solution
‎05-08-2014 12:39 PM
Super User
Super User
Posts: 6,502

Re: Problems Reading in Data from Mainframe Created Flat File

Use ZDV informat.

data test;

  input @1 str $char8.

        @1 n zdv8.2

  ;

  put (_all_) (=);

cards;

0006161J

0006061A

;;;;

View solution in original post


All Replies
Solution
‎05-08-2014 12:39 PM
Super User
Super User
Posts: 6,502

Re: Problems Reading in Data from Mainframe Created Flat File

Use ZDV informat.

data test;

  input @1 str $char8.

        @1 n zdv8.2

  ;

  put (_all_) (=);

cards;

0006161J

0006061A

;;;;

Occasional Contributor
Posts: 11

Re: Problems Reading in Data from Mainframe Created Flat File

Thanks Tom!  That was exactly what I needed.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 194 views
  • 0 likes
  • 2 in conversation