Defining a Subnetwork

#### Search Results

Search

# Defining a Subnetwork

The job type `NET` (subnetwork) allows you to define a whole network as a job. The subnetwork must already be defined. It must have an input condition `NET-BEGIN` and an output condition `NET-END` as illustrated in the following example:

The same subnetwork can be defined in different jobs of the main network.

The subnetwork can be activated together with the calling network (or job of the type `NET`) or at the moment the job of the type `NET` is started.

On activation, each active subnetwork is assigned a unique run number.

This document covers the following topics:

- Link to the Main Network

- Subnetwork Activation and Execution

- Restrictions for Subnetworks

- Adding or Modifying a Subnetwork Definition

- Listing Jobs of a Subnetwork

## Link to the Main Network

The following reserved conditions are used to link a subnetwork to a main network and control the connection between the calling `NET` job and the subnetwork called.

Reserved Condition | Description
--- | ---
`NET-BEGIN` | You must specify `NET-BEGIN` to start the subnetwork and run the first job of the subnetwork.
`NET-END` | You must specify `NET-END` to run the last job of the subnetwork and indicate the end of the subnetwork.
`NET-END-NOTOK` | This condition is optional. If specified and fulfilled during subnetwork termination, the job is treated as ended `not ok`. If `NET-END-NOTOK` is specified in the subnetwork but `NET-END` is missing, the status of the `NET` job changes to `Sub-NW executing - error indicated`. In this case, the global message `Job ended not ok` is sent if the corresponding option is enabled in the Global Messages for Events settings (see the Administration documentation). If `NET-END-NOTOK` is reset in the subnetwork, the status of the `NET` job changes back to `Subnetwork executing`. In this case, the global message mentioned above is sent again.
`NET-END-OK` | This condition is optional. If specified at least once in your subnetwork and fulfilled during subnetwork termination, the `NET` job (that is, the whole subnetwork) is treated as `ended ok`. This has an impact on the release of resources, which are allocated on the network level. You can force the resource release by setting this condition. See also the deallocation mode set in the prerequisite resource definition.

### Notes on Subnetwork Usage

1. If the condition `NET-END-NOTOK` is found together with `NET-END`, the calling job is set to the status `not ok`.

2. Jobs of the type `NET` can use all kinds of prerequisite checks and can have all kinds of End-of-Job actions.

3. The scheduling parameters of a job of the type `NET` are passed on to the subnetwork. See the section Scheduling a Job.

4. The calling job of a subnetwork (job of type `NET`) should have an own symbol table definition.

5. You can also define specials for jobs of the type `NET` by pressing PF6 (Spec) on the job definition screen.

## Subnetwork Activation and Execution

A subnetwork is activated together with the main network. The subnetwork is assigned its own run numbers.

If the calling job of the type `NET` (subnetwork) becomes a temporary dummy job due to any reason, no subnetwork activation is performed (if the subnetwork was not activated already).

Reserved symbols pass information to the jobs of the subnetwork about which job invoked the subnetwork. These symbols are described in Predefined Symbols for Subnetworks and Recovery Jobs in the section Symbol Table and Symbol Maintenance.

If the subnetwork has a standard symbol table, these values are entered as symbols in the active copy of this table.

This enables you to trace, even through several steps, from where the subnetwork was invoked.

If the job of the type `NET` can be activated (satisfies all input conditions), the condition `NET-BEGIN` of the subnetwork is set and the subnetwork starts to work: the `NET` job is then executing. It remains in this status until the subnetwork has set the condition `NET-END`. Only at this point are the End-of-Job checking and actions performed which are defined in the invoking network.

If an execution error occurs in the subnetwork, the execution of the invoking network is also blocked. If the subnetwork sets the condition `NET-END` before its actual termination (or at its very start), the invoking network continues to run, and a parallel asynchronous execution of the networks is possible. However, the user him/herself then becomes responsible for later synchronizing the subnetwork with the invoking network.

This section covers the following topics:

### Time of Activation of a Subnetwork

Subnetworks can be activated at two different times:

- #### After the activation time of the calling network

  The subnetwork is always activated (i.e., with the job type `NET`) after the calling network has been activated. The time discrepancy depends on the Monitor activation cycle. The subnetwork will be available from this point in time with run number and active JCL. This is the default.

- #### At the start time (submission) of the calling job of the type NET

  The subnetwork is only activated if the calling job of the type `NET` is really started. This can prevent a subnetwork from even being activated if the calling job is not executed at all later on. Moreover, the effort for job activations and loading the JCL is thus compensated for, and the waiting-time for prerequisites within the subnetwork is shorter.

The subnetwork activation mode can be defined as follows:

- As a global default value (see Subnetwork Activation Mode in Default Setting (2) in the Administration documentation).

- In the definition of the calling job of the type `NET` (see Subnet Activation Mode).

### Symbol Table Activation for Subnetworks

The order of symbol table activation for subnetworks is:

1. Set caller info into the active table (`P-C-`... symbols).

2. Activate symbol table(s).

3. Perform symbol modification exit.

The order of symbol table activation for subnetworks is the same as for main networks.

## Restrictions for Subnetworks

This section covers the following topics:

- Recursion Checking

- Maximum Nesting Level

### Recursion Checking

Subnetworks can in turn be invoked within subnetworks; however, a subnetwork must not invoke itself directly or indirectly in a circle because this would cause an infinite recursion.

The definition of a network as its own subnetwork is prohibited. If this is attempted, error messages such as the following are issued:

- `Recursive Subnetwork Definition prohibited`

- `Max. Subnetwork Level :1: reached`

### Maximum Nesting Level

The maximal supported nesting level for subnetworks is 20.

## Adding or Modifying a Subnetwork Definition

To define a subnetwork

1. Choose PF8 (Net) in the Job Definition (Master) window.

   A Job: Subnetwork Definition window like the example below opens:

        +----------------------------------------------------------------------------+
        !                                                                            !
        !                      Job: Subnetwork Definition                            !
        !                                                                            !
        !  Owner SAGTEST     Network SAGNET      Job JOB-SUBNET  Run                 !
        !                                                                            !
        !  Description        ==> Subnetwork Job of Type NET                         !
        !  JCL Node           ==> _____                                              !
        !                                                                            !
        !  Subnetwork Owner   ==> SAGTEST___    Use Subnetwork Time Frames  ==> N    !
        !  Subnetwork Name    ==> SAGNET2___    Subnet Activation Mode      ==> D    !
        !  Subnetwork Version ==> __________    Append Mult. Suffix         ==> N    !
        !  Subnetwork Run     ==>                                                    !
        !                                                                            !
        !  Subnetwork Input  Condition ==> NET-BEGIN                                 !
        !  Subnetwork Output Condition ==> NET-END                                   !
        !                                                                            !
        ! Enter-PF1--------PF3--------PF5----------------------------------------    !
        !       Help       End        Save                                           !
        +----------------------------------------------------------------------------+
         ! Enter-PF1---PF2--PF3--PF4---PF5---PF6---PF7---PF8---PF9---------PF12-  !
         !       Help  Add  End  Edit  Save  Spec  Symb  Net   JCL         Menu   !
         +------------------------------------------------------------------------+

       Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
             Help  Add   End         Save        Up    Down                    Menu

2. Enter the required values. The input fields provided in the window are described in Fields: Job Type Specific Execution Features.

3. When you are finished, choose PF5.

## Listing Jobs of a Subnetwork

If a master job has the type `NET`, and if the subnetwork is defined properly, you can invoke the master job list of the defined subnetwork directly.

If the subnetwork was not defined yet, the subnetwork definition screen is invoked instead.

To list jobs of a subnetwork

1. On a Job Maintenance screen, type `Z` (Subnet) in the line command input field next to a job of the type `NET`.

   The name of the job owner and the subnetwork defined for the job are indicated in the File or Library column.

2. Press ENTER.

   The jobs of the subnetwork defined for the selected `NET` job (here: `SAGNETSUB1`) are now listed on the Job Maintenance screen, as shown in the following example:

        17-12-12                ***** Entire Operations *****                13:24:15
        Job Maintenance         Owner SAGTEST    Network SAGNETSUB1 Version
        ------------------------------------------------------------------------------
        Cmd C R PU Job       Type Loc Description           File or Library   Member
                   *--------- ---
        _          JOB-1      JOB NAT Where it all starts   SYSEORU           B60-M01
        _   C1     SUBNETJOB2 NET     Subnetwork Job for Su SAGTEST/SAGNETSUB (D)

        ******************************* Bottom of Data *******************************
        A Dep. B Browse C Copy D Del. E Edit G Pregen. I Input Cond. J JCL L Resources
        M Mod. O EOJ Chk + Act P Prose R Activate S Sched.Parms U Ext.Log Z Subnet
        Command => ____________________________________________________________

       Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
             Help  Add   End         Save        Up    Down                    Menu

   Note
   If you leave the subnetwork job list with PF3, you return to the calling network list.

### On this page

- Link to the Main Network
- Subnetwork Activation and Execution
- Restrictions for Subnetworks
- Adding or Modifying a Subnetwork Definition
- Listing Jobs of a Subnetwork