View previous topic :: View next topic
Author
Message
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Hi,
Input File: LRECL=8, RECFM=FB
Code:
RECORD01
RECORD02
RECORD03
RECORD04
.......
.......
RECORDnn
I have the above input file which has record one after another. I want to copy those records into output dataset with LRECL=16, RECFM=FB but records written next to next.
Expected Output-1: LRECL=16,RECFM=FB
Code:
RECORD01RECORD02
RECORD03RECORD04
..........
..........
RECORDnn
Expected Output-2: LRECL=24,RECFM=FB
Code:
RECORD01RECORD02RECORD03
RECORD04RECORD05RECORD06
..........
..........
RECORDnn
Would you please let me know how to achieve it using SORT? Also, what changes in control cards need if it has to be three records per line?
Thanks.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
ramsri,
Here's a Syncsort job which works for your requirement (Expected Output-2). It can be modified to get Output-1 as well.
Code:
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SORTIN DD *
RECORD01
RECORD02
RECORD03
RECORD04
RECORD05
RECORD06
RECORD07
RECORD08
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(81:ID=5,SEQ=1)),
IFTHEN=(WHEN=INIT,OVERLAY=(87:1,8,16Z)),
IFTHEN=(WHEN=(86,1,ZD,EQ,2),OVERLAY=(095:1,8)),
IFTHEN=(WHEN=(86,1,ZD,EQ,3),OVERLAY=(103:1,8))
SORT FIELDS=(81,5,CH,A)
SUM FIELDS=(95,4,99,4,103,4,107,4),FORMAT=BI
OUTREC BUILD=(87,24)
SORTOUT had
Code:
RECORD01RECORD02RECORD03
RECORD04RECORD05RECORD06
RECORD07RECORD08
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Arun, thanks. I'll try it and come back.
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Hi Arun, I've tried your code and got expected results
I've modified value of RECORDS parameter from 3 to 2 and got the results.
Code:
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(81:ID=5,SEQ=1)),
One thing I would like to ask why to use FORMAT=BI.
Code:
SUM FIELDS=(95,4,99,4,103,4,107,4),FORMAT=BI
Thanks a lot.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
The objective of the binary SUM here is to 'ADD' binary zeroes and the binary value of 'RECORDnn' giving 'RECORDnn' itself. It might help if you have a look at the intermediate output by removing the SUM and OUTREC statements.
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Hi Arun, I will try and see it.
Thanks.
Back to top
Please enable JavaScript!