Hi,
I want to read parallel 2 work files, but I don’t know, how does it works. If I use two interlaced READ Statements, I had to end the inner READ-Loop with END-WORK to make the next READ of the first Work File.
READ WORK FILE 01 #W01-SATZ
*
READ WORK FILE 02 #W02-SATZ
*
IF #W01-SATZ NE #W02-SATZ
WRITE ‘<>’
ELSE
write ‘=’
END-IF
*
END-WORK
*
END-WORK
In this kind, it does’nt work parallel! What can I do to read both Work-Files parallel? Perhaps it is easy, but I don’ have a good idea.
Thanks for your help!
As an alternative to Giles post, you could simply change your READ WORK FILE 02 to READ WORK FILE 02 ONCE and get rid of one END-WORK. This assumes that WF1 has at least as many records as WF2.
Both will work fine (given the length observation above).
As the first question, I do need to READ 2 Work File, but I need too compare both…
For example: Compare If the ID that is in WKF1 is in WKF2 … And if its not, I need to do a WRITE WORK FILE
Hi, I hope I can still add to this post.
When doing a Read Work File 02 Once, how do I continue looping?
I only want to select records that are on both files.
I tried to do escape top but that didn’t work.
thank you!!!
READ WORK FILE 02 ONCE does not initiate a loop, so as you note, escape top does not work. If you need to skip a record in WF 2, you will need a repeat loop around the READ WORK FILE 02 ONCE statement and read one record at a time until you reach the end of file 2 or find a record to process.
The sequential match program that I referenced earlier in this thread is working code that demonstrates how to do what you want. It is a parent-to-child match, where WORK1 is the parent and WORK2 is the child. You can allow a 1:many match or restrict it to 1:1. Add your own logic for matches, widows (parent; no child), and orphans (child; no parent).