The two files need to have two different names in the F specs of your program.
Then you can do a OVRDBF before the call to the program.
You can also specify the library of the 2nd file within your RPG program.
Last Wiki Answer Submitted: January 6, 2011 2:42 pm by CharlieBrowne33,730 pts.
All Answer Wiki Contributors: CharlieBrowne33,730 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
Here’s some code that declares file QCUSTCDT from library QIWS as well as file QCUSTCDT from a library named in a variable:
FQCUSTCDT1 if e disk extfile( 'QIWS/QCUSTCDT' )
FQCUSTCDT2 if e disk usropn
f extfile( CUSTCDT2 )
f extmbr( CDMBR )
f rename( CUSREC : CUSREC2 )
f prefix( QC : 2 )
D CUSTCDT2 s 21
D CDMBR c 'MYMBR'
CUSTCDT2 = %trimr( PgmLib ) + '/'
+ 'QCUSTCDT' ;
There are more options there than you need. The two F-specs use slightly different techniques. Use only pieces that you really need.
The requirement is that the compiler needs file descriptions named “QCUSTCDT1″ and “QCUSTCDT2″ at compile-time because those are the F-spec names. You can either create duplicate file descriptions in a library in your library list when you compile or execute OVRDBF before the compile command executes. There is no need to run OVRDBF when the program runs if you do it this way.
When you duplicate a file description for this, you don’t need the data. Nor do you even need any members. The file description objects are small enough not to make any real difference to your system. If necessary, they can be deleted after the compile finishes; but I prefer keeping them in a development library for later reference.
Here’s some code that declares file QCUSTCDT from library QIWS as well as file QCUSTCDT from a library named in a variable:
FQCUSTCDT1 if e disk extfile( 'QIWS/QCUSTCDT' ) FQCUSTCDT2 if e disk usropn f extfile( CUSTCDT2 ) f extmbr( CDMBR ) f rename( CUSREC : CUSREC2 ) f prefix( QC : 2 ) D CUSTCDT2 s 21 D CDMBR c 'MYMBR' CUSTCDT2 = %trimr( PgmLib ) + '/' + 'QCUSTCDT' ;There are more options there than you need. The two F-specs use slightly different techniques. Use only pieces that you really need.
The requirement is that the compiler needs file descriptions named “QCUSTCDT1″ and “QCUSTCDT2″ at compile-time because those are the F-spec names. You can either create duplicate file descriptions in a library in your library list when you compile or execute OVRDBF before the compile command executes. There is no need to run OVRDBF when the program runs if you do it this way.
When you duplicate a file description for this, you don’t need the data. Nor do you even need any members. The file description objects are small enough not to make any real difference to your system. If necessary, they can be deleted after the compile finishes; but I prefer keeping them in a development library for later reference.
Tom