Chapter 5: The COBOL Preprocessors


5.01  Overview

A couple of COBOL pre-processors are available as part of the DB-123 Data Management system.
These preprocessors have been developed in the past years to preform specific COBOL transformation actions.

The preprocessors available are:
 

Doit1999

Year 2000 conversion

Cob2RW

Cobol II Report Writer preprocessor

EUROPA  

EURO Transformer program analysis & adaption

EUROCICS 

EURO Transformer CICS preprocessor

 

Cob2DB2  

IBM  DL/I to DB2  (SQL) Converter

Cob2MFC 

Cobol II to Micro-Focus COBOL converter

Cob2XREF

Cobol II Global Cross reference (Files and Databases vs Programs)

Cob2PP

generalized COBOL II Pre-Processor (driven by options)

Cob2JAVA

COBOL II to Java translator

Cob2FORM

COBOL II  Code-Formatter

 

Each of these preprocessors uses the following steps (phases) in turn:

COB_SCAN 

The COBOL scanner: processes COPY books and REPLACING clauses

COB_DECL

The COBOL declaration parser

COB_PROC

The COBOL Procedure Division Parser

TT_XCHA 

The Transformer: execute preprocessor changes in COBOL program

 

5.02  DO*IT 1999: Year 2000 conversion

This step is already completed. Date variables have been recognized by name or have been manually marked in the COBOL prefix area by specific codes identifying the format (image, i.e. YY/MM/DD) of the DATE-variables.
Refer to the
DATEFORM.TABLE for a list of all Date Formats (images) supported.
A sliding windows technique has been used to update the programs, and change the program logic when necessary.

5.02  COB2RW: The COBOL II Report Writer Pre-processor

 IBM COBOL II does no longer support the COBOL REPORT WRITER statements available in COBOL I.

For ease of transition, an own tool named Cob2RW has been developped in REXX.  COB2RW translates all COBOL REPORT-WRITER statements to ordinary COBOL II statements. It is usually invoked immediately before compilation, as the original REPORT WRITER statements are much more readable for program maintenance.

The preprocessor is invoked as follows:

cmd>COB2RW program-list [( options)]

Where program-list is a blank delimited list of program names to be translated. The filetype of the programs may be omitted. In these cases the default file-type as specified in the COB2RW.GLOBAL file is used (usually .CBL on the PC, and COBOL2 on an IBM CMS machine). The following options are available:
 

Option

purpose

meaning

TS

trace source

traces all source-lines when parsing the COBOL program

NOHIST

suppress history

do NOT retain the historic (old) statements in the modified source code

 

5.03 EUROPA: The EURO Program Analyser

The EURO Program analyser may be used to find all MONEY fields in any COBOL Program, and translate MONEY Constants to MONEY Constant parameters. Those MONEY parameters are then initialized at run-time according to the proper CURRENT CURRENCY, which may be the LOCAL curreny now, and the EURO-Currency after the currency switch date.

Details of the Operation are described in the 'The Euro*Transformer tool-set Programmers guide'.

5.04 EUROCICS: The EURO CICS Transfomator

The EURO CICS Transformator allows you to run CICS programs in a DUAL mode. By pressing aspecial key (usually PF19), all MONEY-Fields of the screen are switched from LOCAL currency to EURO (before the transition date), and from EURO back to local currency again (after the transition date). The changes in the program are performed immediately before the actual compilation, so the the original CICS program source isn't globbered by the switch actions.

After a reasonable time (say 1-2 years after the transition date), EURO CICS transformation may be turned off again (as all programs do now run in the EURO mode only again). Details of the Operation are described in the 'The Euro*Transformer tool-set Programmers guide'.

5.05 Cob2DB2: The IBM DL/I to DB2 converter

The IBM DL/I to DB2 Converter does support you in changing your COBOL programs from VSAM files and/or the hierachic DL/I database processing (with EXEC DLI ... END-EXEC statements to the proper DB2-processing. Depending on the options established, either INLINE code, INCLUDE code  or calls to EXTERNAL subroutines may be used to interface your program with the new SQL (DB2) database.

The underlying rules are simple: If a VSAM file statement (INSERT, DELETE, READ etc) or an EXEC DLI statement is detected referencing a DB2/SQL table in your database, then the respective statements are translated to equivalent DB2/SQL statements in your source code.

The Cob2DB2 Converter is invoked as usual from the command line:

cmd>Cob2DB2 program-list [( options)]

Where program-list is a blank delimited list of program names to be translated. The filetype of the programs may be omitted. In these cases the default file-type as specified in the DB123.GLOBAL file is used (usually .CBL on the PC, and COBOL2 on an IBM CMS machine). The following options are available:

 

Please note, that you need to have your DATA DICTIONARIES already established, and the MASTER.FILE with all used DATA DICTIONARIES must be available and compiled by DBDICT (see chapter 2: the Data Dictionary utility for details).
The RECORD names of the DATA-DICTIONARY must match the SEGMENT names of your DL/I database.

You may execute the Cob2DB2 Preprocessor on the fly before each compilation, or explicitely at once to change all DL/I processing to DB2 (or SQL) at once forever.

5.06 Cob2MFC: The IBM COBOL to MicroFocus COBOL Converter

Similar to Cob2DB2, Cob2MFC may be used to translate DL/I statements to DB2 (SQL) statements. In addition, the following tasks are performed by Cob2MFC:

he preprocessor is invoked as follows:

cmd>COBMFC program-list [( options)]

Where program-list is a blank delimited list of program names to be translated. The filetype of the programs may be omitted. In these cases the default file-type as specified in the COB2RW.GLOBAL file is used (usually .CBL on the PC, and COBOL2 on an IBM CMS machine). The following options are available:

  

Option

purpose

meaning

TS

trace source

traces all source-lines when parsing the COBOL program

NOHIST

suppress history

do NOT retain the historic (old) statements in the modified source code

 

An example will look as follows:

cmd>Cob2MFC ZA0105.cbl

 

5.07  Cob2XREF: Cobol II / MicroFocus COBOL Global Cross reference (XREF)

5.08  Cob2PP: the generalized COBOL Preprocessor

5.09  Cob2Form: the Cobol II Code Formatter

5.10  Cob2Java: the COBOL to Java translator