Suppose there are two physical files each having the same
name, say STUDMAST residing in two different libraries. I have to copy
the records from one file to the other.How do you do this in an RPGLE
program? How can we include both the files in the F-SPEC.
Arup K George
Give them different names in the RPG then use an override in the CL
There are another two methods available as follows:
1. CL:
CPYF lib1/STUDMAST lib2/STUDMAST MBROPT(*APPEND)
2. ILE (SQL):
/Exec SQL Insert Into lib1/STUDMAST SELECT * FROM lib2/STUDMAST
--
Sincerely,
Brad R Doyle
Finfile if e disk extfile('LIB1/FILE')
F rename(rcdfmt:inrcd)
Foutfile o e disk extfile('LIB2/FILE')
F rename(rcdfmt:outrcd)
You need 'infile' and 'outfile' available at compile-time. These could be
empty copies of the file in question, used only for compiling.
"Brad R Doyle" <b.d...@rogers.com> wrote in message
news:b7gcc.15095$L_8....@news01.bloor.is.net.cable.rogers.com...
> EXTFILE keyword allows you to specify the run-time location of the files:
>
> Finfile if e disk extfile('LIB1/FILE')
> F rename(rcdfmt:inrcd)
> Foutfile o e disk extfile('LIB2/FILE')
> F rename(rcdfmt:outrcd)
>
> You need 'infile' and 'outfile' available at compile-time. These could be
> empty copies of the file in question, used only for compiling.
Note, though, that infile and outfile cannot have the
same name. The OP will need either OVRDBF statements
on one or both of them, or, as you implicitly suggest,
one or both can be (differently named) copies of the
real file.