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

Reply via email to