MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

EZT Program - Urgent

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
mikemurray
Beginner


Joined: 09 Jun 2003
Posts: 4
Topics: 2

PostPosted: Mon Jun 09, 2003 7:57 pm    Post subject: EZT Program - Urgent Reply with quote

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
View user's profile Send private message
dalaly
Beginner


Joined: 29 Nov 2002
Posts: 56
Topics: 23

PostPosted: Mon Jun 09, 2003 10:32 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Premkumar
Moderator


Joined: 28 Nov 2002
Posts: 77
Topics: 7
Location: Chennai, India

PostPosted: Tue Jun 10, 2003 1:59 am    Post subject: Reply with quote

dalaly,

Does EZT's Synchronized file processing takes care of duplicates?
Back to top
View user's profile Send private message Send e-mail
dalaly
Beginner


Joined: 29 Nov 2002
Posts: 56
Topics: 23

PostPosted: Tue Jun 10, 2003 7:51 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
mikemurray
Beginner


Joined: 09 Jun 2003
Posts: 4
Topics: 2

PostPosted: Tue Jun 10, 2003 8:06 pm    Post subject: Reply with quote

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
View user's profile Send private message
Scott T.
Beginner


Joined: 16 May 2003
Posts: 1
Topics: 0

PostPosted: Tue Jun 10, 2003 8:53 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
mikemurray
Beginner


Joined: 09 Jun 2003
Posts: 4
Topics: 2

PostPosted: Sat Jun 14, 2003 10:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
vijay
Beginner


Joined: 09 May 2003
Posts: 131
Topics: 64

PostPosted: Mon Jun 30, 2003 8:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group