View previous topic :: View next topic |
Author |
Message |
mikemurray Beginner
Joined: 09 Jun 2003 Posts: 4 Topics: 2
|
Posted: Mon Jun 09, 2003 7:57 pm Post subject: EZT Program - Urgent |
|
|
Hi ,
I need help with an EZT program for file compare.
filea:
10
30
30
40
fileb:
20
30
40
I wan't to copy all the records from filea that have a matching record in fileb in one file and all records in filea that don't have a matching record in fileb in another file.
Note: filea has duplicates.so 2 records with "30" should show in the matched output.
I've to use EZT only.
Please help
Urgent |
|
Back to top |
|
|
dalaly Beginner
Joined: 29 Nov 2002 Posts: 56 Topics: 23
|
Posted: Mon Jun 09, 2003 10:32 pm Post subject: |
|
|
mikemurray,
This should accomplish what you want (MAKE SURE YOUR INPUT FILES ARE SORTED):
Code: |
//EZPLUS EXEC PGM=EZTPA00
//STEPLIB DD DSN=LOCATION OF YOUR EASYTREV LOADLIB,
// DISP=SHR
//SYSPRINT DD SYSOUT=*
//FILEB DD DSN=FILEB,DISP=SHR
//FILEA DD DSN=FILEA,DISP=SHR
//OUTPUT DD DSN=OUTPUT,
// UNIT=DISK,
// DISP=(NEW,CATLG,DELETE),
// DATACLAS=FBSML,
// LRECL=80
//OUTPUT1 DD DSN=OUTPUT1,
// UNIT=DISK,
// DISP=(NEW,CATLG,DELETE),
// DATACLAS=FBSML,
// LRECL=80
//OUTPUT2 DD DSN=OUTPUT2,
// UNIT=DISK,
// DISP=(NEW,CATLG,DELETE),
// DATACLAS=FBSML,
// LRECL=80
//SYSIN DD *
FILE FILEB
NUMB 1 02 A
*
FILE FILEA
NUMA 1 02 A
*
FILE OUTPUT
*
FILE OUTPUT1
*
FILE OUTPUT2
*
JOB INPUT (FILEB KEY(NUMB) +
FILEA KEY(NUMA))
IF MATCHED
PUT OUTPUT FROM FILEB <==ONLY MATCHED RECORDS WILL APPEAR ON THIS FILE
ELSE
IF FILEB
PUT OUTPUT1 FROM FILEB <==RECORDS ONLY ON FILEB WILL APPEAR HERE
ELSE-IF FILEA
PUT OUTPUT2 FROM FILEA <==RECORDS ONLY ON FILEA WILL APPEAR HERE
END-IF
END-IF
/*
|
RESULTS:
OUTPUT
30
30
40
OUTPUT1
20
OUTPUT2
10
There are many other ways to do this but this is what I would use.
Good Luck!
-dalaly |
|
Back to top |
|
|
Premkumar Moderator
Joined: 28 Nov 2002 Posts: 77 Topics: 7 Location: Chennai, India
|
Posted: Tue Jun 10, 2003 1:59 am Post subject: |
|
|
dalaly,
Does EZT's Synchronized file processing takes care of duplicates? |
|
Back to top |
|
|
dalaly Beginner
Joined: 29 Nov 2002 Posts: 56 Topics: 23
|
Posted: Tue Jun 10, 2003 7:51 am Post subject: |
|
|
Premkumar,
As long as your driver file has unique records in it and both files are sorted prior to executing your program, EZT will process duplicates correctly.
Best regards,
-dalaly |
|
Back to top |
|
|
mikemurray Beginner
Joined: 09 Jun 2003 Posts: 4 Topics: 2
|
Posted: Tue Jun 10, 2003 8:06 pm Post subject: |
|
|
Hi Dalalay ,
Thanks for the reply.It's working.Also I want to know how can I check if these two files are empty?I want to set a return-code and abend when any of these files ie empty.
Thanks,
Mike |
|
Back to top |
|
|
Scott T. Beginner
Joined: 16 May 2003 Posts: 1 Topics: 0
|
|
Back to top |
|
|
mikemurray Beginner
Joined: 09 Jun 2003 Posts: 4 Topics: 2
|
Posted: Sat Jun 14, 2003 10:50 pm Post subject: |
|
|
Hi Dalalay ,
Thx for the solution.If possible can u post the soluiton for this without using synchronous input(i.e using JOB INPUT NULL).The output should be the same.
Mike |
|
Back to top |
|
|
vijay Beginner
Joined: 09 May 2003 Posts: 131 Topics: 64
|
Posted: Mon Jun 30, 2003 8:46 am Post subject: |
|
|
Use this for Input NULL
**
Quote: |
JOB INPUT NULL START INIT-PARA
IF EOF FILEA
STOP
END-IF
IF EOF FILEB
IF NOT EOF FILEA
GET FILEA
GOTO JOB
END-IF
END-IF
IF KEY-A = KEY-B
PUT FILEC FROM FILEB
GET FILEB
GOTO JOB
END-IF
IF KEY-A LT KEY-B
GET FILEA
GOTO JOB
END-IF
IF KEY-A GT KEY-B
GET FILEB
GOTO JOB
END-IF
*
INIT-PARA. PROC
GET FILEA
GET FILEB
END-PROC
**
|
|
|
Back to top |
|
|
|
|