|
View previous topic :: View next topic
|
| Author |
Message |
Balaji Canabady
New User
Joined: 07 Dec 2011 Posts: 19 Location: India
|
|
|
|
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... ) |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
| Does not ZD imply overpunch, whereas a separate leading sign on numeric data would be LS? |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
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 |
|
 |
Balaji Canabady
New User
Joined: 07 Dec 2011 Posts: 19 Location: India
|
|
|
|
Grazie Tanto
Both LS and SFF perfectly produces the required output.
(thanks for the document link too!) |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|