IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

comparing two different length files thru JCL


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
harish5002

New User


Joined: 21 Jul 2010
Posts: 23
Location: chennai

PostPosted: Thu Jun 13, 2013 10:57 pm
Reply with quote

I have two files file1 with 424 and file2 with 714. sort key is starts from 14 with length 20. I want to generate four reports out of these two files.
1.The first report should have matching records from first file.
2.The second report should have matching records from second file.
3.The third report should contain records that exist only in first file and not in second file.
4.The fourth report should contain records that exist only in the second file and not in the first file.

Thanks in advance.

I have searched in the web only three reports logic is present but my requirement is to 4 reports. The main thing i am not sure how to compare different length files.

Thanks a lot in advance. Please help me.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Jun 13, 2013 11:05 pm
Reply with quote

If you can find examples of three reports, surely adding another should not be difficult?

Matching records with different lengths is easy. If the "excess bytes" on the longer record are not blanks, then the files do not match. That's what we can say about it.

Now, in reality, you have to find out, and mention here, how the comparison is to be done. What is there that needs to be compared to show "match" or "not". It can be as little as the key, or as much as every byte on the short record having to match a particular byte, somewhere, on the long record.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Jun 14, 2013 1:04 am
Reply with quote

424 whats and 714 whats? LRECL, records, tracks, cylinders, what?
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Fri Jun 14, 2013 5:35 am
Reply with quote

harish5002 wrote:
I have two files file1 with 424 and file2 with 714. sort key is starts from 14 with length 20.
Does the sort key start at pos-14 and have length=20 in both the files? If so, are the input files already in sorted order of the key?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Jun 14, 2013 1:38 pm
Reply with quote

For your files of matched records you just need to replicate the set of JOINKEYS controls for the match and adjust

e.g.
Code:

  OUTFIL FNAMES=MATCH1,INCLUDE=(1139,1,CH,EQ,C'B'),   
    BUILD=(1,424)
       
  OUTFIL FNAMES=MATCH2,INCLUDE=(1139,1,CH,EQ,C'B'),   
    BUILD=(425,714)             
 

Garry.
Back to top
View user's profile Send private message
harish5002

New User


Joined: 21 Jul 2010
Posts: 23
Location: chennai

PostPosted: Fri Jun 14, 2013 9:16 pm
Reply with quote

Hi All,
Thanks for all your replies.

Hi Nic,

The file1 is with record length 424 and file2 is with record length 724.

I am poor in DFSORT or ICETOOL. Please help me with the JCL for 4 reports.

I Tried with below jcl for 3 reprts but abending with return code 20:

000006 //PSTEP010 EXEC PGM=ICETOOL
000007 //SORTLIB DD DSN=SYS1.SORTLIB,
000008 // DISP=SHR
000009 //SYSOUT DD SYSOUT=*
000010 //SYSDUMP DD SYSOUT=*
000011 //SORTLIST DD SYSOUT=*
000012 //SYSPRINT DD SYSOUT=*
000013 //IN1 DD DSN = File1,
000014 // DISP=SHR
000015 //IN2 DD DSN= File2,
000016 // DISP=SHR
000017 //T1 DD DSN=&T1,SPACE=(CYL,(5,5),RLSE),DISP=(,PASS)
000018 //T2 DD DSN=&T2,SPACE=(CYL,(5,5),RLSE),DISP=(,PASS)
000019 //INT DD DSN=*.T1,DISP=(OLD,PASS),VOL=REF=*.T1
000020 // DD DSN=*.T2,DISP=(OLD,PASS),VOL=REF=*.T2
000021 //MATCH DD DSN= Match File
000022 // DISP=(NEW,CATLG,DELETE),
000023 // UNIT=STOR,
000024 // SPACE=(CYL,(30,100),RLSE)
000025 //F1ONLY DD DSN=UNMATCH.F1ONLY,
000026 // DISP=(NEW,CATLG,DELETE),
000027 // UNIT=STOR,
000028 // SPACE=(CYL,(30,100),RLSE)
000029 //F2ONLY DD DSN=UNMATCH.F2ONLY,
000030 // DISP=(NEW,CATLG,DELETE),
000031 // UNIT=STOR,
000032 // SPACE=(CYL,(30,100),RLSE)
000033 //TOOLIN DD *
000034 SORT FROM(IN1) USING(CTL1)
000035 SORT FROM(IN2) USING(CTL2)
000036 SORT FROM(INT) USING(CTL3)
000037 //CTL1CNTL DD *
000038 SORT FIELDS=(14,20,CH,A)
000039 OUTFIL FNAMES=T1,OUTREC=(1,424,C'1')
000040 //CTL2CNTL DD *
000041 SORT FIELDS=(14,20,CH,A)
000042 OUTFIL FNAMES=T2,OUTREC=(1,714,C'2')
000043 //CTL3CNTL DD *
000044 SORT FIELDS=(14,20,CH,A)
000045 SUM FIELDS=(425,1,ZD)
000046 OUTFIL FNAMES=MATCH,INCLUDE=(425,1,ZD,EQ,3),OUTREC=(1,424)
000047 OUTFIL FNAMES=F1ONLY,INCLUDE=(425,1,CH,EQ,C'1'),OUTREC=(1,424)
000048 OUTFIL FNAMES=F2ONLY,INCLUDE=(715,1,CH,EQ,C'2'),OUTREC=(1,714)
000049 /*
************************ Bottom of Data *******************


Abend:

STORCLAS (SCTSO) MGMTCLAS (MCTSO) DATACLAS ( )
VOL SER NOS= SS9TSB
IEF237I JES2 ALLOCATED TO TOOLIN
IEF237I JES2 ALLOCATED TO CTL1CNTL
IEF237I JES2 ALLOCATED TO CTL2CNTL
IEF237I JES2 ALLOCATED TO CTL3CNTL
IEF142I PSTEP010 - STEP WAS EXECUTED - COND CODE 0020


Thanks in advance. Please provide me the JCL with 4 reports (match from File1, Match from File2, Unmatch from file1 and unmatch from file2).

Thanks a lot for all your help and forum.
Back to top
View user's profile Send private message
harish5002

New User


Joined: 21 Jul 2010
Posts: 23
Location: chennai

PostPosted: Fri Jun 14, 2013 9:22 pm
Reply with quote

Hi Arun,

Yes, Both files are sorted. In both the files key starts from position 14 and length 20 (14,20). The file1 lrec is 424 and file2 lrec is 714.

Thanks a lot to all.

Please help me with JCL.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jun 14, 2013 9:51 pm
Reply with quote

You have not explained how you want to do the match.

Your JCL and Control Cards that you have shown are very far from anything you have described. You need to look up the messages to see what the obvious problem is, even though you need to start from scratch, most likely.

There are no reports in what you have shown. Explain, please, what you mean by reports.

Are you using DFSORT (ICE messages) or SyncSort (WER messages)?

You probably want to use JOINKEYS.

You need to be clear, in answering Arun's question, whether the data is already in key order, or whether you need to get it into key order for the comparison.
Back to top
View user's profile Send private message
harish5002

New User


Joined: 21 Jul 2010
Posts: 23
Location: chennai

PostPosted: Fri Jun 14, 2013 10:59 pm
Reply with quote

Hi,

Need to get it into key order for the comparison.

I have used ICETOOL (which i provided in previous post) but please provide the jcl using joinkeys.

File 1 - key pos 14, length 20, record length 424.
File 2 - key pos 14, length 20, record length 714.

output 1 - matched records from file1
output 2 - matched records from file2
output 3 - unmatched records of input file1
output 4 - unmatched records of input file2

We need to sort based on the key 14,20.

File1 will not have duplicates and file2 may have duplicates also.

Thanks in advance.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Jun 14, 2013 11:18 pm
Reply with quote

Please stop saying JCL when, in fact, you mean 'sort control cards/records'. Sort control cards are NOT JCL - they are sort control cards. You will not find them in the JCL manual.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jun 15, 2013 2:20 am
Reply with quote

Well, search for JOINKEYS here.

This is an example.

Only has two output files, but you should get the idea.

To determine where a record is present on the JOIN, a field which is know cannot possibly, ever, at all, be a chosen value (default is space) which you can specify on the FILL=

Have a look at this, and other examples, see what you can come up with, and let us know what you've tried if you encounter problems. The duplicates on File 2 should be your biggest problem, but since you've not said what output you want in the situation, that's the hints for now.
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Sat Jun 15, 2013 5:14 am
Reply with quote

Harish,

Also while posting error messages from an ICETOOL step, remember that the actual error messages that could hint what might have gone wrong would be present only in your TOOLMSG/DFSMSG outputs.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
Search our Forums:

Back to Top