View previous topic :: View next topic
|
Author |
Message |
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
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 |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
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 |
|
|
anandinmainframe
Active User
Joined: 31 May 2007 Posts: 171 Location: India
|
|
|
|
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 |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
anandinmainframe
Active User
Joined: 31 May 2007 Posts: 171 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
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 |
|
|
manishmittal
New User
Joined: 25 Apr 2008 Posts: 49 Location: Gurgaon
|
|
|
|
Thnx Dick.I will try and if have any doubts, will get back to the forum. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome - someone will be here
d |
|
Back to top |
|
|
|