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

RPG 400 (Use file name as parameter or variable)

783 views
Skip to first unread message

Jean-Francois Drapeau

unread,
Nov 6, 1997, 3:00:00 AM11/6/97
to

HI Folks!

I'm a rookie in RPG and I really need to know how can we use a file name as
a variable. I mean, in a loop or subroutine. I want to work with several
physical file and be able to move their name in a variable. (Something like
%% in DOS).

Thanks !

Jeff

Orangtang

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

As far as I know, it can't be done. You would have to use logic to condition
which file you want to read which is easy to do. Ron

Nobody

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

hello,
bad luck for you.
only way is to overwrite file before calling the program.
use "OVRDBF"

regards
guido
Jean-Francois Drapeau schrieb in Nachricht
<01bceb1a$15fcd720$2167fdcf@default>...

Helmut Salzer

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

HELLO "NOBODY" ...

bader luck for you, it IS (!!!) possible to overwrite files in a rpg pgm,
because the OVRDBF will be done with QCMDEXC and AFTER this you open the
file with OPEN filename. I have done this in n+ pgms.

Gretings

Helmut Salzer
Webmaster
Lauda's CARFOX
webm...@laudas-carfox.co.at
http://www.laudas-carfox.co.at/carfox/
Privat: http://members.eunet.at/salzer.h/as400.htm

Nobody schrieb in Nachricht <34630...@news1.ibm.net>...

Bryan Hipp

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

In article <01bceb1a$15fcd720$2167fdcf@default>, jef...@videotron.ca
says...

>
>HI Folks!
>
>I'm a rookie in RPG and I really need to know how can we use a file
name as
>a variable. I mean, in a loop or subroutine. I want to work with
several
>physical file and be able to move their name in a variable. (Something
like
>%% in DOS).
>
>Thanks !
>
>Jeff

You will need to specify that the file is to be a user controlled open
on the F spec. Then before opening the file, you will need to execute
a OVRDBF using a call to QCMDEXEC.

----------
Bryan Hipp
D.P. Requisite, Inc.
Tulsa, OK
dp...@ibm.net


Caura

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

CL-command OVRDBF lets you choose any external Filename you like. The
internal RPG-filename rests invariable.
2 ways to implement this (standard RPG-programming stuff):
1) make a CL-pgm (whit the OVRDBF command in it) that calls the RPG-pgm.

2) use the QCMDEXC pgm, which can be called within the RPG-pgm.
The QCMDEXC can perform the Overwrite. You should define the file 'UC' (user
controlled open) and perform the OPEN of the file after the QCMDEXC-call.

Further details can be found in the CL-manuals.

Jean-Francois Drapeau heeft geschreven in bericht
<01bceb1a$15fcd720$2167fdcf@default>...

Helmut Salzer

unread,
Nov 7, 1997, 3:00:00 AM11/7/97
to

It only works when all files have the same FFD !!

Define the file in the F spec with USROPN
f.e. FFILE1 E DISK USROPN
Then make an OVRDBF (QCMDEXC) with the filename you get as parm in your pgm
and open the file with the OPEN statement. When you want to work with
another file: Close the fiel with CLOSE and remove the override with DLTOVR
and begin with the first step above.

Greetings

Jean-Francois Drapeau schrieb in Nachricht

MPVSGROI

unread,
Nov 8, 1997, 3:00:00 AM11/8/97
to

What about this:

----If you have SQL, why not try not using F-Specs at all, and
create a variable where you could SUBSTRING-in the
FILE NAME variable, and use an SQL DYNAMIC SELECT
statement???

...paul j. sgroi
But the wooden ships, were just a hippie dream
Cap-sized in excess, if you know what I mean...Neil Young

Gunter Staes

unread,
Nov 8, 1997, 3:00:00 AM11/8/97
to

I suppose you want to process several PF in one run. In this case you
should take care that a dummy filename is described in your F lines (User
controlled). In your loop you can call the QCMDEXC programm to do an OVRDBF
command from within your RPG programm. Afterward you can use THE OPEN
&CLOSE command within your loop.


God Luck.

Jean-Francois Drapeau <jef...@videotron.ca> schreef in artikel

Frédéric FAURE

unread,
Nov 8, 1997, 3:00:00 AM11/8/97
to

Hi,
It's true
You define your file for explicite open,
You program CALL 'QCMDEXEC' with OVRDBF... as parameter
You make OPEN after this OVR.
I have done too this in n+ programs. An example ,For PRTF , you can change
outq for each society or Agency...
--
Frederic Faure

ETAPES informatique

F 77470 TRILPORT

fau...@msn.com

0 new messages