By default, a C/C++ program is executed immediately as soon as it is invoked with the START-EXECUTABLE-PROGRAM command.
The PARAMETER-PROMPTING option of the MODIFY-RUNTIME-PROPERTIES statement (see "MODIFY-RUNTIME-PROPERTIES") can be used to control whether the standard I/O files are to be redirected before program execution and whether parameters can be passed to the main
function.
PARAMETER-PROMPTING = *NO
By default, the program is executed immediately after it is started with the START-EXECUTABLE-PROGRAM command, i.e. without a preceding dialog step for the input
of parameters. Only the name of the program is passed to the main
function.
PARAMETER-PROMPTING = *YES
After it is started with the START-EXECUTABLE-PROGRAM command, the program issues the message:
CCM0001 enter options :
*
The START-EXECUTABLE-PROGRAM or SRX command also enables the parameters to be transferred at the same time:
/START-EXECUTABLE-PROGRAM..,PROGRAM-PARAMETERS=‘...‘
As in the command line of the UNIX operating system, one or more parameter lines can now be used
to redirect the standard I/O files for C (
stdin
,stdout
adstderr
) and C++ (cin
,cout
,cerr
andclog
; see "Redirecting standard I/O files"), andto pass parameters to the
main
function (see "Input of parameters for the main function").To ensure that these parameters can be addressed in the program, the
main
function must include two formal parameters, which are usually named argc (argument count) and argv (argument vector). See "Definition of the main function with parameters".
The individual entries (for redirection and main
parameters) must be separated in the parameter line by whitespace characters.
If one parameter line is not sufficient for the input, the line can be terminated with a backslash (\), and the next parameter can be entered at the start of the following line. As with the whitespace character, the backslash (\) is interpreted here as a delimiter between two parameters (see also "Input of parameters for the main function" for further meanings of \).
Example
*par1 par2 par3\
*par4