IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need to merge two sort steps in one


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Keanehelp

New User


Joined: 27 May 2008
Posts: 71
Location: USA, CA.

PostPosted: Mon Mar 05, 2012 6:43 pm
Reply with quote

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
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Mon Mar 05, 2012 7:33 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top