|
Don't rename any FIELD. Rename only one of the records (input or output, you choose), since RPG does not accept two records with the same name. READ the input file, if it satisfies your criteria: WRITE your output 'record' and DELETe your input (or vive-versa, it does not matter, RPG does not care untill you READ the next input record). The value in the fields in the output record will be mapped with the corresponding values of the fields from the input record. NO 'move' is needed since the fields have the same name. TWO (or more) files can have the same field names. The current value of a field represent the value of the field found in the LAST file read or the result of an operation performed on that field. Your purge program (SOURCE) can be as short as 11 statements 1) Input file definition 2) Output file definition 3) Rename of the output record 4) Read INPUT (LR on, if no record) 5) DO While not LR 6) IF criteria met 7) write (output record) 8) delet (input record) 9) end --- IF loop 10) read INPUT (LR on, if no record) 11) end --- DO loop ---- voila --- Just a note, don't forget to "re-org" your input file to remove the "null"/deleted records. Brian k Stapleton wrote: > Greetings All; > > I have two files for my purge program. File A has my data. File B is > created by CRTDUPOBJ DATA(*NO) with a rename on the name of the file. > > In RPG-IV, I rename the record formats and I prefix the fields in file A > with an A, and B with a B. For example: custno = Acustno for file A. > Custno = Bcustno for File B. > > I want to read file A, if I decide to delete this record, then I want to > write this record to File B, and then delete the record in File A. > > Is there a way to move the entire record in file A to File B? A move > statement doesn't cut it. > > Brian & Dawn Stapleton > BrianKStapleton@juno.com > > _____________________________________________________________________ > You don't need to buy Internet access to use free Internet e-mail. > Get completely free e-mail from Juno at http://www.juno.com > Or call Juno at (800) 654-JUNO [654-5866] > > root > +--- > | 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 MIDRANGE-L-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- > uucp -- Leo Lefebvre leo@tug.on.ca Toronto Users Group for Midrange Systems Visit our home page at <http://www.tug.on.ca> Ph: (416) 606-5960 --- Fx: (416) 495-0100 +--- | 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 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 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.