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

Sort Ascending and Descending without merge


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1788
Location: Bloomington, IL

PostPosted: Tue Jan 17, 2012 1:46 am
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Jan 17, 2012 1:47 am
Reply with quote

You get what You describe according to Your terminology
meditate on the dfsort manuals about the SFF format
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
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
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top