Using the COBOL-to-DASDL Utility
This chapter explains how to use the COBOL-to-DASDL utility to replicate flat files that use COBOL 01-level file record descriptions.
Understanding the COBOL-to-DASDL Utility
The COBOL-to-DASDL utility allows you to generate a FileXtract layout database from COBOL 01-level file record descriptions. It also generates the appropriate DBServer SOURCE declaration that you insert into the DBServer parameter file so that Databridge Clients can access the replicated flat files.
- For normal disk files, the DISKFILE Reader library is used to read the flat files that are being replicated. For a description of the DISKFILE Reader library, see DISKFILE Reader Library. Otherwise, see Generating Database Layout from COBOL 01-Level File RecordDescriptions.
You must have or create a COBOL file containing the 01-level file record descriptions for the flat files you want to replicate. A sample COBOL file (DATA/COBOLTODASDL/SAMPLE/ LINCLOG/FD) containing a layout of the LINC log is installed with the FileXtract software.
- For LINC log activity files, the LINCLOG Reader library is used to read the flat files that are being replicated. For a description of the LINCLOG Reader library, see LINCLOG Reader Library. Otherwise, see Generating Database Layout from LINC Activity Log Files.
For an example of how to use the COBOL-to-DASDL utility to replicate a sample flat file called DATA/ LOAD/SAMPLE/DATABASE, see the BANKFILE COBOL-to-DASDL Example that follows. We recommend that you complete this example before using the COBOL-to-DASDL utility for your own disk files.
BANKFILE COBOL-to-DASDL Example
This example illustrates how to use the COBOL-to-DASDL utility to replicate a sample flat file called DATA/LOAD/SAMPLE/DATABASE. Everything you need to run this example is installed with FileXtract.
View DATA/LOAD/SAMPLE/DATABASE and familiarize yourself with the records in this flat file.
View and familiarize yourself with DATA/COBOLTODASDL/SAMPLE/BANKFILE/FD, which is the COBOL FD for DATA/LOAD/SAMPLE/DATABASE.
Copy the BANKFILE parameter file as follows: GET DATA/COBOLTODASDL/SAMPLE/BANKFILE/CONTROL AS DATA/COBOLTODASDL/BANKFILE/CONTROL
Define the SOURCE.
The SOURCE name will be used as the DBServer SOURCE name as well as the name of logical database that the COBOL-to-DASDL utility creates. Note that this step has already been completed for you in this sample control file, as follows:
DEFINE Source COBOLBankFile USING "DATA/LOAD/SAMPLE/DATABASE" FROM FD IN "DATA/COBOLTODASDL/SAMPLE/BANKFILE/FD";
Declare the data sets to be generated from the various flat files. Note that this step has already been completed for you in this sample control file. The following are the data sets that have been defined:
``` Dataset Comments uses INPUT-DATA-REC where COMMENT-REC; % 88-level item
Dataset BANK uses INPUT-BANK % => use the INPUT-BANK REDEFINE where BANK-TYPE and (BANK-ID not greater than 5000 or BANK-NAME ^= SPACES); % a more complex expression
Dataset BRANCH uses INPUT-BRANCH, DATA-TYPE where BRANCH-TYPE; % need to be listed because it is not REDEFINEd.
Dataset CUSTOMER uses INPUT-CUSTOMER where CUSTOMER-TYPE;
Dataset TELLER uses INPUT-TELLER where TELLER-TYPE;
Dataset ACCOUNT uses INPUT-ACCOUNT where ACCOUNT-TYPE;
Dataset HISTORY uses INPUT-HISTORY where HISTORY-TYPE; ```
Save the parameter file.
Run the COBOL-to-DASDL utility using the following command:
START WFL/FILEBRIDGE/COBOLTODASDL ("BANKFILE")
The COBOL-to-DASDL utility processes the COBOL file description, generates a DASDL called SOURCE/FILEBRIDGE/COBOLTODASDL/BANKFILE, and generates a DBServer parameter file fragment called DATA/SERVER/BANKFILE/CONTROL. Then, the WFL compiles the resulting database and runs the FileXtract Initialize utility to prepare it for Databridge.
Update the DBServer parameter file with the generated DBServer parameter file fragment, as follows:
a. Transmit the following command:
b. Transmit the following command:
INSERT DATA/SERVER/BANKFILE/CONTROL AT END
The DBServer parameter file is appended with the BANKFILE DBServer parameter file fragment, which defines the SOURCE, database, and data file title to use to replicate the BANKFILE flat file.
Run the Databridge Client with the DEFINE command to define the COBOLBankFile source. Then run it with the GENERATE command and finally with the PROCESS command. The Databridge Client contacts DBServer to replicate the BANKFILE flat file. Refer to the Databridge Clients Administrator’s Guide for instructions on running the Databridge Client.
Generating Database Layout from COBOL 01-Level FileRecord Descriptions
COBOLTODASDL/SAMPLE/BANKFILE/CONTROL) contains sample entries based on a flat file called DATA/LOAD/SAMPLE/DATABASE. This file illustrates how to declare a DBServer SOURCE and generate the associated layout database from COBOL 01-level file record descriptions. As you complete the following steps, remove, modify, or comment out the sample entries.
To replicate flat files that use COBOL 01-level file record descriptions.
Copy the COBOL-to-DASDL parameter file as follows:
Get DATA/COBOLTODASDL/SAMPLE/BANKFILE/CONTROL AS DATA/
where dbname is the name you want to use for the layout database that will be generated. (See the table below.)
Define the DBServer SOURCE declaration as follows:
FROM FD IN"COBOLsourcefile";
Where Is sourcename the name of the logical database that the COBOL-to-DASDL utility creates. DBSpan and DBSnapshot access flat file data using the logical database will be used. dbname different than sourcename and flatfiledirectory. If you enter the same name for SOURCE and database, an error message appears. filename a file or a directory. Note that the DISKFILE Reader library treats a file as both a file and a directory. Therefore, that file and all files under that file node will be replicated. COBOLsourcefile the file that contains the 01-level file record layout(s). It cannot contain declarations other than the FD and the 01-level file record layouts (and it does not have to contain the actual FD). If the FD is in the main COBOL program source file, you must create a new COBOL file containing just the disk file layout and use that file’s title for COBOLsourcefile.
In addition to using this information to create the DASDL, the COBOL-to-DASDL utility uses the SOURCE declaration to create a DBServer parameter file fragment (DATA/SERVER/dbname/ CONTROL) which you insert into the DBServer control file.
Declare the data sets to be generated from the various flat files using the following syntax.
When you run the COBOL-to-DASDL utility, it automatically encloses the SOURCE and logical database names in “quotation marks” in the generated parameter file fragment for DBServer. This feature allows you to use hyphens (-) in SOURCE names, and the SOURCE names can be the same as a parameter file keyword.
DATASET BANK USES INPUT-BANK WHERE BANK-TYPE and (BANK-ID not greater than 5000 or BANK-NAME ^= SPACES);
The USES clause tells the Reader library what data items to use when there are REDEFINES. Note that successive 01s under an FD are implicit REDEFINES.
The WHERE clause indicates the condition that must be true of all records that belong in that data set. The WHERE clause can be omitted if all records belong in a single data set. The WHERE clause must evaluate to a Boolean expression (true or false).
The Boolean expression can consist of relational expressions, connected by AND or OR, using the normal COBOL relational operators: GREATER THAN, >, GTR, LESS THAN, <, LSS, EQUAL TO, =, EQL, GREATER THAN OR EQUAL TO, >=, GEQ, LESS THAN OR EQUAL TO, <=, LEQ, ^=, !=, <>, NEQ. The left side of a relational expression must be a data item name and the right side must be either an integer, a double-quoted string, a hex string, SPACE, or SPACES. An 88-level condition name can also be used as a relational expression.
Save the COBOL-to-DASDL parameter file.
Run the COBOL-to-DASDL utility using the following command:
where dbname is the name of the layout database you assigned in step 1.
The COBOL-to-DASDL utility processes the COBOL file description, generates the DASDL called SOURCE/FILEBRIDGE/COBOLTODASDL/dbname, and generates a DBServer parameter file fragment called DATA/SERVER/dbname/CONTROL. Then, the WFL compiles the resulting database and prepares it for use with FileXtract.
Do one of the following based on which Databridge accessory you are going to use:
For Do this DBServer Insert the DBServer parameter file fragment (DATA/SERVER/dbname/CONTROL) into the DATA/SERVER/CONTROL file using the following steps:
- Get DATA/SERVER/CONTROL.
- Transmit the following command:
INSERT DATA/SERVER/dbname/CONTROL AT END
- Save the file.
The DBServer parameter file is appended with the DBServer parameter file fragment, which defines the SOURCE, database, and Reader library to use to replicate the flat files. After you have updated the DBServer parameter file, run the Client with the DEFINE, GENERATE, and PROCESS commands. Refer to the Databridge Clients Administrator’s Guide for instructions.
Other Accessories The flat file is ready to be cloned. For DBSpan and DBSnapshot, start the associated WFL with the layout database and logical database (SOURCE) names to create the accessory parameter file. For example:
START WFL/DATABRIDGE/SPAN ("BANKFILE", "COBOLBANKFILE")
Define the READER options in the accessory parameter file and then run the Accessory. Refer to the Databridge Host Administrator’s Guide for instructions.