Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to merge two sort steps in one

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Keanehelp

New User


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

PostPosted: Mon Mar 05, 2012 6:43 pm    Post subject: Need to merge two sort steps in one
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us