easytrieve matching prog

Ask/Clarify the questions on EASYTRIEVE

Moderators: DikDude, Moderator Group

Post Reply
kitty_83
Member
Posts: 1
Joined: Fri Jun 05, 2009 6:37 pm

easytrieve matching prog

Post by kitty_83 » Fri Jun 05, 2009 6:50 pm

Hi,

I have 3 files say File a, file b, file c. The requirement is to match file a and file b on 4 fields say p,q,r,s. The matched records should be matched with file c on p, q. here if the rec is not found... it should be written to error file. I implemented the below code after getting matched recs from file a and file b

DO WHILE NOT EOF file c
IF field p frm matched rec EQ field p on file c AND +
field q frm matched rec EQ field q on file c
write outfile
ELSE
write error file
END-IF
GET filec
END-DO

but the problem is with ELSE loop, records present only in FILE C are also written to error file. But i want only matched recs which donot have a corresponding record in file c to be written to error file. How do i achieve it??

User avatar
Natarajan
Moderator
Posts: 537
Joined: Fri Oct 10, 2008 12:57 pm
Location: chennai
Contact:

Post by Natarajan » Thu Jun 18, 2009 3:46 pm

Hi Kitty,

If file sorted on keys P and q fields, you can do this.

Let us assume, your file sorted ascending on P and q fields.
then you can implement below logic.

if field p frm matched rec < file p from on file c
GO out of do while loop.
end-if
Natarajan
Chennai

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others