NATRJE Utility - Natural Remote Job Entry

#### Search Results

Search

# NATRJE Utility - Natural Remote Job Entry

The NATRJE utility (Natural Remote Job Entry) can be used to submit JCL cards from a Natural program to the operating system for scheduling and execution. For example, it is possible to start a Natural batch job with NATRJE.

The NATRJE Utility - Natural Remote Job Entry documentation covers the following topics:

- General Information on NATRJE

- Calling NATRJE from a Natural Program

- NATRJE Return Codes

#### Related Topic:

- NREXPG - User Exit for NATRJE in the Operations documentation

## General Information on NATRJE

The following graphic is a simplified functional diagram of the NATRJE utility:

### Legend

| The Natural program calls the NATRJE utility for the purpose of submitting JCL cards to be executed by the operating system.
| NATRJE collects the JCL cards into the RJE buffer until the Natural program indicates that the job is complete. The RJE buffer holds the JCL cards before they are submitted. The initial size of the RJE buffer is determined by the `RJESIZE` profile parameter (as described in the Parameter Reference documentation). If a given job does not fit into the RJE buffer, the buffer is automatically enlarged. The maximum size of a job is determined by the thread or region size.
| NATRJE transfers the JCL cards to the operating system internal job queue for scheduling and execution by the operating system.

## Calling NATRJE from a Natural Program

This section covers the following topics:

- Invoking NATRJE

- Example Programs

### Invoking NATRJE

To invoke the NATRJE utility

- In the Natural program that invokes the NATRJE utility, specify a `CALL` statement by using the following syntax:

  `CALL 'NATRJE' parm1 parm2 parm3 parm4`

  The parameters specified in the `CALL` statement are explained in the following table:

  Parameter | Explanation
  --- | ---
  `parm1` | The starting JCL card of the table which contains one or more 80-character JCL cards to be submitted.
  `parm2` | A 4-byte binary field which contains the number of 80-character JCL cards to be submitted.
  `parm3` |
  A 1-byte alphanumeric field used to indicate if all JCL cards have been submitted:
  `' '` | Not the last call for the current job. A further JCL card follows with the next `CALL` statement. The JCL cards are collected into the RJE buffer.
  `B` | Last call for the current job. Under z/OS (batch and TSO, IMS TM and CICS): The job is written to the internal reader data set but not submitted. If function `L` (see below) is called subsequently, the internal reader is closed and the job(s) are submitted. In addition, the internal reader is closed and the job is submitted either on a screen I/O (IMS TM) or during session termination (z/OS batch, TSO and IMS TM).
  `C` | Flush the current job. The job is not submitted to the system.
  `L` | Last call for the current job. The job is submitted to the system.
  `parm4` | A 2-byte binary field in which NATRJE returns a response code.

### Example Programs

This section provides Natural example programs that submit JCL cards:

- Example Program

#### Example Program

The following is a Natural example program that submits, in one call to NATRJE, a three-card JCL stream.

    DEFINE DATA LOCAL
       01 COUNT  (B4)
       01 FLAG   (A1)
       01 RETHEX (B2
       01 CARDS  (A240
       01 REDEFINE CARDS
          02 CARD1 (A80)
          02 CARD2 (A80)
          02 CARD3 (A80)
      END-DEFINE
      MOVE '//JOBN JOB CLASS=G,MSGCLASS=X' TO CARD1
      MOVE '//XXX EXEC PGM=IEFBR14' TO CARD2
      MOVE '//DD1 DD DSN=NATRJE.SOURCE,DISP=SHR' TO CARD3
      MOVE 3 TO COUNT
      MOVE 'L' TO FLAG
      CALL 'NATRJE' CARDS COUNT FLAG RETHEX
      IF RETHEX = H'0000'
        WRITE 'JOB submitted successfully'
      ELSE
        WRITE 'ERROR from NATRJE' RETHEX
      END-IF
      END

## NATRJE Return Codes

A Natural program that issues a `CALL` statement to NATRJE results in one of the following return codes being returned in the fourth parameter of the statement. There are return codes that apply to all environments and additional codes that are dependent on the operating system:

- Return Codes

- Additional Return Codes for CICS

### Return Codes

Return Code/Hexadecimal | Return Code/Decimal | Explanation
--- | --- | ---
00 | 00 | Normal return.
04 | 04 | NATRJE utility not available.
08 | 08 | NATRJE utility disabled; a possible reason is that the `RJESIZE` profile parameter is set to `0` (see also the Parameter Reference documentation).
0C | 12 | Invalid number of JCL cards.
10 | 16 | Invalid function code.
14 | 20 | No RJE buffer space available.
18 | 24 | Invalid number of parameters.
1C | 28 | I/O error during submit.
20 | 32 | Job flushed by user exit NREXPG (see NREXPG - User Exit for NATRJE in the Operations documentation).

### Additional Return Codes for CICS

Return Code | Explanation
--- | ---
01nn | CICS WRITEQ TD failure; nn is the CICS response code in hexadecimal format.
01nn | CICS CLOSE TD failure; nn is the CICS response code in hexadecimal format.

### On this page

- General Information on NATRJE
- Calling NATRJE from a Natural Program
- NATRJE Return Codes