MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Percentage calculation usinig DFSORT

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
karthikeyan
Beginner


Joined: 29 May 2004
Posts: 16
Topics: 4
Location: chennai

PostPosted: Mon May 10, 2010 10:54 am    Post subject: Percentage calculation usinig DFSORT Reply with quote

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?
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Mon May 10, 2010 11:12 am    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karthikeyan
Beginner


Joined: 29 May 2004
Posts: 16
Topics: 4
Location: chennai

PostPosted: Mon May 10, 2010 11:35 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Mon May 10, 2010 12:04 pm    Post subject: Reply with quote

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)

Code:


//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTIN   DD DSN=Your 1 recod count total req file,DISP=SHR
//         DD DSN=Your 1 recod count completed file,DISP=SHR         
//SORTOUT  DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,6,X,6X'00',SEQNUM,1,ZD,80:X)),     
  IFTHEN=(WHEN=(14,1,ZD,EQ,2),OVERLAY=(8:1,6))
                       
  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)                                                       
//*

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karthikeyan
Beginner


Joined: 29 May 2004
Posts: 16
Topics: 4
Location: chennai

PostPosted: Mon May 10, 2010 12:44 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Mon May 10, 2010 2:32 pm    Post subject: Reply with quote

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.

Code:

//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=Your 1 recod count total req file,DISP=SHR
//         DD DSN=Your 1 recod count completed file,DISP=SHR   
//SORTOUT  DD SYSOUT=*                                               
//SETRC    DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,6,X,6X'00',SEQNUM,1,ZD,80:X)),     
  IFTHEN=(WHEN=(14,1,ZD,EQ,2),OVERLAY=(8:1,6))                       
  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 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)                                                 
//* 

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karthikeyan
Beginner


Joined: 29 May 2004
Posts: 16
Topics: 4
Location: chennai

PostPosted: Thu May 20, 2010 10:28 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Thu May 20, 2010 11:07 am    Post subject: Reply with quote

karthikeyan,

huh? You mean to say that the numbers are left justified with spaces at the end? If so change the first INREC IFTHEN statement to the following

Code:
//SYSIN    DD *                                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(1,6,UFF,M11,LENGTH=6)),   
  IFTHEN=(WHEN=INIT,BUILD=(1,6,X,6X'00',SEQNUM,1,ZD,80:X)),

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karthikeyan
Beginner


Joined: 29 May 2004
Posts: 16
Topics: 4
Location: chennai

PostPosted: Fri Aug 20, 2010 8:12 am    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Fri Aug 20, 2010 10:34 am    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karthikeyan
Beginner


Joined: 29 May 2004
Posts: 16
Topics: 4
Location: chennai

PostPosted: Fri Aug 20, 2010 10:55 am    Post subject: Reply with quote

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

Thank you for a very Quick response.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12366
Topics: 75
Location: San Jose

PostPosted: Fri Aug 20, 2010 11:31 am    Post subject: Reply with quote

karthikeyan,

I wanted the sysout not the output. Change the following line

Code:

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


to

Code:

  OUTREC OVERLAY=(15:X,1,6,ZD,DIV,+2,M11,LENGTH=6,X,         
               (8,6,ZD,MUL,+10000),DIV,1,6,ZD,EDIT=(TTT.TT))
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group