Includes (JOBI)

{"URL":["/*.*/awa/pa_view_JOBI"],"heroDescriptionIdentifier":"ice_JOBI_intro","customCards":[{"id":"ice_jobi_def_and_conf","title":"Defining Include Objects","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/AWA/Objects/obj_include.htm","languages":["en-us"]},{"id":"ice_ConfigIncludeForExternalInterpreters","title":"Configuring Include Objects for External Interpreter Calls","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/AWA/Objects/obj_include.htm","languages":["en-us"]},{"id":"ice_jobi_using_in_trailers_and_headers","title":"Include Objects in Headers and Trailers","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/AWA/Objects/obj_JobUsingIncludes.htm","languages":["en-us"]},{"id":"ice_jobis_list","title":"List of Header and Trailer Includes with User Includes","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/AWA/Objects/obj_JobUsingIncludes.htm","languages":["en-us"]},{"id":"ice_scripting_and_the_ae_scripting_language","title":"The Automation Engine Scripting Language","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/AE_Scripting_Language.htm","languages":["en-us"]},{"id":"ice_script_processing","title":"Script Processing","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/Script_Processing_Order.htm","languages":["en-us"]},{"id":"ice_writing_scripts","title":"Writing Scripts","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/Script_Writing.htm","languages":["en-us"]},{"id":"ice_working_with_script_editor","title":"Working with the Script Editor","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/obj_Wkg_ScriptEditor.htm","languages":["en-us"]},{"id":"ice_arithmetic_calculations_in_scripts","title":"Calculations","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/Script_Arithmetics.htm","languages":["en-us"]},{"id":"ice_script_elements_for_editing_strings","title":"Editing Strings","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Reference/Overview/Strings_Script.htm","languages":["en-us"]},{"id":"ice_error_handling_in_scripts","title":"Error Handling","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/Script_Error_Handling.htm","languages":["en-us"]},{"id":"ice_reusing_script_components","title":"Reusing Scripts","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Writing/Script_Reuse.htm","languages":["en-us"]},{"id":"ice_ae_script_reference","title":"Automation Engine Script Reference","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/Script/Reference.htm","languages":["en-us"]},{"id":"ice_working_with_objects","title":"Working with Objects","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/AWA/Objects/obj_WorkingWithOverview.htm","languages":["en-us"]},{"id":"ice_AWIs_CommonFunctions","title":"Common Functions","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/_Common/CommonFunctions/CF_OverviewOfChapter.htm","languages":["en-us"]},{"id":"ice_UnderstandingPA","title":"Understanding the Process Assembly Perspective","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/AWA/Objects/ProcessAssembly.htm","languages":["en-us"]},{"id":"ice_Overview_AWI","title":"Understanding the User Interface","type":"customize","url":"https://docs.automic.com/documentation/webhelp/english/ALL/components/DOCU/*.*/Automic%20Automation%20Guides/Content/_Common/GettingStarted/GS_OverviewAWI.htm","languages":["en-us"]}]}

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

This page includes the following:

Defining Include Objects

  1. In the Process Assembly perspective click Add Object. On the Add Object dialog, select Include (JOBI). For information on how to add objects, see Adding Objects

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

    Note: You can also create Period objects directly from the Using AWI Combo Boxes that serve to select objects.

  2. On the Object Name dialog enter the name of the new object. Choose it carefully. For more information, see Best Practices: Naming Conventions.

  3. Click OK to open the object definition pages.

  4. Write the block of code on the Process page.

    Important!

    • 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 up to 16 Includes within Includes.

    • JCL in Include Objects

      You can use Job Control Language (JCL) lines if the Include object is inserted in a Job.

    See also Include (JOBI) Objects in Headers and Trailers.

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.

Examples

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: