View previous topic :: View next topic
|
Author |
Message |
hyuzen
New User
Joined: 10 Jul 2005 Posts: 58
|
|
|
|
Hi all,
Nonvsam Dataset A consist of 8 ch.s' records like
AAAAAAAA
AAAAAABB
AAAAAACC
...
Nonvsam Dataset B is FB and LRECL=80 and also includes same keys of Dataset A in the particular position but has more much records.
How can I get an output dataset C which has mutual/same records of Dataset A and Dataset B ?
Thanks in advance.
hyuzen |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Can input fileA have duplicates? Can input fileB have duplicates? Does input fileA have RECFM=FB and LRECL=8? Is the key for "duplicates" in positions 1-8 of both files? Do you want one record for each matching key, or all of the records for each matching key? Please show an example of the input records in FileA and FileB and the records you want in the output file. If FileA can have duplicates or FileB can have duplicates, show that in your example. |
|
Back to top |
|
|
hyuzen
New User
Joined: 10 Jul 2005 Posts: 58
|
|
|
|
Thank you Frank for your quick response.
File A is RECFM=FB and LRECL=8. Pls assume all records like below
AAAAAAAA
AAAAAABB
AAAAAACC
...
AAXXAAYY
AAXXAAZZ
...
File B is RECFM=FB and LRECL=80. Pls assume all record like below
123456 SDKILO23 PARIS AAAAAAAA 0000 45
123477 SKLORI34 ANKARA AAXXAAYY 0008 56
...
In both file some records/keys like AAAAAAAA and AAXXAAYY are same and all the positions of the keys in file B are same and start at 60th position.
And output file must consist of mutual record/keys in both files and it can be like file B then I can sort/select keys.
How can I do that ?
Thank you very much.
hyuzen. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
So if I understand your example correctly, fileA does NOT have any duplicates, that is, you wouldn't find two records with the AAAAAAAA key in fileA - right? Likewise, fileB does NOT have any duplicates.
Quote: |
And output file must consist of mutual record/keys in both files and it can be like file B then I can sort/select keys. |
It isn't clear to me what you mean by this. Please show an example of the input file records with matching keys and non-matching keys and show what the output records should look like. I don't want to guess. |
|
Back to top |
|
|
hyuzen
New User
Joined: 10 Jul 2005 Posts: 58
|
|
|
|
Dear Frank,
Sorry for my misinterpreting for 'duplicate' and thank you very much for your interest.
I called records what FileA have in. FileA's LRECL is only 8 ch. length.
I also called them keys according to File B b/c File B whose LRECL is 80, have some keys like AAAAAABB are exactly same in the File A and has much more records them fileA.
I'm looking for any mutual records in fileA and fileB. If there is any in the fileB then I need that record in the fileB as one of the output record.
Macthing keys (in the fileA):
AAAAAAAA
AAAAAABB
....
Scanned file (fileB):
123456 SDKILO23 PARIS AAAAAAAA 0000 45
123477 SKLORI34 ANKARA AAXXAAYY 0008 56
...
Output file (fileC):
123456 SDKILO23 PARIS AAAAAAAA 0000 45
...
What I need to find in fileB:
AAAAAAAA is what fileA has as a record and fileB has as a key.
Please assume mutual keys in the fileB like AAAAAAAA are in the same position.
Hope I become more clear now. Thank you very much once again.
hyuzen |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I think I understand what you want, and if so, this DFSORT/ICETOOL job will do it. I'm assuming the key in input file2 is in positions 24-31.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/8)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=... input file2 (FB/80)
// DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
* IN1->T1: Reformat IN1 records to put key in same place
* as in IN2 records and to pad out the records to the same
* length as the IN2 records.
COPY FROM(IN1) TO(T1) USING(CTL1)
* CON->OUT: Get the first record (the one from input file2)
* for each file1/file2 match.
SELECT FROM(CON) TO(OUT) ON(24,8,CH) FIRSTDUP
/*
//CTL1CNTL DD *
OUTREC FIELDS=(24:1,8,80:X)
/*
|
|
|
Back to top |
|
|
hyuzen
New User
Joined: 10 Jul 2005 Posts: 58
|
|
|
|
Dear Frank,
That is really kind of you.
This is the first time I will use ICETOOL and will let you know for the result. And thank you VERY much.
Bye,
hyuzen |
|
Back to top |
|
|
hyuzen
New User
Joined: 10 Jul 2005 Posts: 58
|
|
|
|
Dear Frank,
So sorry for my late response b/c Icetool is so new for me. It worked perfectly. Thank you very much.
In the same sample, if fileB is a KSDS file, what changes I have to do ?
Thanks in advance,
hyuzen |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Well, a VSAM file cannot be used in a concatenation, so you'd have to COPY the VSAM file to the T1 file rather than using it directly. Something like this (you may have to change the 80:X to the length of your VSAM input file):
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/8)
//IN2 DD DSN=... VSAM file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
* IN2->T1: Copy VSAM records.
COPY FROM(IN2) TO(T1) VSAMTYPE(F)
* IN1->T1: Reformat IN1 records to put key in same place
* as in IN2 records and to pad out the records to the same
* length as the IN2 records.
COPY FROM(IN1) TO(T1) USING(CTL1)
* T1->OUT: Get the first record (the one from input file2)
* for each file1/file2 match.
SELECT FROM(T1) TO(OUT) ON(24,8,CH) FIRSTDUP
/*
//CTL1CNTL DD *
OUTREC FIELDS=(24:1,8,80:X)
/*
|
|
|
Back to top |
|
|
hyuzen
New User
Joined: 10 Jul 2005 Posts: 58
|
|
|
|
Dear Frank,
Thank you very much. That's very kind of you.
Regards,
hyuzen |
|
Back to top |
|
|
CHOVVA
New User
Joined: 13 May 2005 Posts: 2
|
|
|
|
It was really useful.
Jiju |
|
Back to top |
|
|
|