Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading An Input Records Backwards

Status
Not open for further replies.

ks01

MIS
Aug 11, 2002
110
US
Hello everyone …

I need some assistance in determining how to read input record. Normally, I just start at a specific position and begin reading in until the end of the value. However, I’ve come across a flat file that has some unique characteristics and am hoping someone can suggest something as this is above my skill level.

Here is a sample of my data. I have enabled hex as the data is packed signed and unsigned:
Code:
3..... .l......  . 
F000008192006234408
300000084004565001C

When my record type is 3, my record identifier (packed unsigned) will be stored in bytes 2 through 15. However, the record identifier is variable length and aligned on the right. The length of the record identifier is stored in bytes 18 and 19 and is packed signed.

In the sample above here is the data:

Record length = 18
Record identifier = 801894200004652635

I have no experience with reading values backwards. Can SAS do this? If so, I have no idea how to code this. My normal programs are simple, like:
Code:
OPTIONS NOSOURCE;                 
DATA R001 (KEEP=CUSTOMER ADDRESS CITY DESCRIP);         
INFILE INPUT1;                    
FILE OUTPUT1;                     
                                  
INPUT @01 RECTYP $CHAR1. @ ;      
                                  
  IF RECTYP = '3' THEN            
    DO;                           
      INPUT @02  CUSTOMER $CHAR19. 
            @30  ADDRESS  $CHAR30.  
            @133 CITY     $CHAR30. 
            @150 DESCRIP  $CHAR30.;

Does anyone have any suggestions or guidance that can help me?

Thank you in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top