JCL compare FB & VB file with key pointingto unused positio



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

JCL compare FB & VB file with key pointingto unused positio

Postby paramaha » Thu May 23, 2013 8:39 pm

Hi,

Can anyone help me with JCL compare solution to compare a file like below.

File1 - VB file with max length of 27994 and key present in 101th position. There are records in this file where it don't have any data in 101th position because of VB file
File 2 - FB file with max length of 10 bytes and key starting in 1st position.

Now i wish to compare file1 and file2 and output needs to be produced with matching record

Thanks in advance for your help

Regards
Hari
paramaha
 
Posts: 7
Joined: Thu May 23, 2013 8:32 pm
Has thanked: 2 times
Been thanked: 0 time

Re: JCL compare FB & VB file with key pointingto unused pos

Postby Akatsukami » Thu May 23, 2013 8:51 pm

JCL cannot do this; what tool do you wish to use?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: JCL compare FB & VB file with key pointingto unused pos

Postby BillyBoyo » Fri May 24, 2013 4:46 am

Since the output requires matching records, it will be possible with SORT. Which one do you have? DFSORT or SyncSort?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: JCL compare FB & VB file with key pointingto unused pos

Postby paramaha » Fri May 24, 2013 9:56 am

We have dfsort in our system billy
paramaha
 
Posts: 7
Joined: Thu May 23, 2013 8:32 pm
Has thanked: 2 times
Been thanked: 0 time

Re: JCL compare FB & VB file with key pointingto unused pos

Postby BillyBoyo » Fri May 24, 2013 12:43 pm

OK, you need a simple JOINKEYS. Since you don't need the "short" records at all, you can ignore them in a JNFnCNTL dataset:

   JOINKEYS FILE=F1,FIELDS=(101,10,A)
   JOINKEYS FILE=F2,FIELDS=(001,10,A)
   OPTION COPY
   REFORMAT FIELDS=(F1:1,4,5)
                                           
 //JNF1CNTL DD *
   OMIT COND=(1,2,BI,LT,110)
 //SORTJNF1 DD DSN=your variable-length records
 //SORTJNF2 DD DSN=your key extract records


Is either input file in sorted order on the key?

These users thanked the author BillyBoyo for the post:
paramaha (Fri May 24, 2013 5:14 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: JCL compare FB & VB file with key pointingto unused pos

Postby paramaha » Fri May 24, 2013 3:03 pm

Billy, it worked perfectly as expected.. I just modified the key position alone..Can you explain the meaning of reformat parameters plz..
paramaha
 
Posts: 7
Joined: Thu May 23, 2013 8:32 pm
Has thanked: 2 times
Been thanked: 0 time

Re: JCL compare FB & VB file with key pointingto unused pos

Postby BillyBoyo » Fri May 24, 2013 4:28 pm

Yes, as well as my explanation, look in the manual, and experiment.

This REFORMAT is very simple. As there is no JOIN statement, you only have "matches" arriving in the "main task". Your File 2 is only a key. Therefore, we only need the data from File 1 in the REFORMAT. File 1 is of variable-length records, and you want variable-length output, so the REFORMAT needs to be variable-length. This is done with the F1:1,4 - it copies the RDW from the File 1, and after this DFSORT will ensure that it contains the length of the data in the first two bytes. You have variable-length data and the "5" on its own says "copy the data on F1 from position 5 to the end of the current record".

As there is no other processing in the main task (except the OPTION COPY), then the REFORMAT record, with the correct record-length, will simply be written to SORTOUT.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: JCL compare FB & VB file with key pointingto unused pos

Postby paramaha » Fri May 24, 2013 5:14 pm

thanks Billy, for your timely help and guidance.
paramaha
 
Posts: 7
Joined: Thu May 23, 2013 8:32 pm
Has thanked: 2 times
Been thanked: 0 time

Re: JCL compare FB & VB file with key pointingto unused pos

Postby dick scherrer » Sat May 25, 2013 8:10 am

Hello,

I must be having a brain fade again. If one record has the "key value" and the other does not . . . . ?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: JCL compare FB & VB file with key pointingto unused pos

Postby BillyBoyo » Sat May 25, 2013 11:50 am

...then they can never match, and since only matched records are wanted...

If these are different "record-types", it would be better to do the INCLUDE/OMIT by record-type. If there is a "third-or-moreth" record-type, you could get a "false hit", if the data happened to be that way.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post