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
 

 

Matching 2 files with Eztreive

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: Matching 2 files with Eztreive
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: 8593
Location: Back in jolly old England

PostPosted: Mon Feb 23, 2009 5:47 pm    Post subject:
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

Site Director


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

PostPosted: Mon Feb 23, 2009 9:29 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Reply to: Matching 2 files with Eztreive
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    Post subject:
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

Site Director


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

PostPosted: Tue Feb 24, 2009 10:54 am    Post subject:
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    Post subject: Reply to: Matching 2 files with Eztreive
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

Site Director


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

PostPosted: Tue Feb 24, 2009 10:55 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Feb 24, 2009 8:43 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Feb 25, 2009 11:38 am    Post subject: Reply to: Matching 2 files with Eztreive
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Matching with Key at different postions. rajatbagga DFSORT/ICETOOL 12 Wed Nov 09, 2016 10:58 am
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm


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