Open for Write (OW)

Command title

Open for Write

Description

This command loads into the specified TSR a copy of a specified generation of a specified table—the status of the table is opened for write.

COBOL syntax

MOVE 'OW'                   TO xxxx-COMMAND.
CALL 'TBLBASE' USING        TB-PARM
                            xxxx-COMMAND-AREA
                            [PASSWORD
                            [GENERATION]].

C syntax

memcpy( tbCommArea.tbCommand, "OW", 2 );
TBLBASE( &tbParm, &tbCommArea, pWritePassword,
         nGeneration );

Parameters

PASSWORD (OPTIONAL)—if the table has a write password then the correct write password must be supplied in the PASSWORD parameter. If the table has only a read password defined, then the write password defaults to the read password, and it must be supplied for the OW command to succeed.

GENERATION (OPTIONAL)—if an earlier generation of the table is required instead of the current generation, then the GENERATION parameter must be supplied. It may be specified as a relative generation (negative number) or an absolute generation (positive number); zero may be used to designate the current generation. If GENERATION is given, and the table has no password, a dummy PASSWORD parameter must be specified as a placeholder in the parameter list.

Explanation

The table is located by searching through a list of libraries. Refer to OR for more details on the conditions for the search through the library list.

When a table is found in a library, the table definition is retrieved, an appropriate area is allocated in the TSR, and the table is loaded into that area. Subsequent space requirements due to table expansion are satisfied from the TSR and space is limited by the TSR size.

In a multi-user environment, if you want to control the user(s) or transactions that perform updates after the OW command, place a value in the LOCK-LATCH field when using the OW command. Only the update commands, that have the same value in the LOCK-LATCH field are authorized to perform the update (see 9. LOCK-LATCH (8 bytes)).

Return value

ERROR 0003 occurs when the table is already open for write.

ERROR 0008 occurs when the table is found on a regular library but there is no matching generation number.

ERROR 0009 occurs when the table is not found.

ERROR 0030 occurs when an incorrect PASSWORD is used.

ERROR 0033 occurs when a later generation exists on the library than the one already loaded in the TSR.

ERROR 0072 occurs when the table is already open for write in another region.

ERROR 0086 occurs when an open is made on an Alternate Index and the Data Table is already opened via a link to a VTS-TSR.

Notes

  1. Only tables that have an open for write status can be stored. The OW command prevents other regions from opening the same table for write. Once the updates are made to the table and the table is stored, issuing a CL or RL command releases update control of the table so that other applications/users can open the table for write.
  2. An Alternate Index may be opened using an OW command. If any Alternate Index is opened for write, then the Data Table and all related Alternate Indexes that are currently open will also be promoted to the status of open for write. See Opening an Alternate Index.
  3. If an ST command is subsequently issued against an Alternate Index, the Data Table is stored. The primary definition that is used to build the primary Index of the Data Table is also updated on the library. The changes to the Data Table will be reflected in all open Alternate Indexes.
  4. If the table is already open for read in a TSR (local or shared) when an OW command is issued against it, the generation of the table in memory will be verified against the current generation in the library and, if it matches, the status of the table will be promoted to open for write without data being reloaded from the library. This is to ensure that no changes have been made to the table from another region. If a newer version exists in the library, the OW is rejected with ERROR set to 0033.

Exceptions

None

See also

Modify Library Search Order (ML)—for information on the library search list