Joined: 29 May 2004 Posts: 16 Topics: 4 Location: chennai
Posted: Mon May 10, 2010 10:54 am Post subject: Percentage calculation usinig DFSORT
We are having two files with one file having the count of total number of requests and the other with the counter of only the completed requests. I would like to calculate the percentage and produce a report like the one below. I would like to set the Return code as 12 for the job if the percentage didn't reach 50.
Code:
STATUS AS OF (DATE & TIME OF THE JOB RUN) *************************************************************
Total Number Requests sent for today : < XXXX - count from file 1>
Total Number of Request completed : <XXXX - count from file 2>
Percentage of completion : <Percentage calculated >
I tried using the JoinKey option but I am facing with the following error
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 05:10 ON FRI MAY
JOINKEYS FILE=F1,FIELDS=(9,1,A)
$
ICE005A 0 STATEMENT DEFINER ERROR
I feel the DFSORT version we use might be a older one and is not accepting JOINKEYS. Any Help on this pls?
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Mon May 10, 2010 11:12 am Post subject:
karthikeyan,
What is the LRECL and RECFM of the input files?. What happens if the request is all empty but the complete file has records? Do you consider that it is above 50% ?
Can you copy the entire sysout from your error job as it helps us to determine the level the DFSORT you have. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 29 May 2004 Posts: 16 Topics: 4 Location: chennai
Posted: Mon May 10, 2010 11:35 am Post subject:
Kolusu
Thank you for your Quick response.
The Request and complete file have only counters of the number of records. Both the files will not be empty at any time as the counter is retrieved from a Unload SQL Select Query in the previous step. The chances are both the files can have the counter as 0. LRECL=80 and RECFM=FB. Though the files are having a record length of 80 the counter will not exceed more than 6 digits.
Code:
ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 09:33 ON MON MAY
JOINKEYS F1=REQ,FIELDS=(80,1,A)
$
ICE005A 0 STATEMENT DEFINER ERROR
JOINKEYS F2=RES,FIELDS=(80,1,A)
$
ICE005A 0 STATEMENT DEFINER ERROR
REFORMAT FIELDS=(F1:1,10,F2:1,10)
$
ICE005A 0 STATEMENT DEFINER ERROR
SORT FIELDS=COPY
OUTREC OVERLAY=(20:1,10,ZD,SUB,9,10,ZD,M11,LENGTH=10,
30:(1,10,ZD,MUL,+50),DIV,+100,M11,LENGTH=10)
OUTFIL NULLOFL=RC12,INCLUDE=(20,10,ZD,EQ,30,10,ZD)
$
ICE007A F SYNTAX ERROR
ICE056A 0 SORTIN NOT DEFINED
ICE751I 0 C5-K90013 C6-K90013 C7-K90000 C8-K42135 E7-K24705
ICE052I 3 END OF DFSORT
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Mon May 10, 2010 12:04 pm Post subject:
karthikeyan,
You canNOT set RC=12 with DFSORT. Here is a job which will give you the desired results which would set an RC of 4 if the completed requests is less than 50%. I assumed the 6 byte count starts from position 1 in both files and it is in readable format (ZD format)
SORT FIELDS=(7,1,CH,A),EQUALS
SUM FIELDS=(8,4,BI,12,2,BI)
OUTREC OVERLAY=(15:X,1,6,ZD,DIV,+2,M11,LENGTH=6,X,
(8,6,ZD,MUL,+100),DIV,1,6,ZD,MUL,+100,EDIT=(TTT.TT))
OUTFIL NULLOFL=RC4,INCLUDE=(8,6,CH,GE,16,6,CH),
BUILD=(25:C'STATUS AS OF ',DATE1(/),C' AT ',&TIME,/,25:35C'*',//,
05:C'TOTAL NUMBER REQUESTS SENT FOR TODAY : ',1,6,/,
05:C'TOTAL NUMBER OF REQUEST COMPLETED : ',8,6,/,
05:C'PERCENTAGE OF COMPLETION : ',23,6,/,
80:X)
//*
Joined: 29 May 2004 Posts: 16 Topics: 4 Location: chennai
Posted: Mon May 10, 2010 12:44 pm Post subject:
Kolusu
Thanks a ton. It works. But I would prefer to have the status report even when the percentage is less than 50%. Only that I need that return code to be set but report to be produced at any level.
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Mon May 10, 2010 2:32 pm Post subject:
karthikeyan wrote:
Kolusu
Thanks a ton. It works. But I would prefer to have the status report even when the percentage is less than 50%. Only that I need that return code to be set but report to be produced at any level.
karthikeyan,
Quite simple. Use this DFSORT JCL. SORTOUT will have the report and setrc file will set the return code of 4 depending on the count.
OUTFIL FNAMES=SETRC,NULLOFL=RC4,INCLUDE=(8,6,CH,GE,16,6,CH)
OUTFIL BUILD=(25:C'STATUS AS OF ',DATE1(/),
C' AT ',&TIME,/,25:35C'*',//,
05:C'TOTAL NUMBER REQUESTS SENT FOR TODAY : ',1,6,/,
05:C'TOTAL NUMBER OF REQUEST COMPLETED : ',8,6,/,
05:C'PERCENTAGE OF COMPLETION : ',23,6,/,
80:X)
//*
Joined: 29 May 2004 Posts: 16 Topics: 4 Location: chennai
Posted: Thu May 20, 2010 10:28 am Post subject:
Kolusu
Thank you for helping me. The solution works perfectly fine if both the counts are of the same number of digits and not for the ones if they are different. For example if the Request no is 20000 and the Complete no is 2000 the result is showing as 100% rather than 10%. This might be because zeroes are getting padded to the right for the completed ones. Is there a way to avoid this situation. Thank you.
Joined: 29 May 2004 Posts: 16 Topics: 4 Location: chennai
Posted: Fri Aug 20, 2010 8:12 am Post subject:
Kolusu
Though we are specifiying the EDIT pattern I am still getting the output percentage rounded. I am not getting the percentage with decimal values. Am I missing something?
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Fri Aug 20, 2010 10:34 am Post subject:
karthikeyan wrote:
Kolusu
Though we are specifiying the EDIT pattern I am still getting the output percentage rounded. I am not getting the percentage with decimal values. Am I missing something?
Yes you are missing the control cards you used and the input and output data. How are we supposed to help you without knowing what you did or change in your data?
Show us the complete sysout from the job and also the sample input and output. _________________ Kolusu
www.linkedin.com/in/kolusu
Joined: 29 May 2004 Posts: 16 Topics: 4 Location: chennai
Posted: Fri Aug 20, 2010 10:55 am Post subject:
Kolusu
Sorry about that. Please find the SYSOUT of the job.
The input is in two files. One has the total request count and the other the completed count. I would like the percentage to be displayed as 097.02 and not as 097.00.
Code:
STATUS AS OF 2010/08/20 AT 05:01:21
***********************************
TOTAL NUMBER REQUESTS SENT FOR TODAY : 057726
TOTAL NUMBER OF REQUEST COMPLETED : 056010
PERCENTAGE OF COMPLETION : 097.00
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum