Compare 2 Files



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Compare 2 Files

Postby sukumarit » Thu Mar 27, 2008 4:23 pm

Hey i want to compare two files say A & B . If there was a match found between the files then i need to update the file B with the details of File A.
Input :
A - sequential file
111 AAAA Mumbai
222 BBBB Chennai
333 CCCC Delhi

B VSAM File
222 BBBB
444 DDDD

Output File
B VSAM File
222 BBBB Chennai
444 DDDD
sukumarit
 
Posts: 1
Joined: Thu Mar 27, 2008 11:32 am
Has thanked: 0 time
Been thanked: 0 time

Re: Compare 2 Files

Postby arunprasad.k » Thu Mar 27, 2008 7:25 pm

ESDS or KSDS??

If I were you I would go with a simple COBOL program.

Something like:
OPEN INPUT FILE1
     I-O   FILE2
PERFORM UNTIL EOF-FILE1
      READ FILE1
               AT END SET EOF-FILE1 TO TRUE
      END-READ.
      IF NOT EOF-FILE1
          MOVE KEY-FILE1   TO  KEY-FILE2
          READ FILE2
                   NOT INVALID KEY     
                          MOVE FIELD-TO-UPDATE TO FILE2-UPDATED
                          WRITE FILE2
          END-READ
       END-IF
END-PERFORM.                   


Refer manuals and try coding this logic. Post if you face problems.

Arun.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Compare 2 Files

Postby arunprasad.k » Thu Mar 27, 2008 7:29 pm

My logic will work only for KSDS. Use "ACCESS IS RANDOM" in FILE-CONTROL.

If your file is ESDS then we have to go for sequential search logic.

Arun.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post