SQL Programming Manual for TAL

Dynamic NonStop SQL Operations
HP NonStop SQL Programming Manual for TAL527887-001
7-18
Dynamically Allocating Memory
Initializing EYE^CATCHER and IND^PTR
When you allocate the SQLDA, you must explicitly initialize the EYE^CATCHER and
IND^PTR fields. You must initialize IND^PTR even if your program is not using
indicator variables to handle null values.
Your program must initialize the EYE^CATCHER field in the SQLDA. TAL provides the
SQLDA^EYE^CATCHER literal declaration, which you use as follows:
sqlda^name.EYE^CATCHER ':=' SQLDA^EYE^CATCHER;
where sqlda^name is the SQLDA in your program.
You must also initialize the IND^PTR field for each SQLVAR entry. This example shows
a recommended literal for initializing IND^PTR -- a 32-bit address that is guaranteed
invalid. When you use this literal, it is equivalent to initializing IND^PTR to null:
LITERAL NULL^ADDR = %HFFFC0000%D;
...
FOR i := 0 TO isqlda^ptr.num^entries - 1 DO
isqlda^ptr.sqlvar[i].IND^PTR := NULL^ADDR;
The ALLOCATE^SQLDA procedure, which will also be called to allocate the output
SQLDA, could contain code like that shown in Figure 7-2
. This procedure also
initializes the EYE^CATCHER and IND^PTR fields.