Sample Program: Adding a Job Step for an External Command or Program
With Release 4.0, there are now two ways to schedule external programs or commands in a job step. These are:
You can schedule either an external command or an external program in a single job step, but not both. To schedule an external command, you use the COMMANDNAME and OPERATING SYSTEM parameters. To schedule an external program, you use the EXTPGM_NAME parameter.
Both external commands and external programs share the EXTPGM-parameters other than EXTPGM_NAME.
For more information, search for "External Programs" in the
CCMS Guide.*
* Add a job step: external program
*
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
AUTHCKNAM = SY-UNAME " User for runtime
" authorizations
JOBCOUNT = JOBNUMBER " From JOB_OPEN
JOBNAME = JOBNAME " From JOB_OPEN
COMMANDNAME = EXTERNAL_COMMAND " Name of a pre-defined
" external command.
" COMMANDNAME and
" EXTPGM_NAME are
" mutually-exclusive
" alternatives. Both
" use the EXTPGM
" parameters.
OPERATINGSYSTEM= 'AIX' " Operating system for
" choosing COMMANDNAME
" variant.
EXTPGM_NAME = '/usr/exe/myexe' " Pathname of an
" external program;
" an authorization
" for S_RZL_ADM (CC
" Control Center:
" System Administration)
" is required.
EXTPGM_PARAM = '<Parameter String>' " Program parameters
EXTPGM_SYSTEM = 'host01' " Host for execution
EXTPGM_WAIT_FOR_TERMINATION = 'X' " Control flags for
EXTPGM_STDOUT_IN_JOBLOG = 'X' " external programs:
EXTPGM_SET_TRACE_ON = 'X' " see RSXPGDEF
EXTPGM_STDERR_IN_JOBLOG = 'X' " documentation for
" EXTPGM options
EXCEPTIONS
INVALID_JOBDATA = 02
JOBNAME_MISSING = 03
JOB_NOTEX = 04
JOB_SUBMIT_FAILED = 05
LOCK_FAILED = 06
PROGRAM_MISSING = 07
PROG_ABAP_AND_EXTPG_SET = 08
BAD_XPGFLAGS = 09
OTHERS = 99.
IF SY-SUBRC > 0.
<Error processing>
ENDIF.