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
 

 

Merging of two Files & identifying non duplicate record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
felixedwingeorge

New User


Joined: 18 Sep 2008
Posts: 2
Location: chennai

PostPosted: Fri Sep 19, 2008 11:22 am    Post subject: Merging of two Files & identifying non duplicate record
Reply with quote

hi,
I have two sequential files file1 and file2. I have to retrieve the records which are present in File1 but not in File2 & update File2. Layout of File1 & File2 is 950 & 650 respectively. The common field which uniquely identifies the records is STUD-ID-CODE field

In File1
this field is present from record 1-11 [STUD-ID-CODE PIC X(11)]

In File2
this field is present from record 3-13 [05+04+02]
05 STUD-KEY.
10 STUD-QUAL PIC X(02).
10 STUD-NAT-CD-ID.
15 STUD-ID-CODE.
20 STUD-9.
25 STUD-ZONE-CD PIC X(05).
25 STUD-TYPE-CD PIC X(04).
20 STUD-HOST-ZONE-CD PIC X(02).

how I can solve this ? Is it possible to sort both the files & merge them and take the non duplicate records from the merged file (through ICE TOOL Utility) and then update file2 (Using COBOL PGM).

But the problem in merging is the record positions (STUD-ID-CODE) of two files are not the same.
Back to top
View user's profile Send private message

karthikr44

Active User


Joined: 25 Aug 2007
Posts: 235
Location: Chennai

PostPosted: Fri Sep 19, 2008 12:17 pm    Post subject: Reply to: Merging of two Files & identifying non duplic
Reply with quote

HI,

Quote:

I have to retrieve the records which are present in File1 but not in File2 & update File2.


Update File2 means? U want the records from FILE1 to FILE2. If that means which field position from File1 u want in File2. Because files are of different length 950 & 650. Can u explain more...

Regards
R KARTHIK
Back to top
View user's profile Send private message
felixedwingeorge

New User


Joined: 18 Sep 2008
Posts: 2
Location: chennai

PostPosted: Fri Sep 19, 2008 5:30 pm    Post subject: Reply to: Merging of two Files & identifying non duplic
Reply with quote

Hi Karthik,
I want to add the records to file2. That is those records which is present in file1 but not in file2. eg: file1 contains A,B,C,D. File2 contains A,C.
Here the records b,d are not present in File2. So, I want to add these records in File2.

My Design:

1. Make the file2 to 950 Layout by adding a filename field of size 1 and rest add fillers.

2. Then call a cobol pgm which adds the filename as 'F' to all the records of file2.

3. Then using JCL to merge both the files and retrieve the nonduplicate rows and store it in merged-file.

4. Then using another cobol pgm which updates file2, with all the records in merged-file, whose filename field is not F. (If the 'Filename' field has the value 'F' then it denotes that particular record is from file2.) This helps us to add the records present only in File1 but not in File2.


Please tell me whether this design will work ? Can I get the feedbacks of this design ? or do you suggest any other technique ?
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Fri Sep 19, 2008 6:05 pm    Post subject:
Reply with quote

You don't need COBOL to do that. See the ICETOOL example below.

Code:

//S0001    EXEC PGM=ICETOOL                                   
//DFSMSG   DD SYSOUT=*                                       
//SYSPRINT DD SYSOUT=*                                       
//SYSOUT   DD SYSOUT=*                                       
//TOOLMSG  DD SYSOUT=*                                       
//STATA    DD *                                               
    1                                                         
    2                                                         
//STATB    DD *                                               
1 B                                                           
3 B                                                           
5 B                                                           
//T1       DD DISP=(MOD,PASS),DSN=&TEMP,SPACE=(TRK,(1,1))     
//DDOUT    DD SYSOUT=*                                       
//CTL1CNTL DD *                                               
  INREC BUILD=(1:5,1)                                         
//CTL2CNTL DD *                                               
//TOOLIN   DD   *                                             
  COPY FROM(STATB) TO(T1)                                     
  COPY FROM(STATA) TO(T1)    USING(CTL1)                     
  SELECT FROM(T1) TO(DDOUT) ON(1,1,CH) FIRST                 


This code is under the assumption that your infile1 has only key in it. If it is not the case, and you need to have a record with proper data from infile1 then you can change the CTL1CNTL accordingly.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Sep 19, 2008 10:03 pm    Post subject:
Reply with quote

felixedwingeorge,

You really don't need a cobol program. Show me a sample of your input data with key information and the contents that you want to update from file 1 on to file2. Will be there be duplicates in any of the files?
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm


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