


You can execute a command easily enough by passing the command string to the QCMDEXC API. But there is no memory connection that allows a parameter value to be returned. No variables can be passed. The variable values themselves must be inserted into the command string. If a command must be executed, and a parameter value must be returned, and the CPP can't simply be CALLed, then a simple CL procedure can be compiled around the command and made a part of the RPG program as an additional module. The CL procedure can pass the parameter value back and forth to RPG. -- Tom


It doesn’t make a lot of sense. If you are expecting a value to be returned from a command, the command parameter needs to be defined with RTNVAL(*YES). And when RTNVAL(*YES) is specified, the command can’t have *BATCH, *INTERACT or *EXEC specified for the CRTCMD ALLOW() parameter. A parameter can return a value when it is compiled in a program, but not when it’s executed as a stand-alone command. Make the command part of a compiled CL module. — Tom
If you want the value in RPGLE, just call the CPP directly. Skip the command. — Tom
I was just trying to execute a small command within an RPGLE when it starts up and bypass the use of any CL or DSPF.