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
 

 

comparing two different length files thru JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: comparing two different length files thru JCL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jun 13, 2013 11:05 pm    Post subject: Reply to: comparing two different length files thru JCL
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: 1712
Location: UK

PostPosted: Fri Jun 14, 2013 1:04 am    Post subject:
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: 2158
Location: @my desk

PostPosted: Fri Jun 14, 2013 5:35 am    Post subject: Re: comparing two different length files thru JCL
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

Active Member


Joined: 08 May 2006
Posts: 988
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Jun 14, 2013 1:38 pm    Post subject:
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    Post subject: Reply to: comparing two different length files thru JCL
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    Post subject: Reply to: comparing two different length files thru JCL
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Jun 14, 2013 9:51 pm    Post subject: Reply to: comparing two different length files thru JCL
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    Post subject: Reply to: comparing two different length files thru JCL
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: 1712
Location: UK

PostPosted: Fri Jun 14, 2013 11:18 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Jun 15, 2013 2:20 am    Post subject: Reply to: comparing two different length files thru JCL
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: 2158
Location: @my desk

PostPosted: Sat Jun 15, 2013 5:14 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

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 SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am


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