> Do the contents of the input record modify both FileNM_DS & FileCR_DS for each > record read, as I suspect? Yes. The FileNM_DS and FileCR_DS are both pointing at the exact same area of memory. Just 2 different ways to look at the same block of memory. > So, if you want to hold the values of the header record while you're reading > all the detail records, you'd have to move the header data structure to > another data structure? Or maybe I'd just drop the pointer business, and > movel ARBuffer to the appropriate DS? (Would have to move DS data back to > ARBuffer before updating or adding records.) Yes. If you want to save the header record, you could copy it to someplace to store it. I had to do something like this, but decided it was better, in my case, just to copy the variables I needed to retain into holding variables. And, yes, you can just drop the whole pointer business and just copy the ARBuffer into the DS. The reason I don't do this, however, is mainly because of speed. If I am going through a lot of records looking for something I don't want to have to copy each and every record. And then I'd have to remember to move it back to ARBuffer. Think of what you are doing this way though. You are reading a record into a buffer, copying that buffer into a data structure, looking at your structure and making changes, then moving it back into the buffer before writing it. It seems much simpler to just point your Data Structure over the buffer in the first place. A lot less to think about and less areas for bugs to creep in. > If you modify a field in one of either the FileNM_DS or FileCR_DS data > structures, will the modified bytes show up in the other? Naturally, since both datastructures are pointing to the same physical memory. Dan Bale IT - AS/400 Handleman Company 248-362-4400 Ext. 4952 +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: firstname.lastname@example.org +---
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.