- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Need help with informats for the follwoing.
I'm reading a Mainframe file to SAS. The fields on Mainframe file have the following formats:
Date: PICTURE S9(7)
startling at column 1 and ending at column 7. The length is 7
Time: Picture 9(6)
startling at column 8 and ending at column 16. The length is 6
GRP-CD: picture X(4)
startling at column 66 and ending at column 69.The length is 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
Found this - an oldie but a goodie ....
V6 SAS Note: SAS informats that correspond to COBOL data descriptions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks 0s2.but it is confusing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
My recommendation has always been to find the oldest person in the IS department and ask them about this stuff. We still use COBOL code written in 1992 for god's sake. Warning - when you do ask them prepare to have your ears talked off about the "good old days" when men were men and computers were as big as your living room.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi SASPhile,
The informats to be used for reading the specified mainframe fields should be as :
INPUT
@1 Date DATE7.
@8 Time PD6.
@66 GRP-CD $CHAR4.
;
Explanantion :
It would be more clear if you provide the some examples of data for the date and time field.
1. Date: PICTURE S9(7)
startling at column 1 and ending at column 7. The length is 7
-> COBOL format : PIC S9(7)
Generally, we use ZD7. as an informat to read this type of data as S9(7) represents signed data with 7 numeric digits. But in your case, we are reading a date so a date with 7 length, the informat to be used should be DATE7.
2. Time: Picture 9(6)
startling at column 8 and ending at column 16. The length is 6
-> COBOL format : PIC 9(6)
Generally, to read this type of data if it is standard numeric data the informat to be used should be 6.But in you case the starting column is 8 and ending column is 16 so total number of columns to be read equals to 9. So, this type of data should be Packed Decimal Data.
To read this type data we have informat
PDw.d
- w is the total number of bytes the field takes up on the record(not the total number of digits). d represents the number of digits to the right of the decimal point. The d value is 0-10.
- To calculate w, the length of a packed field, use the following formula
(Total Digits/2) + 1/2
Round his number if it ends in 1/2
3. GRP-CD: picture X(4)
startling at column 66 and ending at column 69.The length is 4.
-> COBOL format : PIC X(4)
This format means we are reading 4 character digits. So, this type of data can be read using the informat $CHAR4. as the variable GRP-CD may have leading zeroes.
It would be great if you specify some examples that would show the clear view of what exactly are you going to read.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SAS(R) 9.4 Formats and Informats: Reference (S370FPDw.d Informat )
The last part of text is telling the cobol equivalents.
The easiest approach is assuming the SAS code is also run on a mainframe.
You could read SAS mainframe data on other machines.
The transfer must be binary and record information (input statement) given,