|
Willie wrote: > I know that these DDS files can now be joined into one logical file. Don't confuse the word JOIN with the words MULTI-FORMAT. A join file creates one single new record from records in several files. What you are trying to do (I think) is to keep the same sort of processing you currently have, but use DDS. So you want to (say) write item detail records, then a header and then a trailer. Is that right? If so, this isn't too hard. When you want to read the next record in sequence REGARDLESS of it's type (header, detail, trailer) then READ the file name. When you want to read a specific record type, READ the record format name. All writes/updates use the record format name. Since your files probably have record format indicators in them already, all you need to do is transfer the indicators to the record format definitions in the I specs. Two things I can think of. If not using the cycle, you should turn off all record identifying indicators yourself. You can either use indicators or the record format name from the file information data structure to identify what you just read. Here is some code for you to get started with. It should compile on any release of OS400. This is the LF, ORDL: A R RORDHEAD PFILE(ORDHEAD) A* A K ORDER# A K DATE DESCEND A* A R RORDDETL PFILE(ORDDETL) A* A K ORDER# A K *NONE A K ITEM# * Test multi-format I/O h/copy qrpglesrc,stdhspec * dbgview(*list) fordl uf a e k disk infds(ordds) d ordds ds d recFmt *RECORD irordhead 01 irorddetl 02 * Loop through the file and see what indicators come on c readAnother tag c setoff 0102 c read ordl 80 c 80 goto doneReading c recFmt dsply c 01'01 on' dsply c 02'02 on' dsply c goto readAnother c doneReading tag * Let's get the first item detail record c *loval setll ordl c setoff 0102 c read rorddetl 80 c recFmt dsply c 01'01 on' dsply c 02'02 on' dsply * Let's write a new order * first, the detail record c z-add 10 order# c z-add 100 item# c z-add 1 qtyo c write rorddetl * then the header. Shows that order doesn't matter c z-add 10 order# c z-add 10000 cust# c z-add *date date c write rordhead c eval *inlr = *on
As an Amazon Associate we earn from qualifying purchases.
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.