Defining a Subnetwork

#### Search Results

Search

# Defining a Subnetwork

The job type Subnetwork (`NET`) 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.

## 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 Subnetwork (`NET`) 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 Defaults for Network Options in the Administration documentation).

- In the definition of the calling job of the type `NET` (see 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 display or modify a subnetwork definition

1. From a Job Master node in the object workspace, select a job of the type Subnetwork (`NET`), and choose Display or Open from the context menu.

   Or:
   From the table in a Job Master List window, select a job of the Type `NET`, and choose Display or Open from the context menu.

   A Maintenance Job Master window opens.

2. Open the tabbed page Subnet.

   The fields on the page are described in Fields: Job Type Specific Execution Features.

To add a subnetwork definition

1. From the Job Master window, select Subnetwork from the Job type drop-down list box.

   The tab Subnet appears.

2. Open the tabbed page Subnet like the example below:

3. Make your definitions. The input fields available on the page are described in Fields: Job Type Specific Execution Features.

4. Choose OK when you are finished.

## 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 the jobs of a subnetwork

- From a Job Master or Job Active node, select a job of the type Subnetwork (`NET`), and choose Zoom Subnetwork from the context menu.

  Or:
  From the table in a Job Master List or an Active Job List window, select a job of the Type `NET`, and choose Zoom Subnetwork from the context menu.

  The jobs of the subnetwork defined for the selected `NET` job are listed in a (separate) Job Master List or Active Job List window, as shown in the following example:

### 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