conditional look up the key of a file into another



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

conditional look up the key of a file into another

Postby manu4216 » Thu Jan 15, 2015 12:58 pm

Hi.

I'm trying to do this by JCL rather than a program. Do you think is possible? I tryied a sort with joinkeys but not sure if I can include a condition between the 2 files.

Input:
File1: Key date1
File2: Key date2 date3
I need to find the records of File2 with a corresponding record in File1 and the condition: date2 < date1 < date3

Any answer would be appreciated.
manu4216
 
Posts: 4
Joined: Thu Jan 15, 2015 12:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: conditional look up the key of a file into another

Postby NicC » Thu Jan 15, 2015 5:20 pm

I'm trying to do this by JCL rather than a program. Do you think is possible?


No - you still need a program - even if it is DFSort. DFSort is not JCL. Nor are the control cards used by DFSort - they are DFSort control cards.

Having gotten the terminology lesson out of the way I will leave it to the sort gurus to set you on the right path - although it may help them if you post the control records that you did try.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: conditional look up the key of a file into another

Postby BillyBoyo » Thu Jan 15, 2015 6:04 pm

Yes, it can be done quite simply. As NicC has said, we need to see what you have tried, to know how best to help.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: conditional look up the key of a file into another

Postby manu4216 » Thu Jan 15, 2015 7:02 pm

I used joinkeys to match the records that are in both files and generate File3. But I don't know where and how to include a condition.

joinkeys F1=File1,fields=(1,14,A)
joinkeys F2=File2,fields=(1,14,A)
Join unpaired,F1,F2
Reformat fields=(?,F1:1,100,F2:1,100)
Option copy
Outfil fnames=File3,include=(1,1,CH,EQ,C'B'),BUILD=(1:2,100)


Code'd
manu4216
 
Posts: 4
Joined: Thu Jan 15, 2015 12:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: conditional look up the key of a file into another

Postby BillyBoyo » Thu Jan 15, 2015 8:19 pm

It is always best to highlight and copy in your emulator and then paste here, within the Code tags. Re-typing can introduce errors.

If you only want matches, remove the JOIN statement, as matched-records only is the default. You then don't need the matched-marker (the ?). And then you change your INCLUDE= on OUTFIL to do the selection.

Is your data originally already in sequence? You are sorting both the files. If you don't need this you can specify SORTED,NOSEQCK on the JOINKEYS for any data which is already in sequence.

In a JNFnCNTL file, you can reduce the amount of data which is to be processed by doing an INCLUDE for DATE2 less than DATE3.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: conditional look up the key of a file into another

Postby manu4216 » Fri Jan 16, 2015 12:01 pm

Ok thanks for the match part tips.

Now the second part: how do I add the condition between the dates?
manu4216
 
Posts: 4
Joined: Thu Jan 15, 2015 12:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: conditional look up the key of a file into another

Postby BillyBoyo » Fri Jan 16, 2015 1:22 pm

With INCLUDE=, as I wrote:

 OUTFIL INCLUDE=(date2,LT,date1,AND,date1,LT,date3)


Where daten in the above is the start,length,CH of each of your dates on the REFORMAT record. Even better, use symbols/SYMANES and you can call them date1, date2, date3, or something even more meaningful.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: conditional look up the key of a file into another

Postby manu4216 » Sat Jan 17, 2015 2:23 pm

Ok I think I understand. So you add the condition on the REFORMAT record, which contains all the data: key, date1, date2, date3.

Too bad I already did it in Cobol. I only used SORT to match the 2 files by the key, but without condition.
manu4216
 
Posts: 4
Joined: Thu Jan 15, 2015 12:36 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post