harikumar2804
New User
Joined: 16 Nov 2008 Posts: 3 Location: Melbourne
|
|
|
|
I have one requirement which I need to achieve using sort.
Input
| Code: |
B no Cust no/Acct no Custname/Acct name prod Sub prod
2 300 CCC SS 10
2 400 AAA
3 600 BBB VV 20
3 500 ZZZ VV 20
3 200 DDD |
If Prod and Sup prod are spaces that means 2nd column contains cust no and 3rd contains Customer name
If Prod and Sup prod are not spaces then the 2nd column contains Acct no and 3rd contains Acct name
Expected output
| Code: |
B no Cust no/Acct no Custname/Acct name prod Sub prod
2 400 AAA
2 300 CCC SS 10
3 200 DDD
3 500 ZZZ VV 20
3 600 BBB VV 20 |
Sorting Order - Customer records and Account records
For customer records sorting order is Branch no, customer name, customer no and
for Account records the sorting order is Branch no, Account no and Account name.
Please provide the sort card for this. |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
harikumar2804,
The following DFSORT JCL will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6---
2 300 CCC SS 10
2 400 AAA
3 600 BBB VV 20
3 500 ZZZ VV 20
3 200 DDD
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:1,1)),
IFTHEN=(WHEN=(49,2,CH,EQ,C' ',AND,57,2,CH,EQ,C' '),
OVERLAY=(82:25,3,9,3)),
IFTHEN=(WHEN=NONE,OVERLAY=(82:9,3,25,3))
SORT FIELDS=(81,7,CH,A),EQUALS
OUTREC BUILD=(1,80)
//* |
|
|