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 

compare, count and abend
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Jun 09, 2010 6:23 am    Post subject: compare, count and abend Reply with quote

Hi,

We receive two files (LRECL=345, RECFM=FB) from two different system. These files will have several records in form of sets.

File-A:
Code:

AAA REC01
BBB REC01
CCC REC01
AAA REC02
BBB REC02
CCC REC02


File-B:
Code:

AAA REC01
BBB REC01
CCC REC01
AAA REC02
BBB REC02
CCC REC02


My requirement is to compare type "AAA" records from both the datasets and issue a non-zero return code if the no. of "AAA" does not equal between Fiel-A and File-B. I want to compare the no. of "AAA" but not the entire record for any changes.

Please suggest.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 09, 2010 10:24 am    Post subject: Reply with quote

mf_user,

How do you recognize each group? When do you want to set a non zero return code? Lets say you have 10 groups and only 1 group count is off . Do you set the return code? or lets assume all the 10 group count is off. Do you set a different code?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Jun 09, 2010 10:32 am    Post subject: sorry Reply with quote

Hi,

I am sorry..........I've not understood your question. I tried out the below given sort solution and got the counts from both files written to output. But, don't know how I would do the compare.

Code:

//STEP0001 EXEC PGM=ICETOOL                           
//TOOLMSG  DD SYSOUT=*                               
//DFSMSG   DD SYSOUT=*                               
//IN1      DD DSN=FILE-A,
//            DISP=(SHR,KEEP,KEEP)                   
//IN2      DD DSN=FILE-B,
//            DISP=(SHR,KEEP,KEEP)                   
//OUT1     DD SYSOUT=*                               
//OUT2     DD SYSOUT=*                               
//TOOLIN   DD *                                       
  COUNT FROM(IN1) USING(MFU1) WRITE(OUT1) DIGITS(10) 
  COUNT FROM(IN2) USING(MFU1) WRITE(OUT2) DIGITS(10) 
/*                                                   
//MFU1CNTL DD *                                       
  INCLUDE COND=(1,3,CH,EQ,C'AAA')                     
/*                                                   


My idea is to compare both the counts, if mismatch then issue a non-zero return code so that the it sends an alert to operation team.

Please suggest.

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 09, 2010 10:38 am    Post subject: Reply with quote

Quote:
These files will have several records in form of sets.


mf_user,

How do you recognize each set? Is there an indicator ?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Jun 09, 2010 10:40 am    Post subject: Reply with quote

Yes........every set starts with 'AAA' and ends with 'CCC' - both the files.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 09, 2010 11:08 am    Post subject: Reply with quote

mf_user,

The following DFSORT JCL will give you the desired results . If the number of records in each set do not match then a return code of 4 is set.

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//INA      DD DSN=Your 345 byte FB input file A,DISP=SHR
//INB      DD DSN=Your 345 byte FB input file B,DISP=SHR         
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
  OPTION COPY                                                 
  JOINKEYS F1=INA,FIELDS=(346,16,A)                           
  JOINKEYS F2=INB,FIELDS=(346,16,A)                           
  JOIN UNPAIRED                                               
  REFORMAT FIELDS=(?,F1:1,345)                                 
  OUTFIL OMIT=(1,1,CH,EQ,C'B'),BUILD=(2,345),NULLOFL=RC4       
//JNF1CNTL DD *                                               
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'AAA'),           
                 END=(1,3,CH,EQ,C'CCC'),PUSH=(346:ID=8,SEQ=8))
//JNF2CNTL DD *                                               
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'AAA'),           
                 END=(1,3,CH,EQ,C'CCC'),PUSH=(346:ID=8,SEQ=8))
//*

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


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Jun 09, 2010 11:19 am    Post subject: Reply with quote

Thank you very much........

Would you please explain me "REFORMAT FIELDS=(?,F1:1,345)".
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 09, 2010 11:23 am    Post subject: Reply with quote

mf_user wrote:
Thank you very much........

Would you please explain me "REFORMAT FIELDS=(?,F1:1,345)".


Mf_user,

For complete details of Joinkeys and other functions, see "User Guide for DFSORT PTFs UK51706 and UK51707" paper (sortugpg.pdf) at:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Jun 09, 2010 11:24 am    Post subject: Reply with quote

Kolusu,

Quote:

If the number of records in each set do not match then a return code of 4 is set.


I am confused. Does this mean, it is going to compare the set of records between files instead of comparing the no. of "AAA" type records?

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 09, 2010 11:36 am    Post subject: Reply with quote

mf_user,

Ok lets start over. You really need to improve on explaining your requirements. This is what I assumed.

File A DCB = ( LRECL=345,RECFM=FB)

Key position 1,3 each group starts with AAA and ends with CCC

Contents

Code:

AAA REC01     << File A GROUP 01   
BBB REC01     << File A GROUP 01   
CCC REC01     << File A GROUP 01   

AAA REC02     << File A GROUP 02   
BBB REC02     << File A GROUP 02   
CCC REC02     << File A GROUP 02   

AAA REC03     << File A GROUP 03  <<< Missing Group
BBB REC03     << File A GROUP 03  <<< Missing Group
CCC REC03     << File A GROUP 03  <<< Missing Group   



File A DCB = ( LRECL=345,RECFM=FB)

Key position 1,3 each group starts with AAA and ends with CCC

Contents

Code:

AAA REC01     << File B GROUP 01   
BBB REC01     << File B GROUP 01   
CCC REC01     << File A GROUP 01   

AAA REC02     << File B GROUP 02   
BBB REC02     << File B GROUP 02   
BBC REC02     << File B GROUP 02  << additional record   
CCC REC02     << File B GROUP 02                                                       


I need to match the sets from both files and if there is a descrepancy then set a non zero return code

Output can be just the missing/additional records


The shown job does exactly that
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Jun 09, 2010 11:42 am    Post subject: Reply with quote

Kolusu, thanks for providing the details...........
sorry......this is not what I want bonk

It is like just matching the count of records from two files.....a plain match of counts between two files. I posted my SORT job........that count should be matched.......

We receive two files from two different systems and the count of type AAA only to be matched and nothing else...... Smile

I agree that I am poor in explaining the things Embarassed

Thanks for all your time.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Wed Jun 09, 2010 12:04 pm    Post subject: Reply with quote

mf_user,

Use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*
//INA      DD DSN=Your 345 byte FB input file A,DISP=SHR
//INB      DD DSN=Your 345 byte FB input file B,DISP=SHR
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  OPTION COPY                                     
  JOINKEYS F1=INA,FIELDS=(1,3,A)                   
  JOINKEYS F2=INB,FIELDS=(1,3,A)                   
  JOIN UNPAIRED                                   
  REFORMAT FIELDS=(F1:346,8,F2:346,8)             
  OUTFIL OMIT=(1,8,CH,NE,9,8,CH),NULLOFL=RC4       
//JNF1CNTL DD *                                   
  INCLUDE COND=(1,3,CH,EQ,C'AAA')                 
  INREC OVERLAY=(346:7C'0',C'1')                   
  SUM FIELDS=(346,8,ZD)                           
//*                                               
//JNF2CNTL DD *                                   
  INCLUDE COND=(1,3,CH,EQ,C'AAA')                 
  INREC OVERLAY=(346:7C'0',C'1')                   
  SUM FIELDS=(346,8,ZD)                           
//*                                               

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


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Jun 10, 2010 10:22 am    Post subject: Reply with quote

Kolusu, thanks a lot the solution... Very Happy
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Thu Jun 10, 2010 11:55 am    Post subject: Reply with quote

Kolusu, before trying the solution you've provided I've tried the below given sample SORT and it seems not working as expected.......I get MAXCC=0 Exclamation

Code:

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTJNF1 DD *                               
AAA0002                                       
//SORTJNF2 DD *                               
AAA0001                                       
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  OPTION COPY                                 
  JOINKEYS FILE=F1,FIELDS=(1,3,A)             
  JOINKEYS FILE=F2,FIELDS=(1,3,A)             
  JOIN UNPAIRED                               
  REFORMAT FIELDS=(F1:1,7,F2:1,7)             
  OUTFIL OMIT=(4,4,CH,NE,11,4,CH),NULLOFL=RC4
//*                                           


Is something wrong with this code Question Would you please help Idea

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Jun 10, 2010 12:20 pm    Post subject: Reply with quote

mf_user wrote:
Kolusu, before trying the solution you've provided I've tried the below given sample SORT and it seems not working as expected.......I get MAXCC=0 Exclamation

Is something wrong with this code Question Would you please help Idea

Thanks.


I ran the code and got a return code of 4. You need to show me the sysout if you say you got a return code of 0.
_________________
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
Goto page 1, 2  Next
Page 1 of 2

 
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