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

Matching 2 files with Eztreive


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
manishmittal

New User


Joined: 25 Apr 2008
Posts: 49
Location: Gurgaon

PostPosted: Mon Feb 23, 2009 5:15 pm
Reply with quote

Hi All,

I have 2 files likes:
File1:
A 1 10
B 11 5
C 16 6

File2:
D 1 10
E 11 5
F 16 6

I want to match like if A=D and B=E the write these to an o/p file.
I have the logic in eztrieve but I'm failing in syntax. please Give me an e.g code for this.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Mon Feb 23, 2009 5:47 pm
Reply with quote

Please do not ask for code. This is a HELP forum, not a do it for me forum.

What syntax errors do you get, please post them so that people can see clearly the problem.

Also, consider doing a search on the DFSORT or JCL forum to see solutions from your SORT product.
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: Mon Feb 23, 2009 9:29 pm
Reply with quote

Hello,

Quote:
I have the logic in eztrieve but I'm failing in syntax.
If you don't post the code and the error(s), no one here can help. . .
Back to top
View user's profile Send private message
manishmittal

New User


Joined: 25 Apr 2008
Posts: 49
Location: Gurgaon

PostPosted: Tue Feb 24, 2009 10:34 am
Reply with quote

My apologies for this confusion.Please find the code below:
Code:
*---------------------------------------*         
*     FILE   DEFINE                     *         
*---------------------------------------*         
                                                   
 FILE  INPFILE1 VB(4096 0)                         
      IN-REC1                           1 4096  A 
       LOG-APPROVAL-CODE1          123    2  A 
       LOG-6-DIG-APRV-CODE1        964    6  A 
                                                   
 FILE  INPFILE2 VB(4096 0)                         
       IN-REC2                          1  4096 A 
       LOG-APPROVAL-CODE2          123    2  A 
       LOG-6-DIG-APRV-CODE2        964    6  A 
                                                   
 FILE  OUTFILE  VB(4096 0)                         
       OUT-REC                           1  4096 A
       LOG-APPROVAL-CODEO             1   2  A 
       LOG-6-DIG-APRV-CODEO           3   6  A 
*---------------------------------------*         
*     VARIABLE DEFINE                   *         
*---------------------------------------*               
 WS-CNT    W    8   N  VALUE 0                           
 WS-CNT1   W    8   N  VALUE 0                           
 LOG-APPROVAL-CODEO W 2 N VALUE 0                       
 LOG-6-DIG-APRV-CODEO W 6 N VALUE 0                   
*=======================================*               
*       START  OF  JOB                  *               
*=======================================*               
JOB INPUT (INPFILE1     +                               
           INPFILE2)                                                                                 
IF EOF INPFILE1                                         
   STOP                                                 
END-IF                                                   
 IF LOG-APPROVAL-CODE1 = LOG-APPROVAL-CODE2       
 AND  LOG-6-DIG-APRV-CODE1 = LOG-6-DIG-APRV-CODE2 
    LOG-APPROVAL-CODEO = LOG-APPROVAL-CODE2       
    LOG-6-DIG-APRV-CODEO = LOG-6-DIG-APRV-CODE2   
       PUT OUTFILE                                       
       WS-CNT = WS-CNT + 1                                           
 ELSE                                                                 
       WS-CNT1 = WS-CNT1 + 1                                         
 END-IF                                                               
FIN-PARA1. PROC                                                       
  DISPLAY '=========================================================='
  DISPLAY ' TOTAL RECORDS WRITTEN            : ' WS-CNT               
  DISPLAY ' NO OF INVALID RECORDS            : ' WS-CNT1             
  DISPLAY '=========================================================='
END-PROC
Back to top
View user's profile Send private message
manishmittal

New User


Joined: 25 Apr 2008
Posts: 49
Location: Gurgaon

PostPosted: Tue Feb 24, 2009 10:37 am
Reply with quote

I am using EZtrieve second time.Earlier i used for one input file but this time i have to match fields between 2 different files and i don't know how to use JOB for both.
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Feb 24, 2009 10:45 am
Reply with quote

Instead of
Code:
 IF LOG-APPROVAL-CODE1 = LOG-APPROVAL-CODE2
AND LOG-6-DIG-APRV-CODE1 = LOG-6-DIG-APRV-CODE2
 you can have a key do it
JOB INPUT ( FILEA KEY(A-KEY) FILEB KEY(B-KEY) )
IF MATCHED     
   OUT-REC = IN-REC2
   PUT OUTFILE
Back to top
View user's profile Send private message
manishmittal

New User


Joined: 25 Apr 2008
Posts: 49
Location: Gurgaon

PostPosted: Tue Feb 24, 2009 10:48 am
Reply with quote

Hi Anand,

Could you please elaborate it more as i am new to eztrieve and was thinking tht Key is used for VSAm files only.
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: Tue Feb 24, 2009 10:54 am
Reply with quote

Hello,

Quote:
and i don't know how to use JOB for both.
Suggest getting both processing working correctly. Then consideration might be given to combining them.

Would using 2 steps in the same job acomplish what you want?
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Tue Feb 24, 2009 10:54 am
Reply with quote

Hi Manish,
Yes we can have a key for match Eztrieve
Have anyone of these LOG-APPROVAL-CODE1 & 2
LOG-6-DIG-APRV-CODE1 & 2
as a key(Unique) on both the files and match it in. there is no need to check each field is getting matched instead you can give simply as IF Matched will do.

IF MATCHED
OUT-REC = IN-REC2
PUT OUTFILE[/code]
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: Tue Feb 24, 2009 10:55 am
Reply with quote

Hello,

Easytrieve will MATCH 2 sequential files that are in the same sequence and have the same "keys" to use to match.
Back to top
View user's profile Send private message
manishmittal

New User


Joined: 25 Apr 2008
Posts: 49
Location: Gurgaon

PostPosted: Tue Feb 24, 2009 11:36 am
Reply with quote

Thanks u all.This solves my problem.

Apart from this , in above manner we can match only one key.What if i want to match more than one?
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: Tue Feb 24, 2009 8:43 pm
Reply with quote

Hello,

Quote:
in above manner we can match only one key.What if i want to match more than one?
Using the same basics, multiple keys may be matched. The only rule i know of is that both files must have the same number of keys named to match. . .
Back to top
View user's profile Send private message
manishmittal

New User


Joined: 25 Apr 2008
Posts: 49
Location: Gurgaon

PostPosted: Wed Feb 25, 2009 10:17 am
Reply with quote

Thnx Dick.I will try and if have any doubts, will get back to the forum.
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: Wed Feb 25, 2009 11:38 am
Reply with quote

You're welcome - someone will be here icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top