BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
gsnidow
Obsidian | Level 7

Greetings all.  I'm attempting to read data from a tape on a zOS mainframe.  I think what we refer to as "tape" may actually be a disk, but that is another matter.  My question is this:  I have a document showing the file layout, and there are scads of packed decimal fields with a '+' and some number after the PD format, and both are wrapped in parenthesis.  For example, if I have "@2156 (TOT1 - TOT24) (PD5.0 +242)", what does the "+242" mean.  I know there are 24 fields here, but there is also "@2161 (NextField1-NextField24) ($ 18. +229)"  I cannot fathom how, even using packed decimal, there could be 24 fields in the space between 2156 and 2161.  Any insight would be greatly appreciated.  Thank you.

Greg

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Greg,

As you have seen with the NextField variables, the questions here revolve around the INPUT statement.  The fact that some fields are packed decimal is a separate issue, and doesn't really impact the answer.

The form of INPUT you are looking at:

@2156 (TOT1 - TOT24) (PD5.0 +242)

This means that the same instructions (PD5.0 +242) should be applied when reading every variable in the list (TOT1 - TOT24).  So SAS begins by reading TOT1.  Start at column 2156 of the incoming data line, read 5 characters (PD5.0), which positions the software at column 2161.  Then move 242 spaces to the right, positioning the software at column 2403.  Then apply the same instructions to read TOT2.  Read the 5 characters starting at column 2403, and positioning the software at column 2408.  Then move 242 spaces to the right, positioning at column 2650.  Then read TOT3, etc.

Hope I've done the math right here.  Either way, the idea is that the same instructions should apply when reading every variable in the list.

Good luck.

View solution in original post

3 REPLIES 3
Astounding
PROC Star

Greg,

As you have seen with the NextField variables, the questions here revolve around the INPUT statement.  The fact that some fields are packed decimal is a separate issue, and doesn't really impact the answer.

The form of INPUT you are looking at:

@2156 (TOT1 - TOT24) (PD5.0 +242)

This means that the same instructions (PD5.0 +242) should be applied when reading every variable in the list (TOT1 - TOT24).  So SAS begins by reading TOT1.  Start at column 2156 of the incoming data line, read 5 characters (PD5.0), which positions the software at column 2161.  Then move 242 spaces to the right, positioning the software at column 2403.  Then apply the same instructions to read TOT2.  Read the 5 characters starting at column 2403, and positioning the software at column 2408.  Then move 242 spaces to the right, positioning at column 2650.  Then read TOT3, etc.

Hope I've done the math right here.  Either way, the idea is that the same instructions should apply when reading every variable in the list.

Good luck.

Doc_Duke
Rhodochrosite | Level 12

Checkout the documentation for the SAS INFORMAT controls

SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition

@2156 (TOT1 - TOT24) (PD5.0 +242)

means to pick up tot1 starting at column 2156 and tot2 starting at column 2156+242, etc.  It is not PD specific.

Doc Muhlbaier

Duke

gsnidow
Obsidian | Level 7

Thank you both so much for the help, I was struggling to understand what was going on.

Greg

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 934 views
  • 3 likes
  • 3 in conversation