Use Case Accelerators > How to Convert PL1 Include Files to COBOL Copybooks

How to Convert PL1 Include Files to COBOL Copybooks

Article #: Product: Version:

Summary

PL1 include files (a.k.a. PL1 copybooks) can be converted into COBOL copybooks in a DMExpress job. The COBOL copybook can subsequently be used as metadata in a DMExpress task to interpret and transform corresponding data sources created by a PL1 program.

Resolution

A copybook is a file on disk containing a fragment of a COBOL program. The fragment is included in the COBOL source code at compile time by means of the COPY statement. A common example of a copybook is the description of a record layout which is used in multiple locations in the program in order to reduce coding and avoid inconsistencies. Many other languages, like PL1, have a similar feature and often use the keyword "include" instead of “copybook”.

DMExpress supports external metadata in a COBOL copybook, allowing you to link to or import record layouts directly from the copybook. Copybooks and include files used by other programming languages, such as PL1, Natural (a 4th generation language from Software AG), and Assembler, are not natively supported in DMExpress. However, when the structure of the unsupported include file is sufficiently similar to that of a COBOL copybook, and the data types can be mapped one-to-one in a reasonable way, it is possible to convert the include file into a COBOL copybook:

Attached to this article is a set of examples containing two DMExpress jobs and associated files. The first example, CONVERT_PL1_TO_COBOL.dxj, converts a PL1 include file to a COBOL copybook, and the second example, PROCESS_FILES.dxj, uses the copybook generated from the first job to process PL1 files.

Attachments

415_PL1_to_COBOL.zip, compatible with DMExpress version 9.0.2 or higher. Included is a script for running the sample jobs.

Additional Information

COBOL Copybook Indentation

The indentation of the levels usually seen in COBOL copybooks is simplified in the attached example job to reduce the complexity; only the indentation levels required for correct interpretation of copybooks by DMExpress are included.

COBOL Layout Levels

COBOL layouts have levels indicated by 2-digit numbers ranging from 01 to 49 and “special” levels 66 and 88. The convention is to increment copybook levels by a number greater than 1, but the levels are incremented by 1 in the attached example job for simplicity. The job can be modified to increment by a different factor.

Last updated: