Includes (JOBI)
Use Include objects to store blocks of code that you need frequently and that you want to reuse in multiple scripts. Include objects help you ensure that your scripts are consistent. They reduce your design and maintenance efforts. You reuse those blocks of code by entering :INCLUDE or :INC in the scripts of executable objects and selecting an Include object. This inserts the Include object in the script. For information about how to use Include objects in the script editor, see Using Include Objects in Scripts.
Tips:
- Restrict the right to edit Include objects if these objects are used in different tasks by different users
- For an example of how to reuse lines of code, see Reusing Script Components
Object class: Passive object
Object type/Short name: JOBI
This page includes the following:
An Include object definition is made up of the following pages:
- Standard pages that are always available, no matter what type of object you are defining:
- The Process Pages
The script you write on the Process page is the block of script lines that you can reuse by inserting it into other objects.
Important Considerations
-
Variables in Include Objects
If your Include object includes variables, the variables must be defined and initialized in the object in which the Include is inserted. Otherwise, you cannot pass the variable from the Include to the object.
-
Script Functions in Include Objects
Script functions in the Include object refer to the object in which you have inserted it
-
Nesting Include Objects
You can nest Includes within Includes up to five levels.
-
JCL in Include Objects
You can use Job Control Language (JCL) lines if the Include object is inserted in a Job. For more information, see Using Includes in Job Objects.
Configuring Include Objects for External Interpreter Calls
Client 0 includes two objects that you can use in your scripts to define external interpreters and their scripts:
REGISTER_VARIABLE.WINDOWS
REGISTER_VARIABLE.UNIX
Call these objects using the :REGISTER_VARIABLE
statement. This statement must be combined with the :BEGIN_EXT_INTERPRETERS
and :END_EXT_INTERPRETERS
statements in the Process page of the Job. Both statements are available on Windows and UNIX.
Important! Contact your administrator to configure these two objects, as their settings are available system-wide.
Default Script (Windows)
The REGISTER_VARIABLE.WINDOWS
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'
: 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
See also: