SQL/MP Programming Manual for COBOL
Memory Considerations
HP NonStop SQL/MP Programming Manual for COBOL—529758-003
B-6
Guidelines for Memory Use
Do not count these SQL statements and directives: 
BEGIN DECLARE SECTION and END DECLARE SECTION 
CONTROL EXECUTOR, CONTROL QUERY, and CONTROL TABLE 
DECLARE CURSOR 
INVOKE 
WHENEVER 
Guidelines for Memory Use
The system allocates real memory in 16 KB pages. If an SQL statement uses only part 
of a page, the system allocates the entire page. Therefore, the real memory used by 
embedded SQL statements can be larger than the figures shown under Memory 
Requirements on page B-5. 
A program can encounter memory problems in these situations: 
The program contains a large number of embedded SQL statements. 
The program runs on a system with limited memory (for example, 16 MB or less). 
The program runs in a CPU that is also running a large number of other programs. 
To reduce the memory use in an extended data segment, follow these guidelines: 
Declare only the host variables that your program actually requires. 
Declare all host variables in one Declare Section. The system then allocates the 
host variables contiguously in one or more pages, rather than allocating each host 
variable in a separate page. 
Execute SQL statements in listing order as often as possible. Therefore, the SQL 
statements can share many of the pages in the extended data segment.
As a last measure, use dynamic SQL statements. Using dynamic SQL statements 
can reduce memory use. However, it can also degrade a program’s performance 
because of the additional SQL run-time compilations.
ALTER
BEGIN WORK
CLOSE
COMMENT
CREATE
DELETE
DESCRIBE
DESCRIBE INPUT
DROP
END WORK
EXECUTE 
EXECUTE IMMEDIATE
FETCH
FREE RESOURCES
GET VERSION
HELP TEXT 
INSERT 
LOCK TABLE
OPEN
RELEASE
ROLLBACK WORK 
SELECT
UNLOCK TABLE
UPDATE
UPDATE STATISTICS










