Dynamically declaring files in RPGLE
0 pts.
0
Q:
Dynamically declaring files in RPGLE
I want to declare files in rpgle depending on the user choice entered from a display screen
Is it possible to dynamically declare files.
ASKED: Apr 13 2006  6:00 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
0 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Yes, it is possible. You should use SQL for your files which can be determined at run time.
Last Answered: Apr 13 2006  7:37 AM GMT by DaddyCOZ   0 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

PaulCHsu   0 pts.  |   Apr 13 2006  11:46AM GMT

Use program define file. Use ‘QCMDEXC’ to override the file to user input. Define the record to the possible longest length.

**********************************************
FINPUT IF F 500 DISK USROPN
**********************************************
D DS
D CLP 1 45
D DIM(1) CTDATA PERRCD(1)
D FNM 14 45
**********************************************
IINPUT AA 98
I 1 500 REC
I 1 52 DSP
**********************************************
C *ENTRY PLIST
C PARM LIB 10
C PARM FILE 10
C PARM MBR 10
C PARM MBR 10
C EVAL FNM=%TRIM(LIB) + ‘/’ + %TRIM(FILE)
C EVAL FNM=FNM + ‘ ‘ + MBR
C CALL ‘QCMDEXC’
C PARM CLP(1)
C PARM 45 LEN 15 5
C OPEN INPUT
C READ INPUT 0101
C DSP DSPLY
C CLOSE INPUT
C EVAL *INLR=’1′

 

MTharp   0 pts.  |   Apr 14 2006  9:49AM GMT

You could make use of the EXTFILE keyword of file INPUT. A variable (calculated at run-time) is be used to control which file is opened. Also, if a file is multi-member, you can utilize the EXTMBR keyword.

FInput if e Disk ExtFile(fnm) UsrOpn

D EntryParms pr ExtPgm(’PGM1′)
D 10a
D 10a

D EntryParms pi
D iLib 10a
D iFile 10a

D fnm s 21a Inz(*blanks)

/free
if iLib *blanks ;
fnm = %trim(iLib) + ‘/’ + %trim(iFile) ;
else ;
fnm = %trim(Ifile) ;
endif ;
open Input ;
/end-free

 
0