Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Rohit Umarjikar wrote: |
Yes, you are right the 25 value should be the %.
And file1 value will be at max equals to file 2 value so it will be max of 100%. |
Rohit Umarjikar,
You only show 2 digit values and when you calculate the percentage it might result in 3 digits (100%) and you want to compare this to a 2 digit number. Is the data just 2 bytes? or 3 bytes? There are no checks to see if the numbers you pass are valid numbers. what happens if the input has negative numbers or spaces or zeroes?
Assuming that each of the input file has just 1 record and the first 2 bytes have the data,
here is a job which would set the return code to 4 if the calculated percentage is NOT equal to the percentage value in file 3.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=Your input Lrecl 20 File1,DISP=SHR
// DD DSN=Your input Lrecl 20 File2,DISP=SHR
//*
//INB DD Your input Lrecl 20 File3,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(21,1,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(21,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,8,F2:1,3)
INREC OVERLAY=(15:(5,3,ZD,MUL,+100),DIV,1,3,ZD,EDIT=(TTT))
OUTFIL NULLOFL=RC4,INCLUDE=(9,3,ZD,EQ,15,3,ZD)
//*
//JNF1CNTL DD *
OPTION STOPAFT=2
INREC IFTHEN=(WHEN=INIT,BUILD=(C'0',1,2,21:SEQNUM,1,ZD)),
IFTHEN=(WHEN=GROUP,RECORDS=3,PUSH=(5:1,3))
//*
//JNF2CNTL DD *
OPTION STOPAFT=1
INREC BUILD=(C'0',1,2,21:C'2')
//* |
|
|