Mismatched Record Name Formats? No Problem!
February 18, 2009 Hey, Ted
We have two sets of order files–one current and one history–with the same fields but different record format names. (Who knows why?) The two inquiry programs use the same display file; and yours truly forgets to make changes in the history program when he changes the current program. I get the big brain idea to use the same program for both, but how do I override the history file to the current file when the record format names do not match? –David Let’s suppose your two files are called CURYRSLS (current year sales) and SLSHIST (sales history). The record formats are CURYRSLSR and SLSHISTR respectively, and both record formats are identical in structure. You already figured out that overriding with LVLCHK(*NO) won’t do the job, haven’t you? ovrdbf curyrsls tofile(slshist) lvlchk(*no) call yourpgm The result is message RNX1011: Undefined record type is found in file CURYRSLS. There is a way. Create a logical file over the SLSHIST file, with the following DDS. A R CURYRSLSR PFILE(SLSHIST) A FORMAT(CURYRSLS) The record name is declared to be the same record name the RPG program is expecting. The PFILE keyword indicates that the data is coming from the sales history file. The FORMAT keyword references the current sales file, or the physical file that contains the desired record format. Override the current file to the new history logical file. ovrdbf curyrsls tofile(slshist1) call yourpgm –Ted
|