COBOL Importer overview
The purpose of the COBOL importer is to represent the COBOL data structures in a DATA model (CAM) - EMF resource. It is the responsibility of the tool providers to extract information from the resource and use it for their own purpose. The importer reports any syntax errors that occur in the environment and division, and disregard any procedure division messages.
Using the COBOL Importer
The following list outlines requirements and limitations for using the COBOL importer:
- A file is assumed to be a complete COBOL program if it has the extension of .cbl, .ccp or.cob.
- A file is assumed to be a copy book if it has the extension .cpy. If the file is a copybook member then it should consist of only one or more 01 data structures or 01 or 77 elementary data item definition.
- If the copybook member contains any other COBOL language element then the user has to provide a wrapping program that includes the copy member and name the wrapper program .cbl, ccp or .cob. The wrapping program has to be syntactically correct. (If there are errors, the importer should be able to show them in the problem task list.)
- You must provide a wrapping program if the copy member contains
any of these elements:
- A reference to a symbolic character
- A numeric-edited pictures section that contains currency symbol that require a CURRENCY SIGN clause
- A comma used as a decimal point in a PICTURE clause
Note: In these cases a SPECIAL-NAMES paragraph should be specified in the wrapping program that provide definition for them.Here is an example of a wrapper program: ex.cbl
- Nested programs are not supported.
- COPYBOOK(s) are supported as long as they are in the same location as the main source file (which can be a COPYBOOK or complete program).
- To add the ability to import a COBOL source that has dependency
on copybooks that are in directories other than the location of the
main source file, you can add these directory locations to your COBOL
preferences:
- Select Window > Preferences > Importers > COBOL > SYSLIB.
- Click Add.
- Use Browse to locate the directory you want to add.
- Click Remove to remove any directories you do not need, and use Move Up, Move Down to change the order of the directories in which the COBOL importer searches for copybooks.
- The import does not succeed if there are syntax errors in the environment (applicable only for complete programs) and data division.
- The current value clause support is as follows:
- Every WORKING-STORAGE or LOCAL-STORAGE section data item that
has a VALUE clause specified has a COBOLElementInitialValue object.
If the VALUE clause literal is a figurative constant, we generate
the following attributes:
Figurative Constant ValueKind initVal SPACE spaces " " QUOTE quotes """ or "'" ZERO zero_value "0" HIGH-VALUE high_value "0" since we do not support this LOW-VALUE low_value "0" since we do not support this NULL null "0" - If the VALUE clause literal is an alphanumeric, DBCS, national or symbolic character then the valueKind attribute is set to string_value and the initVal attribute has the actual literal content. In the case of alphanumeric or DBCS literal the value literal content is first converted to UTF-16 and then to UTF-8. In the case of national literal the value literal content is converted to UTF-8. So always the initVal attribute value is in UTF-8 format. If the value literal contains XML illegal characters (ex. X'00' to X'1F'), these characters are replaced with a '?' character.
- Every WORKING-STORAGE or LOCAL-STORAGE section data item that
has a VALUE clause specified has a COBOLElementInitialValue object.
If the VALUE clause literal is a figurative constant, we generate
the following attributes:
- No support for level 66 data items.
- SQL support: All SQL statements other than SQL INCLUDE are ignored by the importer. EXEC SQL INCLUDE is treated as a COPY statement.
Input
In order for a COBOL file to be successfully imported into your project, it must be a complete COBOL program or copybook. The importer is sensitive to file extensions, and files with incorrect extensions causes an importer error.
Output
On successful import of the COBOL importer source, an EMF resource (CAM data model) is returned.