Minoru Massaki,
I assumed the following
1. Your Input has LRECL=80 and RECFM=FB
2. The key in position 1 thru 4 is unique and you wanted a running total
for every record.
3. The first summary field start at 10 for a length of 6
4. The second summary field starts at position 21 for a length of 10
5. The summary fields are at position 35 for a length of 8 and position 45
for a length of 12.
You can use the following JCL
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----
#001 1 10.5
#002 5 3.3
#003 121 120.4
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,4,
TRAILER3=(1,30,
35:SUBTOTAL=(10,06,UFF,M10,LENGTH=8),
45:SUBTOTAL=(21,10,UFF,EDIT=(IIIIIIIIIIII.T))))
//*
If for some reason your key(position 1 thru 4 is NOT unique) and yet you
want to have a running total for every record then you can use the
following JCL
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6---
#ABC 1 10.5
#ABC 5 3.3
#ABC 121 120.4
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC OVERLAY=(81:SEQNUM,8,ZD)
OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
SECTIONS=(81,8,
TRAILER3=(1,30,
35:SUBTOTAL=(10,06,UFF,M10,LENGTH=8),
45:SUBTOTAL=(21,10,UFF,EDIT=(IIIIIIIIIIII.T))))
//*
Further if you have any questions please let me know
Thanks,
Kolusu
DFSORT Development
IBM Corporation
From: Minoru Massaki <[email protected]>
To: [email protected]
Date: 02/12/2017 06:31 AM
Subject: SORT - How can I put accumulated value on each output
record
Sent by: IBM Mainframe Discussion List <[email protected]>
I want to have SORTOUT data as following:
Input Data
#001 1 10.5
#002 5 3.3
#003 121 120.4
. . . . . . .
Output Data Set
#001 1 10.5 1 10.5
#002 5 3.3 6 13.8
#003 121 120.4 127 134.2
. . . . . . .
Output forth column is accumulated value with previous records values on
2nd column.
Output 5th column is also accumulated value with previous records values
on
3rd column.
Can I make this kind of output by SORT?
I really appreciate that someone would provide sample of SORT control
statement to resolve my requirement.
Minoru Massaki - (M*M)
--
全先 実 - Minoru Massaki (M*M)
E-mail: [email protected]
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN