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
 

 

Sort Ascending and Descending without merge

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

New User


Joined: 07 Dec 2011
Posts: 19
Location: India

PostPosted: Tue Jan 17, 2012 1:30 am    Post subject: Sort Ascending and Descending without merge
Reply with quote

I have the following input file with account no and amount unsorted
Code:

30000201234123,+000000000000009
30000201234123,-000000000000001
30000201234123,-000000000000003
30000201234123,+000000000000007
30000201234123,-000000000000004
30000201234123,+000000000000005

I need the following output with descending order of credits and debits
Code:

30000201234123,+000000000000009
30000201234123,+000000000000007
30000201234123,+000000000000005
30000201234123,-000000000000001
30000201234123,-000000000000003
30000201234123,-000000000000004

However when I used the following sortcard
Code:

SORT FIELDS=(1,14,CH,A,16,16,ZD,D)

I get the following output
Code:

30000201234123,+000000000000009
30000201234123,+000000000000007
30000201234123,+000000000000005
30000201234123,-000000000000004
30000201234123,-000000000000003
30000201234123,-000000000000001


But I can achieve the desired output by
step1: splitting the file into credits and debits based on account no
step2: sorting the credit file in descending order
step3: sorting the debit file in ascending order
step4: merging the credit and debits file based on account no...

Is there any smarter and simpler way of achieving this using DFSORT?

(PS:MERGE PTF for ICETOOL is not installed in our system..Peculiarly the usage of ICETOOL is frowned upon here for unknown reason... icon_sad.gif )
Back to top
View user's profile Send private message

Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1770
Location: Bloomington, IL

PostPosted: Tue Jan 17, 2012 1:46 am    Post subject:
Reply with quote

Does not ZD imply overpunch, whereas a separate leading sign on numeric data would be LS?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Jan 17, 2012 1:47 am    Post subject: Reply to: Sort Ascending and Descending without merge
Reply with quote

You get what You describe according to Your terminology
meditate on the dfsort manuals about the SFF format
ftp://ftp.software.ibm.com/storage/dfsort/mvs/sortbynd.pdf

the proper sort card for Your example would be
Code:
SORT FIELDS=(1,14,CH,A,16,16,SFF,D)


input

Code:

 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
 000011 30000201234123,-000000000000004                                         
 000012 30000201234123,-000000000000003                                         
 000013 30000201234123,-000000000000002                                         
 000014 30000201234123,-000000000000001                                         
 000015 30000201234123,-000000000000000                                         
 000016 30000201234123,+000000000000001                                         
 000017 30000201234123,+000000000000002                                         
 000018 30000201234123,+000000000000003                                         
 000019 30000201234123,+000000000000004                                         
 000020 30000201234123,+000000000000005                                         


output


Code:
********************************* TOP OF DATA **********************************
30000201234123,+000000000000005                                                 
30000201234123,+000000000000004                                                 
30000201234123,+000000000000003                                                 
30000201234123,+000000000000002                                                 
30000201234123,+000000000000001                                                 
30000201234123,-000000000000000                                                 
30000201234123,-000000000000001                                                 
30000201234123,-000000000000002                                                 
30000201234123,-000000000000003                                                 
30000201234123,-000000000000004                                                 
******************************** BOTTOM OF DATA ********************************
Back to top
View user's profile Send private message
Balaji Canabady

New User


Joined: 07 Dec 2011
Posts: 19
Location: India

PostPosted: Tue Jan 17, 2012 2:36 am    Post subject:
Reply with quote

Grazie Tanto icon_biggrin.gif
Both LS and SFF perfectly produces the required output.
(thanks for the document link too!)
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