View previous topic :: View next topic
|
Author |
Message |
ravikumarreddy Warnings : 1 New User
Joined: 29 Jul 2005 Posts: 23
|
|
|
|
hi.
i need logic for following..
i am having 3 differnt files with some 10 records,inthese there are 5 records are comman.so my requirement is to sent all mathing recs in file4
eg...
file1. file2 file3 -- output file 4;
aaa bbb fff bbb
ccc jjjj ggg ddd
eee ddd bbb ....
bbb ooo lll
ddd ppp ddd ....
.... ..... ....
.... ..... ....
regards,
ravi |
|
Back to top |
|
|
ravikumarreddy Warnings : 1 New User
Joined: 29 Jul 2005 Posts: 23
|
|
|
|
just consider records in vertical manner for all 4 files
regards
ravi |
|
Back to top |
|
|
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 463
|
|
|
|
Hi,
If I am recalling your query correctly you want the output file whcih contains the records which are in all 3 files.
Then the Logic is simple
1)fetch the record in variable.
2) Search the same in 2nd file
3) If present
4) Search the same in 3 rd file
5) If Present
6) write in File 4
7) else Repeat Step 1
endif
8) else repeat Step 1
endif
9)Exit
Regards
Rupesh |
|
Back to top |
|
|
ravikumarreddy Warnings : 1 New User
Joined: 29 Jul 2005 Posts: 23
|
|
|
|
hi rupesh
here u consider i am having some 1lac records in each file so as per u r answer it may take lot of I/O operations like comparing first recordof file with each and every record of file2 then again repeat this for 2nd record of file1 with all records with file 2 na..
plz clarify on this..
regards,
ravi |
|
Back to top |
|
|
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 463
|
|
|
|
Hi Ravi,
Try the following code to extract the the records which are in all 3 files
Code: |
Job Card
//STEP0001 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUTX) ON(1,04,CH) FIRSTDUP
/*
//IN DD DSN=FILE1,DISP=SHR
// DD DSN=FILE2,DISP=SHR
//OUTX DD DSN=&&Tempfile,
// DISP=(NEW,PASS,DELETE),
// DCB=(RECFM=FB,LRECL=80),
// UNIT=WORK,SPACE=(TRK,(02,01),RLSE)
//SYSPRINT DD SYSOUT=*
//*
//STEP0002 EXEC PGM=ICETOOL
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUTX) ON(1,04,CH) FIRSTDUP
/*
//IN DD DSN=&&Tempfile,DISP=(OLD,DELETE,DELETE)
// DD DSN=FILE3,DISP=SHR
//OUTX DD DSN=FILE4, Other parameters
//SYSPRINT DD SYSOUT=* |
Hope it will solve your query.
Regards
Rupesh |
|
Back to top |
|
|
prasanth_thavva
New User
Joined: 28 Jul 2005 Posts: 86 Location: Chennai
|
|
|
|
plz explain me above logic how it works
1>WHAT FOR TOOLMSG DD SYSOUT=*
1>WHAT FOR DFSMSG DD --
3> THE FIRST AND SECOND FILES ARE MATCHED ARE SENT TO STEP2 THRU TEMPORARY DATA SET AFTER EXECUTION OF STEP2 IT IS KEPT IN PERMANANT DATA SET
IS IT CORRECT ..
1> what do u mean FIRSTDUP |
|
Back to top |
|
|
ravikumarreddy Warnings : 1 New User
Joined: 29 Jul 2005 Posts: 23
|
|
|
|
hi rupesh,
nice solution...
thanks
ravi |
|
Back to top |
|
|
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 463
|
|
|
|
HI Prasanth,
Quote: |
1>WHAT FOR TOOLMSG DD SYSOUT=*
1>WHAT FOR DFSMSG DD -- |
Please refer the ICTOOL manual.
Quote: |
3> THE FIRST AND SECOND FILES ARE MATCHED ARE SENT TO STEP2 THRU TEMPORARY DATA SET AFTER EXECUTION OF STEP2 IT IS KEPT IN PERMANANT DATA SET
IS IT CORRECT .. |
No Your are wrong. Whenever we define any temp file it will get deleted after execution of JOb. In step 2 DISP=(OLD,Delele,Delete) It means in any case after completion of job the dataset get deleted.
Quote: |
1> what do u mean FIRSTDUP |
FIRSTDUP extract only first duplicate from File.
Do u know when we write queries to anyone in CAPS and in BOLD?
Regards
Rupesh |
|
Back to top |
|
|
santoshmk2005
New User
Joined: 12 Sep 2005 Posts: 1
|
|
|
|
Hi rupesh,
If first file consists of repeating records like AAA twice in the first file and one in third file .that case also the record would be picked for fourth file that does not conform our requirements.i think before that we have to do sorting to remove duplicate records..
what do u say.......
if any suggestions for correction welcome.. |
|
Back to top |
|
|
|