View previous topic :: View next topic
Author
Message
rgarg New User Joined: 15 Feb 2006Posts: 18
Following is my requirement,
I have input file say of record length 200 fixed length and the records are in the following format,
ORG PIC 9(03)
ACCOUNT NUMBER PIC X(19)
RECORD-ID PIC X(2)
NAME PIC (30)
ADDRESS PIC X(40)
PHONE PIC 9(15)
CUSTOMER NUMBER PIC 9(19)
FILLER PIC X(73)
The output file should of record length 45(Fixed format) with the following record layout :
01 or 02 (depending on value of RECORD-ID need to be inserted at first 2 postions)
ORG
ACCOUNT NUMBER
RECORD-ID
CUSTOMER NUMBER
Following is the output file requirement
1. I want to extract only those records whose RECORD-ID is either BS or NA
2. I want to take only values of ORG, ACCOUNT NUMBER, RECORD-ID and CUSTOMER NUMBER from the input file
3. If RECORD-ID is BS insert 01 at first 2 positions, if it is NA, insert 02 at first 2 positions
4. Thus the total length of output file is 45
Can someone please tell me how to achieve this. My shop has Syncsort utility.
Thanks and Regards
Rajiv Garg
Back to top
a027412 New User Joined: 05 Jul 2007Posts: 40 Location: Minneapolis, MN
Code:
//STEP01 EXEC SORT
//SORTIN DD DSN=InputDataSet,
// DISP=SHR
//SORTOUT DD DSN=OutputDataSet,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(800,200),RLSE),
// DCB=(LRECL=45,RECFM=FB,BLKSIZE=0)
//SYSIN DD *
INCLUDE COND=(23,2,CH,EQ,C'BS',OR,23,2,CH,EQ,C'NA')
OUTREC FIELDS=(1:23,2,CHANGE=(2,C'BS',C'01',C'NA',C'02'),
3:1,24,
27:110,19)
SORT FIELDS=COPY
/*
Back to top
rgarg New User Joined: 15 Feb 2006Posts: 18
The Code works. Thanks you so much for the help. But i can't able to get the sort card here i.e. Can you please explain me this sort card?
Back to top
a027412 New User Joined: 05 Jul 2007Posts: 40 Location: Minneapolis, MN
the INCLUDE COND , picks only the input record containing BS or NA at the position 23 to 24
In the OUTREC,
Output position 1 , pick characters from 23 to 24 from the input record and change the character BS to 01 or NA to 02
Output position 3 , pick characters from 1 to 24 from the input record
Output position 27 , pick characters from 110 to 129 from the input record
Back to top
rgarg New User Joined: 15 Feb 2006Posts: 18
Thanks for making me understand. Thank you very much for the help
Back to top
Please enable JavaScript!