OUT (Write a Data Area)

Free-Form Syntax OUT{(E)} {*LOCK} data-area-name
Code Factor 1 Factor 2 Result Field Indicators
OUT (E) *LOCK data-area-name   _ ER _
The OUT operation updates the data area specified in the data-area-name operand. To specify a data area as the data-area-name operand of an OUT operation, you must ensure two things:

You can specify the optional reserved word *LOCK. When *LOCK is specified, the data area remains locked after it is updated. When *LOCK is not specified, the data area is unlocked after it is updated.

*LOCK cannot be specified when the data-area-name operand is the name of the local data area or the Program Initialization Parameters (PIP) data area.

The data-area-name operand must be either the name of the data area or the reserved word *DTAARA. When *DTAARA is specified, all data areas defined in the program are updated. If an error occurs when one or more data areas are updated (for example, if you specify an OUT operation to a data area that has not been locked by the program), an error occurs on the OUT operation and the RPG IV exception/error handling routine receives control. If a message is issued to the requester, the message identifies the data area in error.

To handle OUT exceptions (program status codes 401-421, 431, or 432), either the operation code extender 'E' or an error indicator ER can be specified, but not both. For more information on error handling, see Program Exception/Errors.

Positions 71-72 and 75-76 must be blank.

For further rules for the OUT operation, see Data-Area Operations.

See Figure 1 for an example of the OUT operation.