This document describes the subset of COBOL data types that can be mapped to Software AG IDL data types.
The following topics are covered here.
We can only use COBOL source code for our IDL generation. The sources must be compiled with no errors and no warnings. Each data definition must begin with a level number and an identifier (data name or keyword), and must be terminated by a period (.). Comments and continuation lines follow the usual COBOL conventions.
The source may be free format or in reference format as expected by the COBOL compiler. In reference format, columns 1 to 6 may contain a sequence number or comment, which will be ignored. In the Linkage Section of the COBOL source file each data definition must begin with a level number and, except for an unnamed FILLER, an identifier (data name or keyword), and must be terminated by a period (.). Comments and continuation lines follow the usual COBOL conventions.
The source file also has to contain a PROCEDURE DIVISION statement with a valid USING clause. The parameter list of the USING clause determines the selection and sequence of parameters for building an IDL file. All these parameters have to be declared in the LINKAGE SECTION.
The IDL generator maps the following subset of COBOL data types of the linkage section to Software AG IDL data types, other COBOL data types as transfer parameters are not supported.
| COBOL Data Type | SAG IDL | Description | Notes |
|---|---|---|---|
| PIC X(n) | A(n)/AV(n) | Alphanumeric | 1, 2 |
| PIC 9(n)[V9(m)] | NU(n[,m]) | Unpacked decimal unsigned | 2, 3, 4, 7 |
| PIC S9(n)[V9(m)] | N(n[,m]) | Unpacked decimal | 2, 3, 4, 7 |
| PIC 9(n) BINARY | I2 | Integer (medium) | 5 |
| PIC S9(n) BINARY | I4 | Integer (large) | 6 |
| PIC 9(n) COMP[UTATIONAL] | I2 | Integer (medium) | 5 |
| PIC S9(n) COMP[UTATIONAL] | I4 | Integer (large) | 6 |
| PIC 9(n) COMP[UTATIONAL]-4 | I2 | Integer (medium) | 5 |
| PIC S9(n) COMP[UTATIONAL]-4 | I4 | Integer (large) | 6 |
| COMP[UTATIONAL]-1 | F4 | Floating point (small) | |
| COMP[UTATIONAL]-2 | F8 | Floating point (large) | |
| PIC 9(n) [V9(m)] COMP[UTATIONAL]-3 | PU(n[,m]) | Packed decimal unsigned | 2, 3 |
| PIC S9(n) [V9(m)] COMP[UTATIONAL]-3 | P(n[,m]) | Packed decimal | 2, 3 |
| PIC 9(n) [V9(m)] PACKED-DECIMAL | PU(n[,m]) | Packed decimal unsigned | 2, 3 |
| PIC S9(n) [V9(m)] PACKED-DECIMAL | P(n[,m]) | Packed decimal | 2, 3 |
Notes:
COPY statement will be supported under the following circumstances:
The member to be copied is available during parsing time. This is logically equivalent to replacing the copy statement with the copy file content before processing the resulting source program.
Nested copy statements do not recursively call the same source file.
REPLACING phrase will be ignored.
Numbers in the first position of the parameter name are not allowed in IDL syntax, therefore we add # in front if necessary. For example,
01 1BSP PIC XXX.
will be mapped to Software AG IDL:
01 #1BSP A(3).
Fix sized COBOL tables are converted to fixed size Software AG IDL arrays. Indexed COBOL tables are converted to unbounded arrays with a maximum upper bound set. Please note the COBOL <from> value is semantically different from the Software AG IDL lower bound, therefore the generated lower bound is always 1. Further it is assumed the indices <index> is part of the interface, no additional parameter is generated.
See the following examples:
| COBOL Syntax | Software AG IDL Syntax |
|---|---|
| 1 <name> OCCURS <n> [TIMES] | 1 <name> (/n) |
| 1 <name> OCCURS <n> TO <m> [TIMES] DEPENDING ON <index> | 1 <name> (/Vm) |
An option will be provided to let COBOL customers allow the keyword FILLER to be used multiple times within the same level. For unification (required for IDL usage or by other programming languages), each occurrence of the keyword FILLER will be appended with an unique number.
01 Group1. 10 Field1 PIC XX. 10 filler PIC XX. 10 Field2 PIC S99. 10 filler PIC XX.
Will be mapped to Software AG IDL:
1 Group1 2 Field1 A(2) 2 filler_1 A(2) 2 Field2 N2.0 2 filler_2 A(2)
Unnamed groups will be translated to group / field name: FILLER_n, e.g.
01 Group1. 10 Field1 PIC XX. 10 filler PIC XX. 10 Field2 PIC S99. 10 filler PIC XX. 10 . 20 Field3 PIC S9(4) BINARY. 20 Field4 PIC S9(4) BINARY.
will be mapped to Software AG IDL:
1 Group1 2 Field1 A(2) 2 filler_1 A(2) 2 Field2 N2.0 2 filler_2 A(2) 2 FILLER_3 3 Field3 I2 3 Field4 I2
Only the data fraction will be mapped to the Software AG IDL:
01 Group1. 10 Field1 PIC PPP9999.
will be mapped to IDL:
1 Group1 2 Field1 NU4
The DEPENDING ON phrase will be ignored
01 COUNTER-1 PIC 99. 01 TABLE OCCURS FROM 1 TO 10 DEPENDING ON COUNTER-1 02 Field1 PIC XX. 02 Field2 PIC 99.
A variable length group (with maximum) will be defined but without relations to DEPENDING target variable. It is the duty of the involved client or server program to set the corresponding data item correctly.
01 Counter (NU2.0) 01 Tables (/V10) 02 Field1 (A2) 02 Field2 (NU2.0)
The following table lists features, clauses and items that are not supported by the COBOL Extractor:
| Item | Description |
|---|---|
| REDEFINES clause | Redefinition is a second parameter layout of the same memory. In IDLs it is only possible to describe a memory layout once. If such a clause is found during the extraction process, the definition and all subsequent definitions will be skipped and a warning will be produced. |
| SIGN LEADING clause | The SIGN LEADING clause without a SEPARATE sub clause leads to a representation of numeric fields where the sign is located in the first nibble of the first byte. Software AG client stubs and RPC servers do not work this way. If such a clause is found during the extraction process, the clause itself will be skipped and a warning will be produced. |
| USAGE clause on group level and on subsequent groups or parameters | A USAGE clause used to determine the IDL format can be specified on group (record) level. If this is done, it may not be set on subsequent parameters or groups unless the same USAGE clause is used. If a subsequent group or parameter has a different USAGE clause, the parameter or the group including all subsequent definitions will be skipped and an error will be produced. |
| REPLACING clause of COPY statement | This clause will be ignored by the COBOL IDL Extractor. |
| USAGE IS INDEX USAGE IS POINTER |
Parameters including the INDEX or POINTER usage clause will be ignored without warning. |
| ASCENDING DESCENDING INDEXED BLANK ZERO VALUE |
All these statements will be ignored by the COBOL IDL Extractor without an error, warning or information message. The extractor will still try to generate a parameter or group. |