Sample Programs [ Micro Focus COBOL for UNIX COBOL User Guide ] MPE/iX 5.0 Documentation
Micro Focus COBOL for UNIX COBOL User Guide
Sample Programs
A demonstration program, sqldemo, is supplied with this system.
This program is located in the directory cobol\demo on Windows and OS/2
and in the directory $COBDIR/demo/SQL on UNIX.
SQLDEMO Sample Program
The sqldemo program demonstrates the use of CREATE TABLE, INSERT and
SELECT commands with IBM's Database Manager. It uses the sample database
provided with Database Manager.
To create the sample database, run the sqlsampl program.
To prepare the system to run SQLDEMO, you must first compile and run the
sqlprep program to create the required tables and views.
OS/2 To create executable versions of the programs and
execute them on OS/2, enter the following commands:
cobol sqlprep
link sqlprep+sqlinit,,,coblib+doscalls+sql_dyn;
sqlprep
cobol sqldemo sql sqldb(sample);
link sqldemo+sqlinit,,,coblib+doscalls+sql_dyn;
AIX To create executable versions of the programs and
execute them on AIX, enter the following commands:
cob -x sqlprep $COBDIR/src/sql/sqlinit.o
sqlprep
cob -x sqldemo $COBDIR/src/sql/sqlinit.o
sqldemo
Running sqldemo accesses the sample database, inserts some data, reads it
back and then creates a couple of tables. You can use Query Manager to
further see the effects of the sqldemo program.
Error Codes
Error conditions are returned at compilation time as a number and
explanation. Further details of these messages are given in the
documentation supplied with your database system. Messages referencing
host variables show slightly modified names: hyphens are shown as
underscores (_), and there are up to three additional characters at the
end of the name which can be ignored. These changes are side effects of
modifications made by the COBOL system to the SQL code.
Error conditions at run time are indicated by non-zero values in SQLCODE.
Explanatory text is placed in the MFSQLMESSAGETEXT data item if defined;
see the section SQL Communications Area earlier in this chapter for
further details about this data item.
MPE/iX 5.0 Documentation