Great Catch mainframer.  I apologize for the oversight..  Here are updated 
control cards which would account for rounding the decimals when they are 
between 95 and 99. I also added a message to denote the type of rounding 
performed.

//SYSIN    DD    * 
  JOINKEYS F1=IN1,FIELDS=(4,1,A),SORTED,NOSEQCK 
  JOINKEYS F2=IN2,FIELDS=(1,1,A) 
  REFORMAT FIELDS=(F1:1,4,F2:2,8) 
 
  SORT FIELDS=(1,3,CH,A) 
 
  OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,3),PUSH=(14:SEQ=8)), 
  IFTHEN=(WHEN=INIT, 
  OVERLAY=(25:(14,8,ZD,MUL,+10000),DIV,5,8,ZD,EDIT=(IIT,TT))), 
  IFTHEN=(WHEN=(30,1,SS,EQ,C'6,7,8,9',AND,29,2,ZD,LE,95), 
  OVERLAY=(29:29,1,ZD,ADD,+1,EDIT=(T),35:C'DECIMAL ROUNDED')), 
  IFTHEN=(WHEN=(29,2,ZD,GT,95), 
  OVERLAY=(25:25,3,UFF,ADD,+1,EDIT=(IIT),C',00',35:C'INTEGER ROUNDED')) 
 
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X), 
  SECTIONS=(1,3,TRAILER3=(1,4,25,5,X,35,15)) 
//* 

Kolusu
DFSORT Development

IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> wrote on 
05/16/2013 11:01:00 AM:

> From: retired mainframer <retired-mainfra...@q.com>
> To: IBM-MAIN@listserv.ua.edu, 
> Date: 05/16/2013 11:05 AM
> Subject: Re: ICETOOL question
> Sent by: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu>
> 
> This is really clever but there is a minor error in the rounding logic 
of
> the last IFTHEN.  When the fraction portion of the percentage is between 
95
> and 99 inclusive, the tenths digit is incremented to 0 but the units 
digit
> (two positions to the left because of the intervening comma) is not
> incremented.
> 
> It looks like the rounding needs to be done before the value is edited 
to
> include the comma.  This will insure that any carry is propagated 
properly
> to the left.
> 
> :>: -----Original Message-----
> :>: From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU
] On
> :>: Behalf Of Sri h Kolusu
> :>: Sent: Friday, May 10, 2013 9:00 AM
> :>: To: IBM-MAIN@LISTSERV.UA.EDU
> :>: Subject: Re: ICETOOL question
> :>:
> :>: K,
> :>:
> :>: The following DFSORT JCL will give you the desired results. The 
trick
> :>: here
> :>: is to use the same input file twice with Joinkeys. Looking at the 
your
> :>: expected results, I also rounded the decimal.
> :>:
> :>: //STEP0100 EXEC PGM=SORT
> :>: //SYSOUT   DD SYSOUT=*
> :>: //IN1      DD *
> :>: AAA
> :>: BBB
> :>: AAA
> :>: CCC
> :>: AAA
> :>: BBB
> :>: //IN2      DD *
> :>: AAA
> :>: BBB
> :>: AAA
> :>: CCC
> :>: AAA
> :>: BBB
> :>: //SORTOUT  DD SYSOUT=*
> :>: //SYSIN    DD    *
> :>:   JOINKEYS F1=IN1,FIELDS=(4,1,A),SORTED,NOSEQCK
> :>:   JOINKEYS F2=IN2,FIELDS=(1,1,A)
> :>:   REFORMAT FIELDS=(F1:1,4,F2:2,8)
> :>:
> :>:   SORT FIELDS=(1,3,CH,A)
> :>:
> :>:   OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(1,3),PUSH=(14:SEQ=8)),
> :>:   IFTHEN=(WHEN=INIT,
> :>:   OVERLAY=(25:(14,8,ZD,MUL,+10000),DIV,5,8,ZD,EDIT=(IIT,TT))),
> :>:   IFTHEN=(WHEN=(30,1,ZD,GT,5),OVERLAY=(29:29,1,ZD,ADD,+1,EDIT=(T)))
> :>:
> :>:   OUTFIL REMOVECC,NODETAIL,BUILD=(80X),
> :>:   SECTIONS=(1,3,TRAILER3=(1,4,25,5))
> :>: //*
> :>: //JNF1CNTL DD *
> :>:   INREC FIELDS=(1,3,X)
> :>: //*
> :>: //JNF2CNTL DD *
> :>:   INREC FIELDS=(X,7C'0',C'1')
> :>:   SUM FIELDS=(2,8,ZD)
> :>: //*
> :>:
> :>: The output from this job is
> :>:
> :>: AAA  50,0
> :>: BBB  33,3
> :>: CCC  16,7
> :>:
> :>: Hope this helps...
> :>: Kolusu
> :>: DFSORT Development
> :>: IBM Corporation
> :>: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu> wrote on
> :>: 05/10/2013 06:53:40 AM:
> :>:
> :>: > From: K <kzafi...@gmail.com>
> :>: > To: IBM-MAIN@listserv.ua.edu,
> :>: > Date: 05/10/2013 07:01 AM
> :>: > Subject: ICETOOL question
> :>: > Sent by: IBM Mainframe Discussion List <IBM-MAIN@listserv.ua.edu>
> :>: >
> :>: > Hi dear all,
> :>: >
> :>: > I would like to produce a statistic report using ICETOOL. This
> :>: > report should shown the percentage of records in the file 
according
> :>: > to their values e.g.
> :>: >
> :>: > Input:
> :>: >
> :>: > AAA
> :>: > BBB
> :>: > AAA
> :>: > CCC
> :>: > AAA
> :>: > BBB
> :>: >
> :>: > Output Percentages:
> :>: >
> :>: > AAA 50,0
> :>: > BBB 33,0
> :>: > CCC 16,7
> :>: >
> :>: > Is there any ICETOOL operator (like OCCUR) to find out the above
> :>: > percentage? Do I have to use various INCLUDE COND and then read 
the
> :>: > DFSMSG to extract percentages (from ICE054I 0 RECORDS - IN: xxx, 
OUT:
> :>: yyy) ?
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
> 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to