|
Tim, Someone else mentioned multi occurance data structures, and that would be a workable approach: build a loop which will read records from the first ST* and store them each as an occurance in the data structure. When another ST** record is read, execute code to loop through the data structure and perform whatever you wish, do your cleanup then store the new ST* values and start it all over again. Before multi occurance data structures, we would use arrays or if the number of transactions to complete a set exceeded our available memory, you could accomplish this with a direct file for storage. (If you have a WORKSTN file in the program, a subfile could even be used) If you are using the same field names for your input and output records, you do run into the problem of overlaying data....as a normal practice in our shop, each field has a two letter prefix to uniquely identify that records value for the field (ie: input is xxCUST and output is to yyCUST) so that on each read of ST* the input is moved to the output variables and those values are available throught the subsequent processing. On the S/36, if being threatened by overlays, we would use the input names on the output to avoid the storage space required to store basically the same data twice and avoid the cost of doing a MOVE/Z-ADD....(much less the luxury of storing 100K in an array) that all went away after we got used to the idea that even small programs can be 200K with no ill effects. Hopefully a store loop followed by a process loop would not require too much of a change to your program. Regards, James W. Kilgore QAPPDSN@ibm.net Tim Truax wrote: > > Here's what I am doing, I am reading EDI data like below. > > ST*265 <--Here is the beginning of data > collection. > BGN*1111*2222*****123**Pittsburgh*PA for record output. > REF*CR*1009999*987 > REF*VN*1111****22222000*** > ST*197 <--- When I LookAhead and see > this next UNRELATED > BSR*100000***PA record, I output at this > point the previous > 4 records field information. > Everything in this job is variable, the number of records between the > ST*xxx records therefore when I look ahead and see the next start > sequence about to come in (I do not want the fields to come into my > program and then overwrite my fields being held from the previous ST*xxx > record. > Gee.. I hope you can understand my wording. > Let me know what you think, and thanks. > -- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to "MIDRANGE-L@midrange.com". | To unsubscribe from this list send email to MAJORDOMO@midrange.com | and specify 'unsubscribe MIDRANGE-L' in the body of your message. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.