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

Need help in Easytrieve program


IBM Mainframe Forums -> CA Products
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
ritnihi

New User


Joined: 30 Jul 2010
Posts: 7
Location: Bangalore

PostPosted: Fri Jul 30, 2010 11:34 am
Reply with quote

Hi,

I am having 2 files (File-1 and File-2). File-2 is having header part on the top (system date and other info). I have to extract the header part and match both the files on customer-id. The File-1 and File-2 is coming in sorted order.

I have tried 1 logic before procedure division:

SORT FILE-2 to S-FILE-2 +
USING (FILE-2 key) +
BEFORE HDR-EXTRACT para

But as my File-2 is coming in sorted order I can't use this logic.

Please help me if you have any solution for this. icon_smile.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jul 30, 2010 11:41 am
Reply with quote

And since how long has Easytrieve been Mainframe COBOL.
Topic moved to correct forum.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jul 30, 2010 11:58 am
Reply with quote

The header will not match, so what is the problem?
Back to top
View user's profile Send private message
ritnihi

New User


Joined: 30 Jul 2010
Posts: 7
Location: Bangalore

PostPosted: Fri Jul 30, 2010 4:55 pm
Reply with quote

Hi,

I have to extract the header (1st record in file-2) and match other records in both the files......but the logic i m not getting how to do this??

If u have plz share it
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jul 31, 2010 2:52 am
Reply with quote

Hello and welcome to the forum,

Suggest you show the code you are using to compare the 2 files.
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Sat Jul 31, 2010 10:32 am
Reply with quote

Try this :

Code:

JOB INPUT(FILE-1 KEY(F1KEY) FILE-2 KEY(F2KEY))
IF MATCHED
   * your matched processing goes here
END-IF
IF NOT MATCHED
   IF FILE-2 AND FILE-2:RECORD-COUNT = 1
   * your header record processing goes here
   END-IF
END-IF
Back to top
View user's profile Send private message
ritnihi

New User


Joined: 30 Jul 2010
Posts: 7
Location: Bangalore

PostPosted: Mon Aug 02, 2010 3:25 pm
Reply with quote

I have got the solution. I kept 2 JOB INPUT syntax inside the Procedure division.
1) First JOB INPUT will read the FILE-2 and extract the header
2) Second JOB syntax will match FILE-1 and FILE-2 on base of key. Now file-2 is having only detail records without header.


Hi Peter,
Thank you for ur solution. But i was late to read your reply. Sorry i have already done my coding and testing. Ya but I will try ur solution once.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top