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
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.
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.
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
Thank you both so much for the help, I was struggling to understand what was going on.
Greg
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.