Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Comparison of two files
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Wed Jun 19, 2013 5:27 am    Post subject: Comparison of two files
Reply with quote

I have a requirement where in two files have to be compared and if both the files are byte byte same then SET a RC code = 8.and if not then the third file is generated.

I have tried using the SORT and ICETOOL but when compared the the MAXCC is always set to ZERO.

Should there be a condition COND=(0,LT, SEt RC=8)
can you please help me on this to how can i be able to check the condition.
Is that the Third file be checked for the blanks and then set a MAXCC = 8. Please help me on this.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 19, 2013 6:03 am    Post subject:
Reply with quote

Hello,

Quote:
I have tried using the SORT and ICETOOL but when compared the the MAXCC is always set to ZERO.
Show what you have tried and what happened.

Quote:
Should there be a condition COND=(0,LT, SEt RC=8)
No - as there is no such syntax.

When is this "3rd" file created? The explanaton given is not clear.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Wed Jun 19, 2013 10:14 am    Post subject:
Reply with quote

Also let us know your sort product
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Fri Jun 21, 2013 3:41 am    Post subject:
Reply with quote

This is my step where the comparision is done

Code:

//STEP1   EXEC PGM=ICETOOL,COND=(4,LT)                       
//TOOLMSG DD SYSOUT=*                                       
//DFSMSG  DD SYSOUT=*                                       
//IN1     DD DISP=SHR,DSN=<File1>
//IN2     DD DISP=SHR,DSN=<File2>
//T1      DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(5,5)),         
//           DISP=(MOD,PASS)                                 
//OUT12   DD DISP=SHR,DSN=<file3>
//OUT1    DD *                                               
//OUT2    DD *                                               
//TOOLIN  DD *                                               
  COPY FROM(IN1) TO(T1) USING(CTL1)                         
  COPY FROM(IN2) TO(T1) USING(CTL2)                         
  SPLICE FROM(T1) TO(OUT12) ON(1,250,CH) WITH(251,1) -       
  USING(CTL3) KEEPNODUPS                                     
/*                                                           
//CTL1CNTL DD *                                             
//CTL2CNTL DD *                                             
//CTL3CNTL DD *                                             
  OUTFIL FNAMES=OUT12,BUILD=(1,250)                         
/*


File 1 ---
Code:
Header06022013
11111
12222
23333
12224
Trailer

File2-------
Code:
Header06012013
11111
12222
23333
11112
Trailer
File 2 is the older file and file 1 is the new file so when im comparing both files i should get the o/p in file3 as only

File3----
Code:
12224
and for scenario 2:
File 1 ---
Code:
Header06022013
11111
12222
23333
12224
Trailer


File2-------
Code:
Header06022013
11111
12222
23333
12224
Trailer

when file 1 and file 2 are both same the job should abend with RC-8 i need to specify the cond explicity to abend when both files are same please help me with the syntax.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 21, 2013 4:01 am    Post subject:
Reply with quote

run the following job and show us the complete sysout which will help us determine the level of DFSORT

Code:

//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Fri Jun 21, 2013 4:20 am    Post subject:
Reply with quote

Hi Kolusu,
I have run the Job and below are the parameters
Code:

SYSIN :                                                                       
  OPTION COPY                                                           0009130
WER276B  SYSDIAG= 285342, 1631991, 1631991, 3521025                           
WER164B  7,408K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,             
WER164B     0 BYTES RESERVE REQUESTED, 2,288K BYTES USED                       
WER146B  20K BYTES OF EMERGENCY SPACE ALLOCATED                               
WER108I  SORTIN   : RECFM=FB   ; LRECL=   250; BLKSIZE= 27750                 
WER073I  SORTIN   : DSNAME=<File1>
WER110I  SORTOUT  : RECFM=FB   ; LRECL=   250; BLKSIZE= 27750                 
WER074I  SORTOUT  : DSNAME=NULLFILE                                           
WER410B  5,868K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,       
WER410B     0 BYTES RESERVE REQUESTED, 2,164K BYTES USED                       
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                 
WER416B  SORTIN   : EXCP'S=1,UNIT=3390,DEV=D0DB,CHP=(01050D12161F22,1),VOL=FPM0
WER416B  BSAM WAS USED FOR SORTOUT                                             
WER054I  RCD IN         34, OUT         34                                     


I need when both same files are compared the job should abend else it should run fine. currently even if both the files are same the job is running with MAXCC=0 but i need to modulate to run with maxcc=8 when both files compared are same.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Jun 21, 2013 4:59 am    Post subject: Reply to: COmparision of two files
Reply with quote

Well, you have SyncSort, not DFSORT.

Can you include the bit from the sysout which tells us which version of SyncSort you have?

You're going to be better with JOINKEYS instead of SPLICE.

If you use OUTFIL OMIT for the F1 part of the REFORMAT equal to the F2 then if the files are identical, you'll have no output records. There is an option to set a return-code for no output from OUTFIL. Set your SORTOUT to DD DUMMY, as all you are interested in is the RC.
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Fri Jun 21, 2013 5:48 am    Post subject:
Reply with quote

Hi Bill,
As you suggested i had the approach with the JOINKEYS

Here is what I have done
Code:

//STEP1    EXEC PGM=SORT,COND=(4,LT)   
//SYSPRINT DD  SYSOUT=*                                       
//SYSLIST  DD  SYSOUT=*                                       
//SYSOUT   DD  SYSOUT=*                                       
//SYSUDUMP DD  SYSOUT=*                                       
//SORTJNF1 DD DISP=SHR,DSN=File1
//SORTJNF2 DD DISP=SHR,DSN=File2
//SORTOUT  DD DSN=File3,
//            DISP=SHR                                       
//SYSIN    DD *
   SORT FIELDS=COPY                                           
     JOINKEYS FILE=F1,FIELDS=(1,250,CH,A)                     
     JOINKEYS FILE=F2,FIELDS=(1,250,CH,A)                     
     JOIN UNPAIRED F1 ONLY                                   
     REFORMAT FIELDS=(F1:1,250,F2:1,250)                     
   OMIT COND=((1,6,CH,EQ,C'HEADER'),OR,(1,7,CH,EQ,C'TRAILER'),OR, 
              (1,250,CH,EQ,C' '))                             
/*


When i Used thabove JOINKEYS the F3 File is always filled with values.

Say in scenario Where Files F1 is compared to F1 then still in the O/P I get the records of F1.

Instead my scenario here is :
1. When Two identical files F1 and F2 are compared then the MAXCC should be set = 8.
2. When F1 and F2 different then The records in F1 which are not in F2 are to be copied to F3.

But the above JOINKEYS are not serving my purpose.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 21, 2013 6:54 am    Post subject:
Reply with quote

Hello,

Is there some reason you have not run the jcl provided above? It will provide this answer:
Quote:
Can you include the bit from the sysout which tells us which version of SyncSort you have?


Or, you could post the top part of the info you did post from a run.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2163
Location: @my desk

PostPosted: Fri Jun 21, 2013 9:37 am    Post subject:
Reply with quote

Also what are you trying to do with the header and trailer records in the JOIN OMIT COND shown above. Your explanation of the requirement seems to be incomplete.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Jun 21, 2013 11:40 am    Post subject: Reply to: Comparison of two files
Reply with quote

Try this instead. Then work when you get no output on SORTOUT, work out the correct way to get a non-zero RC.

Code:
    JOINKEYS FILE=F1,FIELDS=(1,250,CH,A)                     
    JOINKEYS FILE=F2,FIELDS=(1,250,CH,A)                     
 
    JOIN UNPAIRED                               

    REFORMAT FIELDS=(F1:1,250,F2:1,250)                     

    SORT FIELDS=COPY                                           
    OMIT COND=(1,250,CH,EQ,251,250,CH)
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jun 21, 2013 12:24 pm    Post subject:
Reply with quote

Hi,

I'm not sure you can get SYNCSORT to set a rc of 8,

you can try replacing
Code:
    OMIT COND=(1,250,CH,EQ,251,250,CH)

with
Code:
   OUTFIL FNAMES=OUT,OMIT=(1,250,CH,EQ,251,250,CH),NULLOFL=RC4 


This will result in a rc of 4.

You will need to replace SORTOUT with OUT DD


Gerry
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Jun 21, 2013 12:37 pm    Post subject: Reply to: Comparison of two files
Reply with quote

NULLOUT is for SORTOUT. NULLOFL is for OUTFIL files.

1.4.something apparently has RC setting for when there is data on a file.

Yes, you can't get 8 directly. But it's the requirement...
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2163
Location: @my desk

PostPosted: Fri Jun 21, 2013 12:54 pm    Post subject:
Reply with quote

Hi Bill,

The TS needs the unpaired F1 records as well in the output, in addition to the RC .
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Fri Jun 21, 2013 1:15 pm    Post subject: Reply to: Comparison of two files
Reply with quote

Hi Arun,

The "third file" is still a total mystery to me :-)

With the latest set of cards, if the files are the same byte-for-byte, there will be no data on SORTOUT. If not, all the unmatched F1 and F2 will be on SORTOUT.

There does seem to be a mention of a third file, but nothing clear as to what should be on it. If it is the unpaired F1s, then yes, the INCLUDE/OMIT has to go back to OUTFIL and another OUTFIL would be needed for the required data, which would be 251,250,CH,NE,C' '
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2163
Location: @my desk

PostPosted: Fri Jun 21, 2013 3:54 pm    Post subject: Re: Reply to: Comparison of two files
Reply with quote

Bill Woodger wrote:
Hi Arun,

The "third file" is still a total mystery to me :-)
Hi Bill,

The one person who can uncover the mystery does nt seem to be interested in the discussion. icon_smile.gif
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Sat Jun 22, 2013 12:08 am    Post subject:
Reply with quote

Hi Bill,
I have worked with the below condition and I got the desired result of the Records in F1 and not in F2 are copied to F3

Code:
JOINKEYS FILE=F1,FIELDS=(1,250,CH,A)                         
JOINKEYS FILE=F2,FIELDS=(1,250,CH,A)                         
                                                             
JOIN UNPAIRED                                               
REFORMAT FIELDS=(F1:1,250,F2:1,250)                         
SORT FIELDS=COPY                                             
OMIT COND=((1,250,CH,EQ,251,250,CH),OR,(251,250,CH,NE,C' '))


The other question is how to put a condition when both files are equal to get a RC set to MAXCC=8

I tried this but its falls on the SUPERC
Code:
//SUPERC  EXEC PGM=ISRSUPC,                   
//             PARM=(DELTAL,LINECMP,           
//             'LONGLN',                       
//             '')                             
//NEWDD  DD DSN=File1,
//          DISP=SHR                           
//OLDDD  DD DSN=File2,
//          DISP=SHR                           
//OUTDD  DD SYSOUT=(*)                         
//SYSIN  DD *                                 
  CMPCOLM 1:250                               
/*                                 
// IF SUPERC.RC = 0 THEN                                       
//*****************************   
//* SETTING RETURN CODE TO 8                                   
//*****************************   
//STEPIF  EXEC PGM=IDCAMS                                     
//SYSIN  DD *                                                 
  SET MAXCC=8                                                 
/*                                                             
//SYSPRINT DD SYSOUT=*                                         
//  ENDIF                                                     
//*                                         
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Sat Jun 22, 2013 12:29 am    Post subject: Reply to: Comparison of two files
Reply with quote

SyncSort can give you 0, 4 or 16 for an "empty" file, either for SORTOUT (NULLOUT) or OUTFIL (NULLOFL).

If you have an up-to-date SyncSort, information which you still haven't supplied to us, you can set the same range for a file which contains data.

If you have the up-to-date SyncSort, you will be able to do it in one step - but your non-Zero RC can only be either 4 or 16. If you are "desperate" for an 8, you could do the IDCAMS on the 4 from the SORT, which then sets 8.

Without the up-to-date version, I think you'd have a problem where there are unmatched records on F2 and no records on F1. Your byte-for-byte match should obviously fail, but you'd get the NULLOFL for the unmatched F1 output, which would give the the "wrong" RC for the step.

Yes, if you're going to ignore questions and suggestions, you can make your topic wander off into other avenues: just bear in mind that people will be less likely to reply given the way things have gone so far on this one.
Back to top
View user's profile Send private message
tecnokrat
Warnings : 1

Active User


Joined: 22 May 2009
Posts: 158
Location: Bangalore

PostPosted: Sat Jun 22, 2013 6:23 am    Post subject:
Reply with quote

bill my syncsort is
Code:
SYNCSORT FOR Z/OS  1.4.0.1R
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Sat Jun 22, 2013 7:07 am    Post subject: Reply to: Comparison of two files
Reply with quote

OK, you may be in luck. Check your documentation for NOTMTOFL.

This will allow you to set the RC (not to 8) if the specified OUTFIL contains data.

You have your byte-for-byte match. To get a full match, you have no unpaired records.

If you have differences, you have:

Differences are "new" records, only on F1. These interest you.

Difference are "old" records, only on F2. These (apparently) don't interest you.

Changed records, where there will be an F1 and an F2. You are only interested in the F1s.

The INCLUDE/OMIT you have already been shown will get you an empty output if the two files match completely, byte-for-byte, record-for-record.

You have two remaining situations. Records solely unmatched from F2 (so F1 output is empty). And unmatched records from F1 which you want to process (whether or not there are F2 records).

The F1 records are where 251,250,CH,EQ,C' '

To do this all in one step, you have three "states" I think you need to cover, and you have three different RC values (0, 4 or 16) with the added "complication" that 16 is produced when there is a problem with the control cards.

Personally, I'd probably go for 0 telling me there are unmatched F1 records for processing and 04 telling me there is not an output file for processing, but which a further step would have to be used to distinguish between the "matched entirely" state, and the "unmatched, but only unmatched on F2" - if you need to differentiate.

If you really have to set 8, use the IDCAMS to set to 8 when spotting a 4.

You now have all the bits you need to put the thing together. We're not aware of exactly the combinations you need, but you are, and we've covered them what you may need, and more. There are variations in how to do it, what codes to set. You have the option to certainly identify an empty OUTFIL with non-zero RC, and probably a data-containing OUTFIL with non-zero RC.

You should be able to sit back, go through everything, and work out what it is that you exactly need.

If you can't get it to work, show what you've tried and include and exact description of what you want, covering all situations. Someone may then put together the bits from what you've already been shown.

If you do get it by yourself, post it here, as it may well help someone else in the future.

You've got everything you need. You can do everything in SORT. You can know from one step whether you have a file which needs processing. For convenience (due to the prior use of RC16) you can differentiate the two no-output-to-process situations (if you need to) in a separate step, and probably by reading/attempting to read only one record (STOPAFT).

We've spent time on it, now it's your turn. Don't come back in five minutes just wanting it off pat, please.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us