Easytreive Question



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

Easytreive Question

Postby mf_usr » Tue Jun 16, 2009 2:12 pm

My requirement is we have 4 files.
1st file - driver file - with account number and customer number and other fields
2nd and 3rd file has account number and other fields
4th file has cust number and other fields.

Now, i have to match account number of 1st file with 2nd and 3rd file, iF matched, have to merge required fields from 2 & 3rd file with output file

And match customer number of 1st file with cust number of 4th file, pull reqd fields from 4th and merge with the output file.

My question is can this be done in same easytreive program??

Regards,
MF_usr
mf_usr
 
Posts: 4
Joined: Tue Jun 16, 2009 2:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Easytreive Doubt!!

Postby mf_usr » Tue Jun 16, 2009 2:43 pm

none around to help me :( ??? :(
mf_usr
 
Posts: 4
Joined: Tue Jun 16, 2009 2:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Easytreive Question

Postby BChat » Tue Jun 16, 2009 8:05 pm

Hi MF_usr,

It is possible with EZT Synchronized File Processing. But you have to do it in two steps (2 ezt). EZT Synchronized File Processing can match one set of FILE key. So in first step you match File1, File2, File3 and create intermediate file Temp say. And 2nd ezt to compare File1, File4 and Temp to create your final output.

Check CA easytrieve plus referrence guide (google it) & search for "Synchronized File Processing". It has a very nice example.

Very high level soln:

Assumption: You need to report records having match in all the 3 files. If not the EZT below needs a little change

Step 1 - 2 - 3 : Sort File 1, 2, 3 based on Ac/Nbr making all the Ac/Nbr in the output of same PIC if not so already. You can use the EZT sort also.

Step 4 : 1st Ezt like:

FILE FILE1
FILE1-AC-NBR 1 16 N
FILE1-CUST-NBR 17 16 N
FILE1-ATTRIB1 33 10 A

FILE FILE2
FILE2-REC-TYPE 1 4 A
FILE2-AC-NBR 5 16 N
FILE2-ATTRIB2 40 07 P 02


FILE FILE3
FILE3-AC-NBR 1 16 N
FILE3-ATTRIB3 50 07 A

FILE TEMP
TEMP-AC-NBR 1 16 N
TEMP-CUST-NBR 17 16 N
TEMP-ATTRIB1 33 10 A
TEMP-ATTRIB2 43 07 P 02
TEMP-ATTRIB3 50 07 A

JOB INPUT (FILE1 FILE(FILE1-AC-NBR) +
FILE2 FILE(FILE2-AC-NBR) +
FILE3 FILE(FILE3-AC-NBR))
IF NOT FILE1
STOP
ELSE-IF MATCHED
TEMP-AC-NBR = FILE1-AC-NBR
TEMP-CUST-NBR = FILE1-CUST-NBR
TEMP-ATTRIB1 = FILE1-ATTRIB1
TEMP-ATTRIB2 = FILE2-ATTRIB2
TEMP-ATTRIB3 = FILE3-ATTRIB3

PUT TEMP
END-IF

Step 5 - 6 - 7 : Sort File 1, 4 & temp based on Cust Nbr

Step 8 : A very similar EZT based on Cust nbr

Cheers,
BChat
BChat
 
Posts: 19
Joined: Thu Jun 11, 2009 8:20 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Easytreive Question

Postby mf_usr » Tue Jun 23, 2009 3:29 pm

Hi BChat,

Thanks for your post. Sorry couldn log in for sometime.

Actually I tried your post and got ok with some part.
Now I have another question and here I go...

I have two files in sorted order on Cust no.
File 1 with key as Acct no and it may have dup recs for Cust no.
File 2 with key as Cust no and no dup records.

I have to compare these 2 files and if matched cust no, move the reqd fields from File 2 to File 1.

But, if I match these two files, using ezt, only for the first occurence of Cust no in FIle 1, it moves the fields from file 2 to file 1.
When it encounters the duplicate record (same cust no) in File 1, it does not move the reqd fields from File 2 to File 1 since in File 2 it has already read that Cust no.
I want the same Cust no fields from File 2 to be moved to File 1 even if it encounters the dup records.

Anticipating your reply.

Thanks
Mf_Usr.
mf_usr
 
Posts: 4
Joined: Tue Jun 16, 2009 2:03 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Easytreive Question

Postby BChat » Mon Jun 29, 2009 9:41 pm

Mf_User,

I assume this is a new requirement involving 2 files. If so, make File 2 as the first level & File 1 as the second level. File 2 Cust Nbr will wait until all File 1 Cust Nbr record is exhausted.

You also have a IF FILE1 DUPLICATE check that tells if the next record is FILE1 itsself is duplicate or not.

Hope it helps,

BChat
BChat
 
Posts: 19
Joined: Thu Jun 11, 2009 8:20 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post