Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Calling the initialization routine for a user-defined statement

&pagelevel(3)&pagelevel

If EDT is to call the statement routine of a user-defined statement using the V17
format of the interface, the developer of the statement routine must also provide an initialization routine.

The name of the initialization routine's entry point is formed from the name of the statement

routine plus the appended string @I.

Example


Entry point for the statement routine:

SELECT

Entry point for the associated initialization routine:

SELECT@I

The initialization routine must be located in the same module as the statement routine, i.e. when the statement routine is loaded, the initialization routine must also be loaded.

In the initialization routine, the user is able to define the character set in which the buffer is to be coded when the statement routine is called (in the EGLCCSN field in control block EDTGLCB). If the user leaves EGLCCSN empty (blanks or binary zeros), EDT assumes that the character set is UTFE.
In addition, the initialization routine can perform specific initialization operations for the statement routine. The initialization routine can use the functions of the IEDTGLE interface. The same restrictions as for statement routines apply.
The initialization routine is always called for a statement routine when the statement routine is loaded or its address is located. In this case, each entry point is considered to be a separate statement routine (even if multiple entry points designate the same location in the code).

  • If no fixed entry point is specified in the @USE statement (* is specified as the entry point), then the name of the entry point is not formed until entry of the user-defined statement. The initialization routine is then called on every user statement call with this entry point. As a result, an initialization routine for this type of statement must be written in such a way that it can handle multiple calls.

  • If a fixed entry point is specified in the @USE statement, then the statement routine is loaded on the @USE statement and the initialization routine is called immediately afterwards. Usually this only occurs once. However, if the user symbol has been assigned to another statement routine in the meantime then the initialization routine is also called again when the call to the first statement routine is repeated, and this irrespectively of whether or not the first statement routine had to be reloaded.

If the developer has not defined an initialization routine then the statement routine is called with version 1 of the EDTGLCB control block (V16 format). In this case, the COMMAND buffer is always coded in the UTFE character set.

On entry into the initialization routine, the registers are loaded as follows:

Register

Data area

(R1)
(R13)
(R14)
(R15)

A (PARAMETERLIST)
A (SAVEAREA)
A (RETURN)
V (ENTRY)

For an explanation of the register contents, see section “Calling EDT”.

EDT calls the initialization routine with the following parameter list:

Parameter list        :     A(EDTGLCB)

The EDTGLCB control block is supplied by EDT and is already initialized. The control block may no longer be used once the initialization routine is exited. The initialization routine is called with version 2 of the control block.

Call parameter

Return parameter

Values supplied by EDT before the external
initialization routine is called

Can be supplied with values by the initialization
routine and are evaluated by EDT
after return

EDTGLCB: 

EGLUNIT
EGLVERS
EGLUSR1
EGLUSR2

EDTGLCB: 

EGLRETC
EGLUSR2
EGLCCSN
EGLINDB

Return codes for initialization routines

The return codes must be set by the initialization routine and are evaluated by EDT.

EGLMRET

EGLSR1

Meaning

EUPRETOK

00

No error

EUPVEERR00Version not supported by the initialization routine; the
userdefined statement is rejected with the message EDT5470.
EUPRTERR00Other errors. The user-defined statement is rejected with
the message EDT5471.

Following the return from the initialization routine, EDT evaluates the EGLCCSN field. Each time the associated statement routine is called, the COMMAND buffer is coded in this character set. The character set declared in the initialization routine simply defines the character set with which the buffer is passed to the statement routine. When EDT interfaces are called by the statement routine, the caller can of course specify another character set by overwriting the EGLCCSN field. However, this operation has no impact on subsequent statement routine calls but only applies locally for the called IEDTGLE interface.

The statement routine calls are performed using version 2 of the EDTGLCB control block.

The EGLCOMP flag in the EGLINDB indicator byte is also evaluated after the return from the initialization routine. If the initialization routine has set this field then a statement filter (see section “Special application as statement filter”) always receives the statement to be filtered in uppercase characters. If the field is not set then the statement is passed in uppercase or upper/lowercase depending on the @PAR LOW setting.

If EDT V16.6B or EDT V17.0A is running in compatibility mode then the initialization routine is not called. The statement routine call is performed using version 1 of the EDTGLCB control block.

A statement routine that is intended to run in both Unicode mode and in compatibility mode or with EDT V16.6B must query the version (EGLVERS) of the control block passed by EDT and react accordingly.