Writing a Navigational DML Program › Housekeeping Statements › BIND RUN-UNIT Statement
BIND RUN-UNIT Statement
The first database function executed within your program must be a BIND RUN-UNIT in order to establish a session with the DBMS. You can code this in one of two ways:
- By coding a BIND RUN-UNIT statement.
- By coding a COPY IDMS SUBSCHEMA-BINDS statement.
The COPY IDMS SUBSCHEMA-BINDS causes the precompiler to generate the BIND RUN-UNIT statement followed by BIND RECORD statements for every subschema record whose description is included in the program.
In deciding which statement to use, consider the following:
- If coding the BIND RUN-UNIT statement explicitly, you should first move the name of the program to the PROGRAM-NAME field within the IDMS communications block. The precompiler does this for you if you are using COPY IDMS SUBSCHEMA-BINDS.
- COPY IDMS SUBSCHEMA-BINDS should only be used if an autostatus protocol is in effect since otherwise error checking is not performed after each of the generated DML statements.
- Optional clauses on the BIND RUN-UNIT statement allow the specification of the target database to access, the subschema to use, and the dictionary from which to load the subschema. These options are not available when using COPY IDMS SUBSCHEMA-BINDS.
The following COBOL example binds a run unit to the EMPDEMO database:
MOVE 'MYPROG' TO PROGRAM-NAME.
BIND RUN-UNIT DBNAME 'EMPDEMO'.
PERFORM IDMS-STATUS.
If your program serially initiates and terminates multiple run units, you should re-initialize the ERROR-STATUS field to '1400' before starting each subsequent run unit.
Copyright © 2013 CA.
All rights reserved.
|
|