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 

Comparing values from different reports

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


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Sat Oct 18, 2008 2:20 pm    Post subject: Comparing values from different reports Reply with quote

I have two jobs which produce reports seperately for example as below:
DAY 1
Code:
 


REPORTA


X   25.00

Y   32.00



Code:

REPORTB


X   40.00

Y   32.00

DAY 2
Code:
 


REPORTA


X   10.00

Y   45.00



Code:

REPORTB


X    5.00

Y   40.00


X & Y are some calculated values.

Daily as of now X from Report A is taken and subtracted from X of REPORT B manually as of today it is -15 let us call as Z.Similarly Y is taken daily from Report A and subtracted from Y of Report B manually as of today is 0 let us call as Z. Now both Z's are compared daily which is again manually done and -15 is not equal to 0 and Balance out of Condition is raised for Day 1 whereas for Day 2 Balance in condition is raised as 5 = 5.Somedays the values of Z's is same and Balance In condition is raised.Now I want to give a suggestion if possible can this process be done automatically and the status of the condition I want to send it as an email to the person who is responsble for doing this work manually so that he does not have to calcuate the difference daily and decide Balance / Out of Balance Condition.I am thinking SORT can achieve this result.Can anyone help me in this problem , the values in the report are in edited fashion and each report is produced by executing different programs seperately.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Sun Oct 19, 2008 12:20 pm    Post subject: Reply with quote

yadav2005,

The following JCL will create a single record with text 'BALANCE IN CONDITION' or 'BALANCE OUT OF CONDITION ' depending on the totals. You can send this file as an email.

Code:

//STEP0100 EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                       
REPORT A                                                               
                                                                       
                                                                       
X   25.00                                                             
Y   32.00                                                             
                                                                       
REPORT B                                                               
                                                                       
                                                                       
X   40.00                                                             
Y   32.00                                                             
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  INCLUDE COND=(1,1,SS,EQ,C'X,Y')                                     
  OPTION EQUALS,STOPAFT=4                                             
  SORT FIELDS=(1,1,CH,A)                                               
  INREC IFTHEN=(WHEN=INIT,BUILD=(X,5,5,UFF,PD,LENGTH=5,               
                +0,TO=PD,LENGTH=5,SEQNUM,1,ZD)),                       
  IFTHEN=(WHEN=(12,1,ZD,EQ,2),OVERLAY=(7:2,5,2:+0,TO=PD,LENGTH=5)),   
  IFTHEN=(WHEN=(12,1,ZD,EQ,3),OVERLAY=(2:+0,SUB,2,5,PD,PD,LENGTH=5)), 
  IFTHEN=(WHEN=(12,1,ZD,EQ,4),OVERLAY=(7:+0,SUB,2,5,PD,PD,LENGTH=5,   
                                       2:+0,TO=PD,LENGTH=5))           
  SUM FIELDS=(2,5,PD,7,5,PD)                                           
                                                                       
  OUTREC IFTHEN=(WHEN=(2,5,PD,EQ,7,5,PD),                             
  BUILD=(C'BALANCE IN CONDITION',80:X)),                               
  IFTHEN=(WHEN=NONE,BUILD=(C'BALANCE OUT OF CONDITION',80:X))         
/*                                                                     


Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Mon Oct 20, 2008 10:08 pm    Post subject: Reply with quote

Kolusu,

Thanks for the reply. But I have few constraints here , both the reports goes to spool ,so how do we put the reports in SORTIN and the formats of the reports are not exactly same , they are different i showed the output for simpilicity but positions of values of X & Y is known in both reports ,please let me know how it can be achieved and i hope i am clear in my question.Thanks.
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Tue Oct 21, 2008 1:18 am    Post subject: Reply with quote

Search for SDSF in batch. It is easy to copy output from the spool into a dataset for further processing, although you may have to increment the field positions by one to account for any carriage control bytes that get added.
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Oct 21, 2008 9:25 am    Post subject: Reply with quote

You could also write the output to dataset and then add a step to copy it to the spool. You then process the dataset.

Alternatively, you could, even, modify the process that produces the report so that the relevant lines are written to a dataset as well as to the report.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Oct 23, 2008 8:40 am    Post subject: Reply with quote

Kolusu,

What I have done is I have updated two programs to generate only the X & Y values to a dataset in both comp-3 form.
So in first dataset
Code:

X :      &
Y :       

Comp-3 data is of 6 bytes starting from pos 6 - 11 pos and as of now X is 25.00 and Y is -32.00
So in second dataset
Code:

X :         
Y :         

Comp-3 data is of 6 bytes starting from pos 6 - 11 pos and as of now X is 40.00 and Y is -10.00

Now the differnce between X's 25.00 and 40.00 is -15.00 , difference between Y's -32.00 - (-10.00) is -22.00 which is BALANCE OUT OF CONDITION
Now how can i change my code , please help to tailor my needs and i want the output in the below format to a dataset so that i can send as an email further.
Code:

BALANCE OUT OF CONDITION

DIFFERENCE BETWEEN X:   -15.00 (this should be in readible format)
DIFFERENCE BETWEEN Y:   -22.00 (this should be in readible format)

SINCE BOTH DIFFERENCES ARE NOT SAME BALANCE OUT OF CONDITION IS RAISED

If a BALANCE IN CONDITION is raised i want the output as
Code:

BALANCE IN CONDITION

DIFFERENCE BETWEEN X:   -10.00 (this should be in readible format)
DIFFERENCE BETWEEN Y:   -10.00 (this should be in readible format)

SINCE BOTH DIFFERENCES ARE SAME BALANCE IN CONDITION IS RAISED

I have another question if in a report / dataset ,if we have a value which is in readable format say as below:
Code:

   123.45

can we convert this value to a comp-3 format and store in a dataset.

Please help me how to achieve this two requirements.Hope i am clear in my question.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Oct 23, 2008 10:54 am    Post subject: Reply with quote

Yadav2005,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICEMAN                                             
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=YOUR REPORT1,DISP=SHR                                       
//         DD DSN=YOUR REPORT2,DISP=SHR                                       
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(X,6,6,+0,TO=PD,LENGTH=6,SEQNUM,1,ZD)),
  IFTHEN=(WHEN=(14,1,ZD,EQ,2),OVERLAY=(8:2,6,2:+0,TO=PD,LENGTH=6)),   
  IFTHEN=(WHEN=(14,1,ZD,EQ,3),OVERLAY=(2:+0,SUB,2,6,PD,PD,LENGTH=6)), 
  IFTHEN=(WHEN=(14,1,ZD,EQ,4),OVERLAY=(8:+0,SUB,2,6,PD,PD,LENGTH=6,   
                                       2:+0,TO=PD,LENGTH=6))           
  SORT FIELDS=(1,1,CH,A)
  SUM FIELDS=(2,6,PD,8,6,PD)
                                                                       
  OUTFIL IFTHEN=(WHEN=(2,6,PD,EQ,8,6,PD),                             
  BUILD=(80X,/,C'BALANCE IN CONDITION',/,80X,/,                       
  C'DIFFERENCE BETWEEN X: ',                                           
  2,6,PD,EDIT=(SIIIIIIIIT.TT),SIGNS=(,-),/,                           
  C'DIFFERENCE BETWEEN Y: ',                                           
  8,6,PD,EDIT=(SIIIIIIIIT.TT),SIGNS=(,-),/,80X,/,                     
  C'SINCE BOTH DIFFERENCES ARE SAME BALANCE IN',                       
  C' CONDITION IS RAISED',80:X)),                                     
                                                                       
  IFTHEN=(WHEN=NONE,                                                   
  BUILD=(80X,/,C'BALANCE OUT OF CONDITION',/,80X,/,                   
  C'DIFFERENCE BETWEEN X: ',                                           
  2,6,PD,EDIT=(SIIIIIIIIT.TT),SIGNS=(,-),/,                           
  C'DIFFERENCE BETWEEN Y: ',                                           
  8,6,PD,EDIT=(SIIIIIIIIT.TT),SIGNS=(,-),/,80X,/,                     
  C'SINCE BOTH DIFFERENCES ARE NOT SAME BALANCE',                     
  C' OUT OF CONDITION IS RAISED',80:X))                               
/*


Yadav2005 wrote:

I have another question if in a report / dataset ,if we have a value which is in readable format say as below:
Code:

   123.45

can we convert this value to a comp-3 format and store in a dataset.


Yes you can. Simply use UFF format for unsigned values and SFF format for signed values

for ex if the value 123.45 starts at pos 5 for a length of 9, you can use the following statement to convert that number into comp-3 format

Code:
INREC OVERLAY=(5:5,9,UFF,PD,LENGTH=9)


This will create a 9 byte comp-3 variable in pos 5


If you have signed values then use the following statement

Code:
INREC OVERLAY=(5:5,9,SFF,PD,LENGTH=9)


This will create a 9 byte comp-3 variable in pos 5

Hope this helps...

Cheers
_________________
Kolusu
www.linkedin.com/in/kolusu


Last edited by kolusu on Thu Oct 23, 2008 11:17 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Oct 23, 2008 11:10 am    Post subject: Reply with quote

Kolusu,

Thanks a lot and a ton for your help and you have always helped with a very clear explanation.Any kind of problem with file manipulations with SORT ,Kolusu and Frank are there.
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Oct 23, 2008 11:13 am    Post subject: Reply with quote

Kolusu,

A question more why are u using ICEMAN instead of SORT , what are the advantages of using ICEMAN instead of SORT , i guess ICEMAN uses SORT as it background.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Oct 23, 2008 11:17 am    Post subject: Reply with quote

yadav2005 wrote:
Kolusu,

A question more why are u using ICEMAN instead of SORT , what are the advantages of using ICEMAN instead of SORT , i guess ICEMAN uses SORT as it background.



Please SEARCH before posting. Check these links

http://www.mvsforums.com/helpboards/viewtopic.php?t=10067&highlight=iceman+alias

http://www.mvsforums.com/helpboards/viewtopic.php?t=2504&highlight=iceman+alias
_________________
Kolusu
www.linkedin.com/in/kolusu
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