Page 1 of 1

How to add decimal in JCL sort card

PostPosted: Fri Apr 17, 2009 7:29 pm
by vgupta54
I have the input file in character format as shown below.
EID PNO
101 10.56
101 10.74
102 34.34
102 45.34

I want the output as
EID PNO
101 21.30 Sum for 101
101 10.56
101 10.74
102 79.68 Sum for 102
102 34.34
102 45.34

1st line is the output for common 1st empid as for 101 etc.

Re: How to add decimal in JCL sort card

PostPosted: Fri Apr 17, 2009 8:30 pm
by Frank Yaeger
You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD *
101 10.56
101 10.74
102 34.34
102 45.34
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'1')
  OUTFIL FNAMES=T1,REMOVECC,
   SECTIONS=(1,3,
     TRAILER3=(1,3,5:TOT=(5,5,UFF,EDIT=(IT.TT)),2X,
      'Sum for ',1,3,81:C'0'))
/*
//CTL2CNTL DD *
  OPTION EQUALS
  SORT FIELDS=(1,3,CH,A,81,1,CH,A)
  OUTREC BUILD=(1,80)
/*

Re: How to add decimal in JCL sort card

PostPosted: Mon Apr 20, 2009 11:27 am
by vgupta54
Thnx....