Software AG Products 2.4.1 | Reference Guide | Execution Commands | Detailed Syntax | @OPEN
 
@OPEN
The @OPEN command indicates the beginning of a user session. Issue this command at the beginning of the program. Otherwise, issue the @MODE command.
syntax of open
@OPEN does not require the nnnn specification, and must be followed by a space separating the command from the file names of the Adabas files that are to be accessed by the program.
For example, the following program accesses files EMPLOYEES and VEHICLES. Adabas Pre-Compiler automatically adds the file number of the system file which is accessed by its response code interpretation routine to the file list.
@OPEN EMPLOYEES, VEHICLES.
The @OPEN command may be omitted, in which case the program automatically becomes an ET mode program with all restrictions of that mode, unless @MODE is issued). If the program updates any file, specify that file should in the @OPEN command.
Two types of update programs exist:
1. EXCLUSIVE MODE update programs are programs that have exclusive use of the selected files. Thus, during execution time other programs cannot update these files. This approach is used for batch updates.
2. ET MODE update programs are programs that update files in parallel with other programs updating the same files. Using this mode requires an @END TRANSACTION command at the end of each logical transaction. This mode is used for online update programs. It also requires a HOLD of the record before updating.
Thus, after the list of files to be accessed, one or more of the following possibilities may be specified:
1. UPD= and a list of files for ET mode. In this case, check the response code after each execution command for Response-code=9, which means that an automatic backout has occurred and the program should start the transaction from the beginning.
2. EXU= and a list of files, for Exclusive mode. In Exclusive mode, Adabas Pre-Compiler automatically generates code for switching the application from EXU to ET mode when running under a test database. This code is activated by the identifier OPENTYPE which is declared by Adabas Pre-Compiler, containing the value EXUET. This value is inserted by a special module that verifies the DBID during execution time, or by another user technique.
In order to inhibit the automatic switching option, use either of the following parameters:
*DEBUG - automatically generates code for executing an Exclusive mode program in ET mode. This option allows the user to code the program in the Exclusive mode. In the debug phase, Adabas Pre-Compiler holds the record before updating and generating ET commands when necessary. When the debug phase is done, remove the DEBUG parameter so application becomes an Exclusive mode program.
*NODEBUG - causes Adabas Pre-Compiler to generate code only for Exclusive mode, without any ET commands and inhibits the option of dynamically switching to ET mode. This option is useful for applications that do not require the Exclusive/ET conversion and always run in Exclusive mode.
The RESTRICTED keyword allows to restrict the access/update to only those files defined by the @OPEN command. Adabas returns Response code 17 when trying to access/update another file.
The ACODE and WCODE parameters are used to specify the encoding code relevant to the session if different from the default encoding set in the Adabas nucleus. The num in the ACODE parameter represents the encoding key to be used for alphanumeric fields defined with A format. The num in the WCODE parameter represents the encoding key to be used for alphanumeric fields defined as Unicode fields with format W.
The following parameters may be used to change default limits for the current user only on Mainframe:
Parameter
Description
MAXHOLD
The maximum number of held ISNs allowed for the user. If not specified, the default is calculated by Adabas according to the nucleus parameters.
MAXCID
The maximum number of command IDs that are active for the user at the same time. The default is 20.
MAXISN
The maximum number of ISNs that are stored in the internal ISN element table used for the GETNEXT option. The default is 20.
MAXTIME
The maximum time in seconds permitted for the execution of @FIND commands. The default is 300 seconds. You may also use the MAXTIME parameter of the @FIND command.
TT
The transaction time limit for the user in seconds.
TNA
The non-activity time limit for the user in seconds.
If a user requires to store or retrieve ET-DATA, the USERDATA parameter is used. This parameter is relevant for ET users who wish to retrieve ET-DATA stored in the system file, or to store new ET-DATA. The user must provide an eight-characters user ID. The ET-DATA is returned to and transmitted from the RECORD-BUFOPN field, which is 500 bytes long. To change the length, use the @OPTIONS statement. If the user ID is stored in an identifier, use the PUSERID parameter instead.
The @OPEN command must not be issued by modules called from the main program. Therefore, the @OPEN command issued by the main program should include all files, accessed or updated by the called modules. The running mode in the modules must, therefore, be issued in the @MODE command.
Examples:
The following program accesses file EMPLOYEES and updates exclusively the VEHICLES file. It also applies the Exclusive/ET dynamically exchange according to the OPENTYPE identifier.
@OPEN EMPLOYEES,EXU=VEHICLES.
The following program does not require the dynamic Exclusive/ET exchange and will always run in Exclusive mode.
@OPEN EMPLOYEES, EXU=VEHICLES NODEBUG.
The following program is written in the Exclusive mode for the VEHICLES file. Adabas Pre-Compiler generates code for running it under ET mode.
@OPEN EMPLOYEES, EXU=VEHICLES DEBUG.
The following program accesses file EMPLOYEES and updates the VEHICLES file in ET mode, meaning that other programs updating the same file may run in parallel.
@OPEN EMPLOYEES, UPD=VEHICLES.