Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: logic for select mathing records of 3 files sent to 4th file
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    Post subject: Re: logic for select mathing records of 3 files sent to 4th
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: 464

PostPosted: Thu Sep 01, 2005 12:33 pm    Post subject: Re: logic for select mathing records of 3 files sent to 4th
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    Post subject: Re: logic for select mathing records of 3 files sent to 4th
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: 464

PostPosted: Thu Sep 01, 2005 1:23 pm    Post subject: Re: logic for select mathing records of 3 files sent to 4th
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    Post subject: regarding matching logic
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    Post subject: Re: logic for select mathing records of 3 files sent to 4th
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: 464

PostPosted: Thu Sep 01, 2005 2:30 pm    Post subject: Re: logic for select mathing records of 3 files sent to 4th
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    Post subject: Re: logic for select mathing records of 3 files sent to 4th
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts splitting a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us