contents.gifindex.gifprev1.gifnext0.gif

Informix: Common Questions and Answers

Question: How do I create new databases?

Answer: You have two choices. You can use an Informix product such as ISQL to create a new database, or you can use the program sql.acu provided with your Acu4GL product.

To use the sql.acu utility to create an empty database and grant access privileges to other users, type:

runcbl sql.acu <return>

The program will pause to accept an SQL command. Type:

CREATE DATABASE database-name <return>

NOTE: If you want to use the transaction logging facility available in ACUCOBOL-GT, you need to enable it for the database that you are creating. The precise SQL command depends on the Informix engine you are using, as shown below.

For Informix-OnLine, if you want to use transaction logging:

CREATE DATABASE database-name WITH LOG;
<return>

For Informix-SE, if you want to use transaction logging:

CREATE DATABASE database-name WITH LOG IN `/acct/f1992/acct_log';
<return>

If you are using an Informix database with transactions enabled, you must use ACUCOBOL-GT's transaction management capabilities. (Either use START TRANSACTION and COMMIT, or compile with -fs, or use the sql.acu program to issue BEGIN WORK and COMMIT.) Using a transaction-enabled database without ACUCOBOL-GT's transaction management capabilities results in the records not being locked and can generate error messages.

The program will pause to accept an SQL command. Now type:

GRANT DBA TO PUBLIC <return>

Then press <return> again to exit the program.

The database name may be up to ten characters in length and must contain only letters, digits, and underscores. The first character must be a letter.

The statement GRANT DBA TO PUBLIC gives the database administrator access privileges to all other users.

Question: Is it possible to use both Informix-OnLine and Informix-SE on the same machine?

Answer: Yes. You'll need to tell the runtime which database engine to use. You do this by setting the environment variable SQLEXEC as shown here:

Informix-OnLine

SQLEXEC = ${INFORMIXDIR}/lib/sqlturbo

Informix-SE

SQLEXEC = ${INFORMIXDIR}/lib/sqlexec

Setting SQLEXEC tells the Informix utility programs and the ACUCOBOL-GT runtime which engine to access. This variable must be set before you execute the runtime. Only one engine (either OnLine or SE) can be used for any given execution of the runtime.

INFORMIXDIR is an environment variable that you must set to the location of your Informix product.

Question: I can't seem to get Acu4GL to create the files in Informix. They keep coming up as Vision files.

Answer: Check to see that the DEFAULT-HOST and DATABASE variables are set in the runtime configuration file.

Type runcbl -vv <return> and make sure that the version number of the Informix interface is reported. This tells you that the interface has been installed successfully.

Make sure that USE_INFORMIX is set to 1 in the file FILETBL.C if you relink the runtime.

Question: Can I use both Informix and Vision at the same time?

Answer: Yes, you can. In the configuration file, set DEFAULT-HOST to the file system you want the runtime to use automatically. Then, for selected files, assign them to an alternate file system with the variable filename-HOST. For example, to put CUSTFILE into Informix and everything else into Vision, you would add:

DEFAULT-HOST VISION
CUSTFILE-HOST INFORMIX

Question: What files do I need in order to link my C routines into Acu4GL?

Answer: From your ACUCOBOL-GT runtime medium you need:

sub.c
sub85.c
filetbl.c
config85.c
sub.h
libruncbl.a
libvision.a
libacuterm.a
clntstub.o

If you are using AcuServer(TM), instead of linking clntstub.o, see the relinking instructions in your AcuServer User's Guide.

From your Acu4GL medium, you need all of the following that are present:

infemb7.o for versions 6.x and 7.2
infemb.o for version 5.x
inf.o
cur.o
* libsql.a
* libgen.a
* libos.a
* libasf.a
* netlib.a

* These files are provided by Informix and should be located in the appropriate Informix directory.

Instructions for linking are given in the installation topic of this section.

Question: How can I find out what the Informix error message is?

Answer: If you run your application with the -x option, you will receive extended error numbers that include those returned by Informix. In addition to the ACUCOBOL-GT error, two types of errors are returned: the Informix error, and the ISAM error.

If you have sent the errors to an output file with the -e option, the runtime will also attempt to include the text that explains the errors. See the retrieving runtime errors topic for additional details about this method.

You can also retrieve error codes from within your COBOL program. See the example in the Informix Runtime Errors topic.

Also, check your Informix documentation for the "finderr" capability. It is also briefly discussed in this document's error retrieval section.

Question: I could not find the secondary error number for a 9D in the documentation. What does the number mean?

Answer: The errors fall into three categories:

01-99 are Acu4GL codes and are described in this on-line document

100-199 are ISAM errors and are explained in Informix manuals

200 and up are Informix database errors and are explained in Informix manuals

Question: Do my XFD files have to be in the same directory as my object files?

Answer: No. You can instruct the compiler to put the XFD files in an alternate directory with the -Fo option. Then at runtime, make sure you have the configuration variable XFD-DIRECTORY set to that same directory.

Question: Why aren't my KEYs being retrieved in the correct order?

Answer: If your KEY field is numeric or alphanumeric, you may have illegal data in the field. For example, if you've used LOW-VALUES or HIGH-VALUES to mark control records, those values are considered invalid and can cause the records containing them to be retrieved in an unexpected sequence.

To enable special values such as these to be processed, use the BINARY directive in front of the key field. This will allow data of any classification to be processed. Either designate an individual field as binary, or specify USE GROUP, BINARY in front of a group of fields.

The method of storing variables declared as binary is database-specific. For Informix databases, these are stored as char fields with an extra leading character. This character always contains a space.

Question: Can the Acu4GL for Informix interface support a full date/time format?

Answer: The finest time granularity that Informix will support is one hundredths of a second. In order to achieve this, you must be sure the "xfd date" code is correct and specify a date-format-string in your COBOL application as opposed to just a date. See Date Directive for additional information.

Question: Is it possible to use the same XFD file for data files with different names, if they all have the same structure? This would be useful when I create several customer files that use the same record definitions.

Answer: At runtime, it is possible to use a single XFD for files that have different names. For example, suppose a site has customer files that have identical structures but different names (CUST0001, CUST0002, CUST0003, etc.). It's not necessary to have a separate XFD for each file, so long as their record definitions are the same.

The individual files can all be mapped to the same XFD via a runtime configuration variable called XFD-MAP. Here's how it works.

Suppose your COBOL application has a SELECT with a variable ASSIGN name, such as customer-file. This variable assumes different values (such as CUST0001 and CUST0002) during program execution.

Before compiling the application, you would use the FILE directive to provide a base name for the XFD. Suppose you provide CUST as the base. The compiler would then generate an XFD named cust.xfd. (The compiler always converts XFD names to lower case.)

To ensure that all customer files, each having a unique name, will use this same XFD, you make this entry in your runtime configuration file:

XFD-MAP CUST* = CUST

The asterisk (*) in the example is a wildcard that matches any number of characters. Note that the extension .xfd should not be included in the map. This statement would cause the XFD cust.xfd to be used for all files whose names begin with CUST.

The XFD-MAP variable has this syntax:

XFD-MAP [pattern = base-xfd-name] ...

where pattern consists of any valid filename characters and may include * or ?. These two characters have special meanings in the pattern:

* matches any number of characters

? matches a single occurrence of any character

For example:

CUST???? matches CUST0001 and CUSTOMER
does not match CUST001 or CUST00001

CUST* matches all of the above

CUST*1 matches CUST001 and CUST0001 and
CUST00001does not match CUSTOMER

*OMER matches CUSTOMER
does not match CUST001 or CUST0001

The XFD-MAP variable is read during the open file stage of any Acu4GL interfaces linked into the runtime.

This is the end of the Acu4GL for Informix section. Click the Contents button at the top of this window to return to the Table of Contents page.