Passing Dynamic Commands to ALLBASE/SQL [ ALLBASE/SQL COBOL Application Programming Guide ] MPE/iX 5.0 Documentation
ALLBASE/SQL COBOL Application Programming Guide
Passing Dynamic Commands to ALLBASE/SQL
A dynamic command is passed to ALLBASE/SQL either as a string literal or
as a host variable containing a string. It must be terminated with a
semicolon. The maximum length for such a string is 2048 bytes.
To pass a dynamic command that can be completely defined at programming
time, you can use a delimited string:
EXEC SQL
PREPARE MyCommand FROM 'UPDATE STATISTICS FOR TABLE PurchDB.Parts;';
END-EXEC.
or
EXEC SQL
EXECUTE IMMEDIATE 'UPDATE STATISTICS FOR TABLE PurchDB.Parts;';
END-EXEC.
To pass a dynamic command that cannot be completely defined at
programming time, you use a host variable declared with PIC, as follows:
01 DYNAMICHOSTVAR PIC X(2048).
.
.
EXEC SQL EXECUTE IMMEDIATE :DYNAMICHOSTVAR END-EXEC.
MPE/iX 5.0 Documentation