SQL Programming Manual for Pascal

Program Compilation and Execution
HP NonStop SQL Programming Manual for Pascal528614-001
5-32
Estimating Memory Use
Before issuing the RUN command, you can specify TACL DEFINE commands that
apply to SQL statements in the program. You can create, modify, delete, and display
DEFINEs with TACL commands or NonStop Kernel operating system procedure calls.
You can also specify the =_SORT_DEFAULTS DEFINE to control sort operations;
however, if you modify a DEFINE after SQL load time, the change has no effect on
static SQL statements.
To determine the DEFINE set with which a program was compiled, use the EXPLAIN
DEFINES option of the SQLCOMP command.
When the process begins execution, it receives your current set of DEFINE values
from the process file segment (PFS) of your TACL process, provided the DEFMODE
option is ON. If DEFMODE is OFF, TACL propagates only your =_DEFAULTS DEFINE
to the new process.
Estimating Memory Use
A program that uses embedded SQL statements and directives to access a NonStop
SQL database uses much more memory than a program that acesses an Enscribe
database. This subsection describes how to estimate the virtual memory used by
embedded SQL statements and directives in a programs extended data segment.
Some statements require no extra extended memory, but other statements generate a
run-time call to the SQL executor and do use extra memory. The SQL executor uses
extended memory to run and the memory shown below for parameters and data
structures.
These structures are shared by all SQL statements and directives in a program:
Use Table 5-1
to estimate the number of bytes used by each embedded SQL
statement and directive in the extended data segment.
When you use this table:
Bytes Structure Description
430 SQLCA Count once if you specify INCLUDE SQLCA
838 SQLSA Count once if you specify INCLUDE SQLSA
Table 5-1. Calculating Virtual Memory Requirements
Bytes Required Description of SQL Statement
72 Base value for a statement with no host variables
+ 4 + (24 * number of input host
variables)
Required for a statement with input host variables
+ 4 + (24 * number of output host
variables)
Required for a statement with output host variables
+ 146 Required for a static SQL statement that uses a
cursor declared in the global area of the program