Yes, I think the original question is asking about passing parameters into a start-up command line.
The -param option is the best way to do this, or you could set up environment variable and access them from your program.
def var this_program as char no-undo.
def var this_inputfile as char no-undo.
def var this_outputfile as char no-undo.
run p_get_param.
message this_program skip this_inputfile skip this_outputfile skip
view-as alert-box.
procedure p_get_param:
def var paramlist as char no-undo.
def var paramloop as int no-undo.
def var paramdelim as char no-undo.
def var this_param as char no-undo.
def var this_result as char no-undo.
paramlist = session
arameter.
paramdelim = ",".
do paramloop = 1 to num-entries (paramlist,paramdelim):
this_param = entry (paramloop, paramlist,paramdelim).
if num-entries (this_param,"=") = 2 then do:
this_result = entry (2,this_param,"=").
case entry (1,this_param,"="):
when "prog" then this_program = this_result.
when "input" then this_inputfile = this_result.
when "output" then this_outputfile = this_result.
end case.
end.
end.
end procedure.
You would start this with
mpro -db mydb -p start.p -param "prog=program.p,input=input.txt,output=output.txt"
Alternatively, in your batch script, you could set environment variables.
[In Unix]
INPUTFILE=input.txt
OUTPUTFILE=output.txt
PROGRAM=program.p
export INPUTFILE OUTPUTFILE PROGRAM
[In DOS]
set INPUTFILE=input.txt
set OUTPUTFILE=output.txt
set PROGRAM=program.p
[In Progress]
inputfile = os-getenv ("INPUTFILE").
outputfile = os-getenv ("OUTPUTFILE").
program = os-getenv ("PROGRAM").