Kolusu-san,

Thank you very much for providing the SORT JCL.
Your SORT is more elegant and flexible than I made.

What I made SORT control cards based on Woodger-san's suggestion is
following.

//ACCUM   EXEC PGM=ICEMAN
//SYSOUT   DD  SYSOUT=*
//SORTIN   DD  *
#001     1      10.5
#002     5       3.3
#003   121     120.4
#004     4       1.1
#004     4       1.1
#005  7000   5,000.0
/*
//SORTOUT  DD  SYSOUT=*
//SYSIN    DD  *
  INREC   OVERLAY=(72:SEQNUM,8,ZD)
  SORT    FIELDS=COPY
  OUTFIL  REMOVECC,NODETAIL,
    SECTIONS=(72,8,
    TRAILER3=(1,20,5X,
              SUBTOTAL=(6,5,ZD,EDIT=(I,III,IIT)),4X,
              SUBTOTAL=(12,9,UFF,EDIT=(III,IIT.T)),
              80:X))
  END
/*

The SORTOUT is following:

#001     1      10.5             1         10.5
#002     5       3.3             6         13.8
#003   121     120.4           127        134.2
#004     4       1.1           131        135.3
#004     4       1.1           135        136.4
#005  7000   5,000.0         7,135      5,136.4


Again, Woodger-san, Koehler-san, and Kolusu-san,
I really appreciate your help.

Thank you!!

Minoru Massaki - (M*M)



2017-02-14 0:43 GMT+09:00 Sri h Kolusu <[email protected]>:

> 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
>



-- 

全先 実  -  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

Reply via email to