Include Object (JOBI)

You can use Include objects to store identical script parts that you frequently need. You can then re-use them in various tasks.

Object Definition

Background/Purpose

Using Include objects ensures that your scripts are consistent, on the one hand, and saves you time, on the other, as they allow you to quickly and easily re-use code that you need often.

If your Include object also includes variables, ensure that these variables are also defined and initialized in the calling object. Otherwise, you cannot pass the variable from the Include object to the calling object.

You can also add the Include object in the calling object with the :INCLUDE statement. The script of the Include object is then inserted in the script of the calling object when the calling object is activated.

You can add JCL lines (if it is used in Job objects) in an Include object's script. You can also nest Includes within Includes up to max. five levels.

Use the rights assignment for users (write access to Include objects) if you want to prevent unwanted modifications in Include objects.

Defining Include Objects

The steps for defining Include objects (JOBI) are the same as for any other Automic object.

An Include object definition is made up of the following pages:

XXX

Configuring Include Objects for External Interpreter Calls

The system client 0000 includes two objects that you can use in your scripts to define external interpreters and their scripts:

You can call these objects with the :REGISTER_VARIABLE statement. This statement must be combined with the :BEGIN_EXT_INTERPRETERS and :END_EXT_INTERPRETERS statement in the Process page of the Job object (JOBS), see Job Object (JOBS). Both statements are available on Windows and UNIX.

Contact your administrator to configure these two objects, as their settings are available system-wide.

ClosedExamples:

Default Script - Windows

The REGISTER_VARIABLE.WINDOWSInclude object contains the following default script:

:set &uc_register_varname = sys_last_registered_varname()
:set &uc_register_valuename = sys_last_registered_valuename()
:set &uc_register_otype# = sys_act_me_type()
:if &uc_register_otype# = 'JOBS'
: set &uc_windows_typ = get_att(win_typ)
: IF &UC_WINDOWS_TYP = "BAT"

&UC_JOBMD JNR=&UC_REALNR MNR=&UC_MANDANT PNR=&UC_IP_PORT IPA=&UC_IP_ADR TYP=V VTYPE=T NAME=&uc_register_varname VALUE=&uc_register_valuename
: ENDIF
!:DATA @set retcodemsg=%errorlevel%
!:DATA @set retcode=0
!:DATA @if NOT %retcodemsg% == 0 GOTO :MSGABORT
: ENDIF
:endif

Perl as external interpreter on Windows:

If you want to use Perl as an external interpreter on Windows, enter the following script in the default Windows script (see example above) between the :IF and :ENDIF statements defining the &UC_WINDOWS_TYP variable:

: IF &$EXT_INTERPRETER# = 'PERL'
: SET &UC_PATH_JOBMD# = STR_SUB("&UC_JOBMD", "\", "\\")
system("&UC_PATH_JOBMD# JNR=&UC_REALNR MNR=&UC_MANDANT PNR=&UC_IP_PORT IPA=&UC_IP_ADR TYP=V VTYPE=T NAME=&uc_register_varname
VALUE=&uc_register_valuename");
: ELSE

Default Script UNIX:

The REGISTER_VARIABLE.UNIX Include object contains the following default script:

:set &uc_register_varname = sys_last_registered_varname()
:set &uc_register_valuename = sys_last_registered_valuename()
:set &uc_register_otype# = sys_act_me_type()
:if &uc_register_otype# = 'JOBS'
&UC_JOBMD JNR=&UC_REALNR MNR=&UC_MANDANT PNR=&UC_IP_PORT IPA=&UC_IP_ADDR TYP=V VTYPE=T NAME=&uc_register_varname VALUE=&uc_register_valuename
:endif

Viewing :INCLUDE Statements in the Script Editor

You can use the script editor to display and edit the contents of your Include objects.

You expand the Include object in a read-only dialog by clicking the plus symbol on the left edge.

Resolving :INCLUDE Statements

To copy the contents from the Include object to the script editor, click Resolve Include.

A comment will denote that the code came from the contents of the Include object. Any future changes to the Include object will have no effect here. Any changes you make in the script editor will have no effect on the Include object.

See also: