The command string is executed via IBM supplied program QCMDEXC. As such it must be a valid command in IBM i format. This can only be executed on an IBM i.
Where an operating system command specified for execution via the EXEC_OS400 command fails to execute, place the function in LANSA debug mode and attempt the operation again. Refer to LANSA Debugging Mode in the LANSA for i User Guide for details.
When a function is in debug mode the routine that actually handles the execution of the command will stop processing just before executing the command. The command that is about to be executed will be displayed in full. This includes the substitution values of any LANSA fields that were imbedded into the command.
Fields from the function specified in the command string must be in uppercase.
The process by which fields in the command string are substituted is quite complex. The following example shows most of the substitution methods used.
If the command to be executed is:
EXEC_OS400 COMMAND('CALL PGM001 (#BATCH #TRANS)')
where #BATCH is a numeric field (7 0) and #TRANS is an alphanumeric field of length 10, this table indicates the actual command executed for various values of #BATCH and #TRANS:
Note that the command specified must be enclosed in quotes. This means that if the command itself must contain quotes then 2 will have to be used instead of one. For details of quotes and quoted strings, read the section on handling Quotes and Quoted Strings.
OS400 Authority Considerations
Commands executed via EXEC_OS400 adopt the authority of the LANSA system owner user profile, and the user profile of any other entries in the call stack with USRPRF(*OWNER) as long as the "chain" is not broken by an entry in the call stack with USEADPAUT(*NO).
If this does not suit your site security policy, issue the commands:
CHGPGM PGM(M@CPEXEC) USRPRF(<your value>) USEADPAUT(<your value>)
CHGPGM PGM(M@OSEXEC) USRPRF(<your value>) USEADPAUT(<your value>)
If either of these commands fail, contact your LANSA product vendor. You should also examine these values after any form of upgrade to your LANSA system.