× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Can a PF have >1 record fmt
  • From: Jim Langston <jimlangston@xxxxxxxxxxxxxxxx>
  • Date: Wed, 10 Jan 2001 09:57:01 -0800
  • Organization: Pacer International

> 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: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.