Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1777
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: 10326
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 records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am
No new posts Difference in SORT & ICETOOL Mohan Kothakota DFSORT/ICETOOL 5 Fri Sep 22, 2017 4:56 pm
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us