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 

EZYTRIEVE FILE COMPARISION

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


Joined: 04 Oct 2005
Posts: 2
Topics: 1

PostPosted: Thu Oct 06, 2005 11:46 pm    Post subject: EZYTRIEVE FILE COMPARISION Reply with quote

hi,
i am getting following problem with easytrieve.

i have two files one contains lot of records with error code at 37 byte and the other file contains only one record with error code.u have to compare the errorcode and create an output file of those records.using the following code i am getting only one matching record but there are lot of matching records.it is reading all records in file1 but not comparing the errorcode except for the first.can ant one enlighten me on this issue.
the following is the easytrieve control card.
Code:

JOB INPUT(INFILE1 KEY (IN1-ERR-CDE) +
          INFILE2 KEY(IN2-ERR-CDE)) +
    FINISH (EOJ-REPORT)
                                                     
  IF MATCHED
     WS-REC-NOTMATC-CNT = 0
     WS-REC-READ-INFILE1 = WS-REC-READ-INFILE1 + 1
     WS-REC-READ-INFILE2 = WS-REC-READ-INFILE2 + 1
     WS-REC-MATC-CNT = WS-REC-MATC-CNT + 1
     PUT OUTFILE FROM INFILE1
  ELSE
     IF INFILE1
        WS-REC-READ-INFILE1 = WS-REC-READ-INFILE1 + 1
     ELSE
        WS-REC-READ-INFILE2 = WS-REC-READ-INFILE2 + 1
     END-IF

     WS-REC-NOTMATC-CNT = WS-REC-NOTMATC-CNT + 1
 end-if.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Oct 07, 2005 12:24 am    Post subject: Reply with quote

Suren_Sistla,

When you do any comparison using Eazytrieve, you need to be careful about one point. See Kolusu's message below.

Kolusu
Quote:

You only need a custom logic when you are doing a MANY to MANY match. ONE to MANY and MANY to ONE logic is already built in easytrieve.


You said
Quote:

and the other file contains only one record with error code.


Question:
1. Does the second file contain 1 record per error code ? OR
2. only 1 record altogether ?

I am not good in Eazytrieve, but if your second file has less number of records, you could better achieve the above requirement easily using SORT. Would you prefer that ?

Also, give us sample input files and expected output along with RECFM and LRECL of your input and output files.

Thanks,
Phantom
Back to top
View user's profile Send private message
suren_sistla
Beginner


Joined: 04 Oct 2005
Posts: 2
Topics: 1

PostPosted: Fri Oct 07, 2005 2:19 am    Post subject: ezytrieve Reply with quote

phantom,

i need to do this output generation with ezytrieve only.

the second file contains only 1 record.it has an error code 1000.
the first file contains lot of records with this error code at 37 byte.

i want to know how can the comparision made successful for all records of file 1 with single record of file2(many to one)

LRECL=1250 RECFM=FB
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Oct 07, 2005 2:45 am    Post subject: Reply with quote

Suren_sistla,

When you have only 1 record in File 2 why should you COMPARE the records ??? Can't this be achieved easily using IF condition.

How about this logic.
1. Read File 2 and store the data into a variable WS-CHECK-CODE
2. Read contents of File 1 till End and perform the following
2.1 If File1(37:4) = WS-CHECK-CODE THEN
do some operation
2.1 Else
'condition not met'

Does this solve your requirement.

Thoughts ???

Thanks,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Oct 07, 2005 3:58 am    Post subject: Reply with quote

suren_sistla,


With easytrieve always remember that

Code:

FILE-1      FILE-2     OUTPUT

MANY        ONE      =  ONE
ONE         MANY     =  MANY


You are doing a many to one which will result in only one output .So all you need is to flip the files in the job statement . change your job statement to the following.


Code:

JOB INPUT (INFILE2 KEY (IN2-ERR-CDE)  +
          (INFILE1 KEY (IN1-ERR-CDE)) +
   FINISH (EOJ-REPORT)


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Fri Oct 07, 2005 4:34 am    Post subject: Reply with quote

Kolusu,

Quote:

You are doing a many to one which will result in only one output


I thought the same thing but was not sure. I thought it would be easy to use IF condition directly since there is only one record.

thanks for the clarification,

Regards,
Phantom
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