You can also call sql.acu from within a COBOL program. The syntax is:
call
"sql.acu" using mysql-command
The SQL command may be up to 50,000 characters in length and may be a variable or a quoted command string in the CALL statement.
NOTE
The sql.acu utility may be used only with SQL commands that are data definition statements (those that do not return data). Be sure to end each SQL command with a semicolon (;).
Example
IDENTIFICATION DIVISION.
DATA DIVISION.
working-storage section.
01 sql-command pic x(75).
01 error-status.
03 primary-error pic x(2).
03 secondary-error pic x(40).
01 error-text pic x(40).
01 error-window pic x(10).
PROCEDURE DIVISION.
main-logic.
display window erase.
display window line 20, column 2
size 75, lines 3, boxed,
top title "SQL COMMAND",
bottom right title "Return to exit".
perform do-sql-command, with test after,
until sql-command = spaces.
stop run.
do-sql-command.
accept sql-command, line 1, column 1,
erase to end of line.
if sql-command not = spaces
call "sql.acu" using sql-command
if return-code not zero
perform show-error.
show-error.
display window line 2, column 2,
size 75 lines 6, boxed, erase,
pop-up area is error-window.
call "C$RERR" using error-status,
error-text.
display "DATABASE ERROR:",
secondary-error.
display error-text.
accept omitted.
close window error-window.
display window line 20, column 2,
size 75, lines 3.
* definition commands to the RDBMS.
Once you have run the sql.acu program, you are ready to prepare and compile your COBOL program. Use the forward Browse button to move to the topic.