expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Oh, OK then, off you go, and thanks for telling us that .....................
There is just oh so much information missing if you are actually looking for any help at all.
Do you want to write a program or use a utility, if a utility which one.
If sort, what is the product used and its release level.
DSORG/RECFM/LRECL of input file(s).
Same as above for the output files - also is there carriage control involved, if so A or M.
Length, position and data type of the relevent fields. |
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Based solely on your example, without the additional information requested by expat, here is an example that may help you:
Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ACCOUNT DEBIT/CREDIT
10131977 10.00
10139389 12.00-
10145489 19.00-
10170148 13.00
10488463 17.00
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(30:C'1',40:C'00.00',50:C'00.00-')),
IFTHEN=(WHEN=(1,7,CH,EQ,C'ACCOUNT'),OVERLAY=(30:C'0')),
IFTHEN=(WHEN=(15,1,CH,EQ,C' '),OVERLAY=(40:10,5)),
IFTHEN=(WHEN=(15,1,CH,EQ,C'-'),OVERLAY=(50:10,6))
SORT FIELDS=(30,1,CH,A)
OUTFIL BUILD=(1,20,112X),
TRAILER1=(1:'TOTAL NUMBER OF RECORDS =',TOT=(30,1,ZD,LENGTH=6),/,
1:'TOTAL DEBIT AMOUNT =',TOT=(40,5,UFF,EDIT=(IIIT.TT)),/,
1:'TOTAL CREDIT AMOUNT =',TOT=(50,6,SFF,EDIT=(IIIT.TT-)))
/* |
The above code produces the following output:
Code: |
ACCOUNT DEBIT/CREDIT
10131977 10.00
10139389 12.00-
10145489 19.00-
10170148 13.00
10488463 17.00
TOTAL NUMBER OF RECORDS = 5
TOTAL DEBIT AMOUNT = 40.00
TOTAL CREDIT AMOUNT = 31.00-
|
You will need to modify this based on your actual data. |
|