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 2 Files using sort
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Ravi
Beginner


Joined: 27 Jun 2005
Posts: 88
Topics: 2

PostPosted: Wed Nov 02, 2005 6:39 am    Post subject: Reply with quote

Quote:

Well my typical day begins at 5 AM . I just answer questions before going to work and monitor the board from work.
so when does a typical night end??

Frank I was referring to this
Quote:

Frank Yaeger - DFSORT Team (IBM)
Specialties: ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort/
Back to top
View user's profile Send private message
ranga_subham
Intermediate


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Mon Apr 03, 2006 2:16 am    Post subject: Reply with quote

Hi,

I've just changed the solution provided by Kolusu to suit SYNCSORT because, OPTIONS EQUALS does not work with SYNCSORT.

Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD *                 
12345 RAM                       
33333 SENTHIL                   
78888 VENU                       
//         DD *                 
12345 RAM                       
21156 MAHESH                     
33333 SENTHIL                   
78900 PRAKASH                   
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                 
  INREC FIELDS=(1,80,C'00000001')
  SORT FIELDS=(1,5,CH,A),EQUALS 
  SUM FIELDS=(81,8,ZD)           
  OUTFIL INCLUDE=(81,8,ZD,GT,1),
  OUTREC=(1,80)                 
/*


With this we are copying the matching records to output files. What should be added to copy the non-matching records to another output file(s)?
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Apr 03, 2006 4:40 am    Post subject: Reply with quote

Quote:

I've just changed the solution provided by Kolusu to suit SYNCSORT because, OPTIONS EQUALS does not work with SYNCSORT.

ranga_subham,

Says who ? Your shop might NOT have it as installed DEFAULT. Syncsort does support Option equals. Check this Link which shows a job to list all the installed defaults in your shop

http://mvsforums.com/helpboards/viewtopic.php?p=12002#12002

Quote:

With this we are copying the matching records to output files. What should be added to copy the non-matching records to another output file(s)?


you need to add 1 more OUTFIL statement and UNQ file declaration
Code:

  OUTFIL FNAMES=UNQ,SAVE,
  OUTREC=(1,80)                 
/*


Code:

//UNQ      DD SYSOUT=*           


Hope this helps...

Cheers

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


Joined: 31 Jan 2006
Posts: 255
Topics: 72

PostPosted: Tue Apr 04, 2006 8:02 am    Post subject: Reply with quote

Kolusu, Thanks for your insight. It is really amazing and surprising about the acumen you have on any subject. How do you get time to acquire knowledge? I am jealous of you........... Wink

I will try this solution and come back here. Smile

Thanks a lot. Very Happy
_________________
Ranga
*****
None of us is as smart as all of us - Ken Blanchard
Back to top
View user's profile Send private message
hari108
Beginner


Joined: 03 Feb 2006
Posts: 16
Topics: 4

PostPosted: Wed Jul 16, 2008 6:55 am    Post subject: Reply with quote

Hi Kolusu,

I have similar request here, but in this case I'm comparing the counts of the files;

File1: NO. OF RECORDS: 00012345
File1 properties: RECFM: FB, LRECL=80

File2: NO. OF RECORDS: 00012300
File2 properties: RECFM: FB, LRECL=80

When the count doesn't match between the two files I need to Abend the Job. Otherwise the job should run normally.

Please advise!!
_________________
Thanks,
Hari
Back to top
View user's profile Send private message Yahoo Messenger
Nic Clouston
Advanced


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

PostPosted: Wed Jul 16, 2008 4:05 pm    Post subject: Reply with quote

A) this is not a JCL problem
B) It is a new topic
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jul 16, 2008 5:45 pm    Post subject: Reply with quote

Hari,

Kolusu is in class today, so I'll try to help you.

Quote:
When the count doesn't match between the two files I need to Abend the Job. Otherwise the job should run normally.


If by "run normally", you mean get RC=0, then this DFSORT job will do what you asked for. It will give RC=0 when the count in the two records match, or a U0209 ABEND when the count in the two records don't match. If you really want a RC=16 rather than an ABEND, then remove the DEBUG ABEND statement.

Code:

//S1 EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN01 DD *
File1: NO. OF RECORDS: 00012345
//SORTIN02 DD *
File2: NO. OF RECORDS: 00012300
//OUT1 DD DUMMY
//SYSIN    DD    *
  DEBUG ABEND
  MERGE FIELDS=(1,1,CH,A)
  SUM FIELDS=(24,8,ZD)
  OUTFIL FNAMES=OUT1,
    INCLUDE=(24,8,ZD,NE,0),
    NULLOFL=RC16
/*


The input files above will result in RC=0.

If you had these input files:

Code:

//SORTIN01 DD *
File1: NO. OF RECORDS: 00012300
//SORTIN02 DD *
File2: NO. OF RECORDS: 00012300


it would result in ABEND U0209.

If that's not what you want, then you need to explain more clearly what you do want.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hari108
Beginner


Joined: 03 Feb 2006
Posts: 16
Topics: 4

PostPosted: Thu Jul 17, 2008 12:05 am    Post subject: Reply with quote

Hi Frank,

Thanks for your inputs!!

I tried to run the above JCL, It's giving RC=0 for both scenario's.
i.e incase the count matches RC=0, and also incase the count does NOT matches RC=0.
Quote:

If that's not what you want, then you need to explain more clearly what you do want.

My requirement;
Case#1:
Code:
//SORTIN01 DD *
File1: NO. OF RECORDS: 00012300
//SORTIN02 DD *
File2: NO. OF RECORDS: 00012300

The count MATCH, I should get RC=0

Case#2:
Code:
//SORTIN01 DD *
File1: NO. OF RECORDS: 00012300
//SORTIN02 DD *
File2: NO. OF RECORDS: 00012333

The count do NOT MATCH, I should get RC=16

Hope this is clear Smile
_________________
Thanks,
Hari
Back to top
View user's profile Send private message Yahoo Messenger
hari108
Beginner


Joined: 03 Feb 2006
Posts: 16
Topics: 4

PostPosted: Thu Jul 17, 2008 12:40 am    Post subject: Reply with quote

hari108 wrote:
I tried to run the above JCL, It's giving RC=0 for both scenario's.
i.e incase the count matches RC=0, and also incase the count does NOT matches RC=0.


I'm sorry Frank, I made a mistake while running the job which had resulted in RC=0, But the actual RC is ABEND S0C7. i.e incase the count matches RC=0, and also incase the count does NOT matches RC=0.

This is the JCL which resulted in S0C7;
Code:
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*     
//NOMATCH  DD SYSOUT=*     
//SORTIN01 DD *           
NO. OF RECORDS: 00012300   
//SORTIN02 DD *           
NO. OF RECORDS: 00012333   
//OUT1 DD DUMMY           
//SYSIN    DD    *         
  DEBUG ABEND             
  MERGE FIELDS=(1,1,CH,A) 
  SUM FIELDS=(24,8,ZD)     
  OUTFIL FNAMES=OUT1,     
    INCLUDE=(24,8,ZD,NE,0),
    NULLOFL=RC16           
/*                         

_________________
Thanks,
Hari
Back to top
View user's profile Send private message Yahoo Messenger
hari108
Beginner


Joined: 03 Feb 2006
Posts: 16
Topics: 4

PostPosted: Thu Jul 17, 2008 12:45 am    Post subject: Reply with quote

correction:
Quote:

But the actual RC is ABEND S0C7. i.e incase the count matches RC=0, and also incase the count does NOT matches RC=0.

But the actual RC is ABEND S0C7. i.e incase the count matches ABEND S0C7, and also incase the count does NOT matches ABEND S0C7.
_________________
Thanks,
Hari
Back to top
View user's profile Send private message Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jul 17, 2008 10:03 am    Post subject: Reply with quote

You get the S0C7 because I thought your count field started in 24, but it appears to start in 17. Since you didn't specify where it started, I assumed the wrong starting position.

But my original job wouldn't have given the correct results anyway because I forgot to multiply one of the counts by -1 so the SUM would give 0 when the counts were the same. Here's a new version of the job that will give RC=0 for different counts and U0209 for the same count.

Code:

//S1  EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN01 DD *
NO. OF RECORDS: 00012300
//SORTIN02 DD *
NO. OF RECORDS: 00012333
//OUT1 DD DUMMY
//SYSIN    DD    *
  DEBUG ABEND
  MERGE FIELDS=(1,1,CH,A)
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(31:SEQNUM,1,ZD)),
        IFTHEN=(WHEN=(31,1,ZD,EQ,1),
          OVERLAY=(17:17,8,ZD,MUL,-1,TO=ZD,LENGTH=8))
  SUM FIELDS=(17,8,ZD)
  OUTFIL FNAMES=OUT1,
    INCLUDE=(17,8,ZD,NE,0),
    NULLOFL=RC16
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort


Last edited by Frank Yaeger on Fri Jul 18, 2008 11:01 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hari108
Beginner


Joined: 03 Feb 2006
Posts: 16
Topics: 4

PostPosted: Thu Jul 17, 2008 11:20 pm    Post subject: Reply with quote

Hi Frank,

Your job runs fine!! Thanks!!

But my requirement is this;
Quote:

Case#1:
Code:
Code:
//SORTIN01 DD *
File1: NO. OF RECORDS: 00012300
//SORTIN02 DD *
File2: NO. OF RECORDS: 00012300

The count MATCH, I should get RC=0

Case#2:
Code:
Code:
//SORTIN01 DD *
File1: NO. OF RECORDS: 00012300
//SORTIN02 DD *
File2: NO. OF RECORDS: 00012333

The count do NOT MATCH, I should get RC=16


Pls advise!!
_________________
Thanks,
Hari
Back to top
View user's profile Send private message Yahoo Messenger
hari108
Beginner


Joined: 03 Feb 2006
Posts: 16
Topics: 4

PostPosted: Thu Jul 17, 2008 11:35 pm    Post subject: Reply with quote

I made the below change and it works like a charm Very Happy
Code:

  OUTFIL FNAMES=OUT1,
    INCLUDE=(17,8,ZD,EQ,0),
    NULLOFL=RC16
/*


I have a question;
What to do if I just have the count in the files; I did the below change, but it didn't work out Sad
Code:
//S1  EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//NOMATCH  DD SYSOUT=*
//SORTIN01 DD *
00012300
//SORTIN02 DD *
00012333
//OUT1 DD DUMMY
//SYSIN    DD    *
  DEBUG ABEND
  MERGE FIELDS=(1,1,CH,A)
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(31:SEQNUM,1,ZD)),
        IFTHEN=(WHEN=(31,1,ZD,EQ,1),
          OVERLAY=(1:1,8,ZD,MUL,-1,TO=ZD,LENGTH=8))
  SUM FIELDS=(1,8,ZD)
  OUTFIL FNAMES=OUT1,
    INCLUDE=(1,8,ZD,EQ,0),
    NULLOFL=RC16
/*


Thank you once again Frank!!
_________________
Thanks,
Hari
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Jul 18, 2008 10:41 am    Post subject: Reply with quote

hari108,

use the following job. Concatenate both files to sortin.
Code:

//STEP100  EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
00012300
00012333
//OUT1 DD DUMMY
//SYSIN    DD    *
  SORT FIELDS=(10,1,CH,A)
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(11:SEQNUM,1,ZD)),
        IFTHEN=(WHEN=(11,1,ZD,EQ,1),
          OVERLAY=(1:1,8,ZD,MUL,-1,TO=ZD,LENGTH=8))
  SUM FIELDS=(1,8,ZD)
  OUTFIL FNAMES=OUT1,INCLUDE=(1,8,ZD,EQ,0),
   NULLOFL=RC16
/*


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
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jul 18, 2008 11:05 am    Post subject: Reply with quote

Hari,

You originally asked for an ABEND so I showed you how to get an ABEND and I said:

Quote:
If you really want a RC=16 rather than an ABEND, then remove the DEBUG ABEND statement.


For your new requirement, you can use this DFSORT job:

Code:

//S1  EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN01 DD *
00012300
//SORTIN02 DD *
00012333
//OUT1 DD DUMMY
//SYSIN    DD    *
  MERGE FIELDS=(10,1,CH,A)
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(12:SEQNUM,1,ZD)),
        IFTHEN=(WHEN=(12,1,ZD,EQ,1),
          OVERLAY=(1:1,8,ZD,MUL,-1,TO=ZD,LENGTH=8))
  SUM FIELDS=(1,8,ZD)
  OUTFIL FNAMES=OUT1,
    INCLUDE=(1,8,ZD,EQ,0),
    NULLOFL=RC16
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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 -> Job Control Language(JCL) All times are GMT - 5 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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