Product Documentation

FairCom RTG COBOL Edition User's Guide

Previous Topic

Next Topic

Open cobol_Tutorial1 data through SQL (optional)

If you are planning to provide SQL access to your COBOL data, this section provides a quick overview of the process. If not, it can be skipped.

To learn more about preparing for SQL access, the FairCom RTG COBOL Edition User Guide has a major section explaining the process and providing advanced tips for handling special considerations.

The cobol_Tutorial1 program creates a data file called CUSTMAST. The CUSTMAST file can be easily queried through FairCom DB SQL using the ISQL command-line utility or through the FairCom DB SQL Explorer GUI Tool.

To demonstrate this capability using ISQL, follow the instructions below:

1. Directly import the custmast.dat data file using the XFD file (ACUCOBOL) or ISS file (isCOBOL) generated when compiling cobol_Tutorial1.cbl. Using the ctutil -sqlize parameter will convert the XFD / ISS into an XDD file, insert it into the data file, and import the file into the specified FairCom DB SQL database.

\FairCom\V2.x.x.RTG\win32\tools\cmdline\ctutil.exe -sqlize custmast custmast.xfd ADMIN ctreeSQL

For isCOBOL:

\FairCom\V2.x.x.RTG\win32\tools\cmdline\ctutil.exe -sqlize custmast custmast.iss ADMIN ctreeSQL

2. Start the ISQL interactive SQL utility:

\FairCom\V2.x.x.RTG\win32\tools\cmdline\isql.exe -u admin -a ADMIN ctreeSQL

3. From the interactive SQL prompt, list the records in the custmast table by using a SELECT SQL statement:

ISQL> SELECT * FROM CUSTMAST;

Alternatively the XDD file can be generated from the XFD file and saved to disk using ctutil -xfd2xdd.

The generated XDD file can then be embedded inside the data file by using ctutil -sqlinfo.

The XDD file listed below, custmast.xdd, shows the cobol_Tutorial1 data that is obtained by executing:

\FairCom\V2.x.x.RTG\win32\tools\cmdline\ctutil.exe -xfd2xdd custmast.xfd

custmast.xdd:

<?xml version="1.0" encoding="US-ASCII"?>

<table name="CUSTMAST-FILE" maxRecLen="157" minRecLen="157">

<key segCount="1" duplicate="false">

<segment offset="0" size="4"/>

<part name="CM_CUSTNUMB" offset="0" size="4"/>

</key>

<schema name="CUSTMAST-FILE" size="157">

<field name="CM_CUSTNUMB" size="4" type="Alphanum" digits="4" scale="0"/>

<field name="CM_CUSTZIPC" size="9" type="Alphanum" digits="9" scale="0"/>

<field name="CM_CUSTSTAT" size="2" type="Alphanum" digits="2" scale="0"/>

<field name="CM_CUSTRTNG" size="1" type="Alphanum" digits="1" scale="0"/>

<field name="CM_CUSTNAME" size="47" type="Alphanum" digits="47" scale="0"/>

<field name="CM_CUSTADDR" size="47" type="Alphanum" digits="47" scale="0"/>

<field name="CM_CUSTCITY" size="47" type="Alphanum" digits="47" scale="0"/>

</schema>

</table>

TOCIndex