CL Command (Close User Session)

This document covers the following topics:


Function and Use

The CL command is used to terminate a user session. It is recommended that all user programs issue a CL command when database processing is complete.

A CL command results in:

  • An implicit ET command (ET logic users only);

  • The storing of user data in an Adabas system file (optional);

  • The physical writing of the current data protection block to the Adabas data protection log and WORK container;

  • The release of all records currently in hold status for the user, and the release of all Command ID entries (and corresponding ISN lists) assigned to the user;

  • The transfer of the user's data from the Adabas WORK container to an Adabas system file. This is done only if a USERID was provided with the OP command; otherwise, any user data stored in the user–data system file (written by an ET command) during the session is not retained.

graphics/cl_1.png

CL Command, Procedure Flow

graphics/cl_2.png

CL Command, Procedure Flow (continued)

Control Block

Field Format  
Call Type B F/U
Reserved (internal use)   -/-
Command Code A F/U
Command ID B -/A
File Number B F/U (1)
Response Code B F/A (1)
Record Buffer Length (ACB only) B $ F/U
Command Option 2 A F/U
Additions 2 A,B -/A
Command Time B -/A
User Area   F/U

Buffer Areas

Buffer  
Format Buffer $ */–
Record Buffer $ F/U
Search Buffer –/–
Value Buffer –/–
ISN Buffer –/–
Formats:
A alphanumeric
B binary
x/y before/after Adabas call - x and y can take the values:
A Filled in by Adabas
F To be filled in by User
U Unchanged after Adabas call
- Not used
* Not used but must be included in parameter list of CALL statement
$ Only used if user data to be stored

(1) The meaning of this field depends on the value specified for "Call Type". See Calling Adabas, The Control Block for details.

Control Block

Command Code

CL

Command ID

If ET commands have been issued during the user session, Adabas will return the transaction sequence number of the user's last successfully executed transaction in this field. The number is provided in binary format.

If no ET command has been successfully executed during this session, this field is set to 0.

Response Code

Adabas returns the response code for the command in this field. Response code 0 indicates that the command was executed successfully.

Record Buffer Length (ACB only)

If user data is to be stored in an Adabas system file, the length of the record buffer must be specified in this field. The length specified determines the number of bytes of user data to be stored.

The maximum length which may be specified is 2000 bytes.

If no user data is to be stored, this field is not used.

Command Option 2

An 'E' in this field indicates that user data provided in the record buffer is to be stored in an Adabas system file.

Additions 2

For some response codes, Adabas returns detailed information in this field. See Adabas Messages and Codes for further information.

Record Buffer

The user data which is to be stored is provided in this buffer. The number of bytes actually stored is determined by the value specified in the record buffer length field. The data will be retained only if the user has issued an OP command in which a non-blank USERID was provided. If so, the data will be retained until the user issues the next ET or CL command in which user data is provided. If a non-blank USERID was not provided, the data cannot be retrieved in a subsequent session.

The user data can be in any format and Adabas performs no conversion on it.

Examples

Example 1:

The user program has completed all database activity and issues the CL command. No user data is to be stored.

Control Block:

Command Code          CL
Command Option 2      b (no user data is to be stored)

Example 2:

The user program issues a CL command and provides user data to be stored in an Adabas system file.

Control Block:

Command Code          CL
Record Buffer Length  17 (17 bytes of user data to be stored)
Command Option 2      E (user data is to be stored)

Buffer Areas:

Record Buffer         USER 7 NORMAL END