Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can we include two physical files of the same name residing in two different libraries in a single RPG/RPGLE program?

442 views
Skip to first unread message

Arup K George

unread,
Apr 5, 2004, 4:58:27 AM4/5/04
to
Hi all,

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

Miss L. Toe

unread,
Apr 5, 2004, 6:10:55 AM4/5/04
to

"Arup K George" <arupk...@coolgoose.com> wrote in message
news:1cc2ad41.04040...@posting.google.com...

Give them different names in the RPG then use an override in the CL


Brad R Doyle

unread,
Apr 5, 2004, 12:50:15 PM4/5/04
to
Miss L. Toe wrote:


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

Brian

unread,
Apr 6, 2004, 12:50:55 PM4/6/04
to
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.

"Brad R Doyle" <b.d...@rogers.com> wrote in message
news:b7gcc.15095$L_8....@news01.bloor.is.net.cable.rogers.com...

Jonathan Ball

unread,
Apr 6, 2004, 12:54:39 PM4/6/04
to
Brian wrote:

> 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.

0 new messages