Batch Execution

Note: Although there is an AWM model action attribute MODELESS which enables the running of an action in an asynchronous mode, Micro Focus strongly recommends that you model actions containing ISPF command tools as MODAL actions and to use the ISPF batch mode for long running ISPF tasks. The ISPF environment attached to the user does not support the parallel execution of ISPF commands.

An ISPF tool can be modeled to run as an ISPF batch job. Use the attribute RunAsJob of the tool descriptor to model a tool to be executed as a batch job.

Accepted values for this attribute are:
  • NO
  • Model Job
  • Tool Job
The value NO, which is the default value, means the tool is executed in the foreground, which means the tool is executed in the ISPF environment which has been associated to the user. If the execution mode of the associated action is modal, the Eclipse workbench is blocked for other actions during the execution of the associated action.

The value Model Job means the tool is executed as an ISPF batch job. The submission of the tool as a batch job is handled in this case by the AWM ISPF tool interface. Any attached ISPF tool can be configured as ModelJob with no need to make any changes to the tool logic. Use this setting for long running background processing tools which do not contain any logic for submitting a batch job, for example, tools to build a program.

The value ToolJob is meant for tools which already contain logic to submit a batch job, for example, by creating a job via ISPF file tailoring and submitting it. If the tool is modeled as ToolJob you should return the job identifier and job name to the AWM client using the ISPF shared pool variables TAUTOJID and TAUTOJNA respectively.

The following is a REXX code snippet which shows how a tool can create and submit a batch job and set the shared pool variables TAUTOJID and TAUTOJNA.

REXX Example 1:

wmsg = '' 
subdsn = CREATEJOB('PGMBLD')    /* call to the subroutine CREATEJOB (listed below) */
/* Submit batch job */
msgmode = OUTTRAP('submsg.')     /* trap the submit system messages */ 
submsg.0 = 0
Address TSO "SUBMIT '"subdsn"'"    /* TSO submit the job subdsn */ 
subrc = rc
msgmode = OUTTRAP('OFF')    /* set the message mode off via OUTTRAP */
If subrc ^= 0 Then Do
   wmsg = 'Batch job not submitted.'
   Call EXIT 12 wsmg 
   End 
Do k = 1 To submsg.0          /* validate the stem variable submsg */
   Say Strip(submsg.k)
   If subrc ^= 0 Then   /* if the job submit failed, just return the error message lines */
      wmsg = wmsg Strip(submsg.k)
   Else Do
      Parse Value submsg.k With msgid . jname '(' jobid ')' .      /* parse the standard system submit message */
      If msgid = 'IKJ56250I' Then Do
         tautojid = jobid
         tautojna = jname
         ADDRESS ISPEXEC 'VPUT (TAUTOJID, TAUTOJNA) SHARED'  /* put the variables TAUTOJID and TAUTOJNA in the ISPF shared pool */ 
         wmsg = 'Batch job' jname'('jobid') successfully submitted'
         End
      End
   End
If subrc ^= 0 Then
   Call EXIT subrc wmsg 
 
/********************************************************************
Subroutine to create a Member via ISPF Skeleton
 
    Parameter:
    xskel:      Skeletonname
********************************************************************/
CREATEJOB:
 
Parse Upper Arg xskel .
/* standard ISPF file tailoring processing to create a job for batch submission */
/* we use a standard subroutine ISPF in REXX to call ISPF functions */  
ADDRESS ISPEXEC   "FTCLOSE"
  "FTOPEN TEMP"
  "FTINCL" xskel
  "FTCLOSE"
  "VGET ZTEMPF SHARED"  /* the ISPF variable ZTEMPF contains the name of the file in which the job was created */ 
ADDRESS TSO
t_ddname = ztempf
 
Return t_ddname 

The values put into the shared pool variable TAUTOJID and TAUTOJNA are displayed in an informational message window on the client side for tools modeled as ToolJob.

Jobs created by tools modeled as Model Job or ToolJob are listed in the Jobs view. This view monitors the execution status of the created job. The status changes from executing to done when the batch job has finished on the remote system. This also displays a notification message at the bottom right corner (main monitor). The notification automatically fades out after a default duration of 10 seconds. This behavior can be customized under the MVS function package in AWM models. See MVS Function Package for more information.

The Jobs view provides a context menu action to browse the output of the job.

The tool developer can model an After Job action for tools modeled as ModelJob or Tool Job. The action specified under the After Job action attribute in the tool descriptor is added to the context menu of the generated job in the Jobs view. The After Job action has access to the whole execution context which was available when the batch tool was submitted. The After Job action is typically used to display output information generated by the job, such as build results. An advantage of tools modeled as ModelJob and ToolJob is that the result of the tool is kept in the job output and can be reviewed at a later time.

The Jobs view also provides an action to personalize the job card for jobs submitted by tools modeled as ModelJob and also for jobs modeled as ToolJob if the batch job submitted by the tool supports the AWM job card, see ISPF Exits for more information.