View previous topic :: View next topic
|
Author |
Message |
Keanehelp
New User
Joined: 27 May 2008 Posts: 71 Location: USA, CA.
|
|
|
|
We have file with Structure like (dummy data) and currently we SORT this file in 2 steps to get the desired output structure
TRD1 Acct#1 BAL
TRD1 Acct#2 BAL
TRD1 Acct#3 BAL
Step 1
If (1:4) positions are 'TRD1' --> --> Bal is NOT =0 --> If Acct#1 = Acct#2 --> Add balances of two records
Output file structure should be like --
Acct#1(please note that Acct#1 = Acct#2) BAL
Step 2
Add a hardcoded value at the end of each record
Output file structure should be like --
Acct#1(please note that Acct#1 = Acct#2) BAL 'Hard Coded Value'
Currently we use for
Step1
INCLUDE COND=(1,4,CH,EQ,C'TRD1',AND,30,18,ZD,NE,000000000000000000)
SUM FIELDS=(30,18,ZD)
OUTREC FIELDS=(1:7,9,11:30,18)
Step 2
SORT FIELDS=COPY
OUTFIL FILES=1,
BUILD=(1,28,C' Hard coded Values')
Is there a way to achive the final output file by using a single sort card? Please suggest.
Thanks for help in advance. |
|
Back to top |
|
|
elango_K
New User
Joined: 18 Aug 2011 Posts: 44 Location: India
|
|
|
|
this can be done using sections:
For some reason your code and sample above did not macth.
Modofy the below code accordingly.
Code: |
//STEP0010 EXEC PGM=SORT
//SORTIN DD *
TRD1 123456 001
TRD1 123456 003
TRD1 123457 005
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(1,4,CH,EQ,C'TRD1',AND,6,3,ZD,NE,0)
OUTFIL NODETAIL,REMOVECC,SECTIONS=(1,11,
TRAILER3=(1,12,TOT=(13,3,ZD,EDIT=(TTT)),C'HARDCODE'))
|
Output:
Code: |
TRD1 123456 004HARDCODE
TRD1 123457 005HARDCODE
|
|
|
Back to top |
|
|
|
|