Date: Wed, 10 Jan 2001 09:28:52 -0500 From: firstname.lastname@example.org Subject: Re: Can a PF have >1 record form >>You need to look for unique data contained in one of the record formats >>that isn't contained in the other. In my particular case, I know that >>a certain field in one of my formats, the header, will contain a *Zero >>otherwise it will not be a *Zero. > Jim, this might be working for you, but it seems dangerous. And it > only allows two formats. I think this method would work better > if there was a record-type field at the beginning of every format. Yes, it would work better if there was a record-type field at the beginning of every format, but these are files I have little or no control over. In the ones I am dealing with there is a way to determine which is a header and which is a record. Also, this will allow any number of formats for one file. Unlimited as long as you can distinguish between them. Perhaps a file would have a Bill Of Lading Header, an Invoice Header, and then Invoice detail lines. In which case I would make 3 externally described files, and point all 3 to the same buffer. In what way do you think this would only allow two formats? > And Dan is right that it would be better to copy the records rather > than use pointers. Or maybe even better, copy the header record > because you might need to see the header fields while dealing with > a detail record, but when using the header record, set the basing > pointer of the detail record to *NULL so you can't accidentally > access its fields. In the general case, set all pointers to null > except the one for the record you're working with. I have maintained programs that had strange bugs and went into the code and saw the programmer was doing this type of thing. I saw that the programmer got confused as to just where his data was at any given time. He would update the record, forgetting to move the data back into the buffer, etc... It makes much more sense to me to keep the data in one spot and work with it there. More than one format in a single file is a bad idea in the first place, but it's something we sometimes have to deal with. Regards, Jim Langston > Barbara Morris +--- | 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: email@example.com +---
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.