EZT Program - Urgent
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Application Programming

#1: EZT Program - Urgent Author: mikemurray PostPosted: Mon Jun 09, 2003 7:57 pm
    —
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

#2:  Author: dalaly PostPosted: Mon Jun 09, 2003 10:32 pm
    —
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 Wink

#3:  Author: PremkumarLocation: Chennai, India PostPosted: Tue Jun 10, 2003 1:59 am
    —
dalaly,

Does EZT's Synchronized file processing takes care of duplicates?

#4:  Author: dalaly PostPosted: Tue Jun 10, 2003 7:51 am
    —
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

#5:  Author: mikemurray PostPosted: Tue Jun 10, 2003 8:06 pm
    —
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

#6:  Author: Scott T. PostPosted: Tue Jun 10, 2003 8:53 pm
    —
Something like this would do it:

FILE SEQFILE FB(150 1800)
%PERSNL
JOB INPUT NULL NAME MYPROG
GET SEQFILE
IF EOF SEQFILE
returncode = 999
END-IF
PRINT REPORT1


Check out this site:

http://programmingstuff.tripod.com/prog_chapter3.html#3.2.2

#7:  Author: mikemurray PostPosted: Sat Jun 14, 2003 10:50 pm
    —
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

#8:  Author: vijay PostPosted: Mon Jun 30, 2003 8:46 am
    —
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
**



MVSFORUMS.com -> Application Programming


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group