File open RPG
5 pts.
0
Q:
File open RPG
Is there a way in an rpg program to open a file using a character field for the filename?
for example: if my file name is TESTFILE I can use the line: (in rpg free)
  OPEN TESTFILE;
but is there a way to have character field in place of the filename:
  D filename           S             10
/free
    filename = 'TESTFILE';
    open filename;   

Software/Hardware used:
v5r3
ASKED: Sep 12 2009  8:19 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
24600 pts.
0
A:
 RATE THIS ANSWER
+1
Click to Vote:
  •   1
  •  0
  • AddThis Social Bookmark Button
Your F spec would need two keywords

F filename E DISK USROPN EXTFILE(myfile)

D myfile S 10
/free
myfile = 'TESTFILE';
open filename;

When you compile the program either
1. a file by the name of FileName should exist in your library list with the correct structure for your program to map the field from

or
2. do an OvrDbf Filename Testfile shave(*yes) to point the use of filename to an existing example of the file structure,
then compile,
then dltovr filename

Phil
Last Answered: Sep 12 2009  11:54 AM GMT by Philpl1jb   24600 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



0