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 and may be a variable or a quoted command string in the CALL statement.
IDENTIFICATION DIVISION.
program-id. command.
* the sql.acu command to issue data
* definition commands to the RDBMS.
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.