IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

logic for select mathing records of 3 files sent to 4th file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ravikumarreddy
Warnings : 1

New User


Joined: 29 Jul 2005
Posts: 23

PostPosted: Thu Sep 01, 2005 11:14 am
Reply with quote

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
View user's profile Send private message
ravikumarreddy
Warnings : 1

New User


Joined: 29 Jul 2005
Posts: 23

PostPosted: Thu Sep 01, 2005 11:23 am
Reply with quote

just consider records in vertical manner for all 4 files


regards
ravi
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Thu Sep 01, 2005 12:33 pm
Reply with quote

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
View user's profile Send private message
ravikumarreddy
Warnings : 1

New User


Joined: 29 Jul 2005
Posts: 23

PostPosted: Thu Sep 01, 2005 12:55 pm
Reply with quote

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
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Thu Sep 01, 2005 1:23 pm
Reply with quote

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
View user's profile Send private message
prasanth_thavva

New User


Joined: 28 Jul 2005
Posts: 86
Location: Chennai

PostPosted: Thu Sep 01, 2005 2:04 pm
Reply with quote

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
View user's profile Send private message
ravikumarreddy
Warnings : 1

New User


Joined: 29 Jul 2005
Posts: 23

PostPosted: Thu Sep 01, 2005 2:07 pm
Reply with quote

hi rupesh,

nice solution...

thanks

ravi
Back to top
View user's profile Send private message
Rupesh.Kothari

Member of the Month


Joined: 27 Apr 2005
Posts: 463

PostPosted: Thu Sep 01, 2005 2:30 pm
Reply with quote

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
View user's profile Send private message
santoshmk2005

New User


Joined: 12 Sep 2005
Posts: 1

PostPosted: Mon Sep 12, 2005 11:29 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top