COBOL DATA TYPE MAPPINGS [ DICTIONARY 3000 ] MPE/iX 5.0 Documentation
DICTIONARY 3000
COBOL DATA TYPE MAPPINGS
To be compatible with COBOL, the data types defined in the Dictionary
must be mapped to COBOL data types. The following shows how the
Dictionary data types are mapped to compatible COBOL data types. Note
that the COBOL data types occupy the same storage length as the data
types defined in the Dictionary. However, some Dictionary definitions
allow numbers larger than what COBOL will allow (for example, the integer
data type). Also, for some data types, the Dictionary allows 28 and 29
numeric digit elements, whereas COBOL only allows numeric elements to
have a maximum of 18 digits. Elements defined in the Dictionary that are
larger than the maximum digits allowed by COBOL will be flagged as an
error and converted to data type X when generated by DICTCDE.
Any ASCII Character:
Suppose the entity is defined in the Dictionary as:
ELEMENT-TYPE = X
ELEMENT-SIZE = 20
ELEMENT-LENGTH = 20
the corresponding COBOL clause will be generated:
PIC X(20)
Uppercase Alphanumeric String:
Suppose the entity is defined in the Dictionary as:
ELEMENT-TYPE = U
ELEMENT-SIZE = 20
ELEMENT-LENGTH = 20
the corresponding COBOL clause will be generated:
PIC X(20)
Numeric ASCII String:
Suppose the entity is defined in the Dictionary as:
ELEMENT-TYPE = 9 or 9+
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 2
ELEMENT-LENGTH = 7
the corresponding COBOL clause will be generated:
PIC 9(5)V9(2)
Zoned Decimal:
Suppose the entity is defined in the Dictionary as:
ELEMENT-TYPE = Z+
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 2
ELEMENT-LENGTH = 7
the corresponding COBOL clause will be generated:
PIC 9(5)V9(2)
Suppose the entity is defined in the Dictionary as:
ELEMENT-TYPE = Z
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 2
ELEMENT-LENGTH = 7
the corresponding COBOL clause will be generated:
PIC S9(5)V9(2)
If the above entity is defined in the Dictionary as SIGN TRAILING
SEPARATE, DICTCDE will generate the corresponding COBOL clause:
PIC S9(4)V9(2) SIGN TRAILING SEPARATE
Note that 1 less byte is generated because of the sign.
Boolean:
Suppose the entity is defined in the Dictionary as:
ELEMENT-TYPE = B
ELEMENT-SIZE = 1
ELEMENT-LENGTH = 1
the corresponding COBOL clause will be generated:
PIC X(1)
Since this is an undefined COBOL type, DICTCDE will flag this element
definition with a warning message.
String:
Suppose the entity is defined in the Dictionary as:
ELEMENT-TYPE = S
ELEMENT-SIZE = 5
ELEMENT-LENGTH = 8
the corresponding COBOL clause will be generated:
PIC X(8)
Since this is an undefined COBOL type, DICTCDE will flag this element
definition with a warning message.
Real Number:
Suppose the entity is defined in the Dictionary as:
ELEMENT-TYPE = E (or R)
ELEMENT-SIZE = 7
ELEMENT-DECIMAL = 2
ELEMENT-LENGTH = 4
the corresponding COBOL clause will be generated:
PIC X(4)
Since this is an undefined COBOL type, DICTCDE will flag this element
definition with a warning message.
Integer Number and Logical Value:
The data types, defined in the Dictionary as I, J, or K are mapped to
COBOL COMPUTATIONAL data types. These data types are defined to take up
the required amount of storage (either 2, 4 or 8 bytes). If the number
of digits specified in the Dictionary for an entity are sufficient to
fill the storage length (as defined in the Dictionary) then DICTCDE will
use the number of digits as specified in the Dictionary. However, if the
number of digits are insufficient, COBOL will use the minimum number of
digits to fill the required storage length. Also, if the number of
digits is too large for the specified storage size, DICTCDE will use the
maximum number of digits that storage size allows.
For example, the following entities in the Dictionary are generated as
follows:
ELEMENT-TYPE = I
ELEMENT-SIZE = 4
ELEMENT-DECIMAL = 0 { PIC S9(4) COMP.
ELEMENT-LENGTH = 2
ELEMENT-TYPE = I
ELEMENT-SIZE = 5
ELEMENT-DECIMAL = 2 { PIC S9(2)V9(2) COMP.
ELEMENT-LENGTH = 2
The decimal point for the above entity requires a digit place.
ELEMENT-TYPE = I
ELEMENT-SIZE = 4
ELEMENT-DECIMAL = 0 { PIC S9(5) COMP.
ELEMENT-LENGTH = 4
(Five digits used to force a 2-word integer.)
ELEMENT-TYPE = I
ELEMENT-SIZE = 5
ELEMENT-DECIMAL = 0 { PIC S9(10) COMP.
ELEMENT-LENGTH = 8
(Ten digits used to force a 4-word integer.)
Packed Decimal:
The data types defined in the Dictionary as P, are mapped to COBOL
COMPUTATIONAL-3 data types. However, this data type is defined in COBOL
to occupy the same storage length as specified in the Dictionary,
regardless of digit length. If the digit length specified in the
Dictionary is sufficient to fill the storage length specified in the
Dictionary, then DICTCDE will use that digit length. If the number of
digits is insufficient to fill the specified storage length, then DICTCDE
will use the minimum number of digits to fill the storage length for the
entity. If the number of digits is too large, DICTCDE will use the
maximum number of digits allowed for the storage length.
For example, the following entities in the Dictionary are generated as
follows:
ELEMENT-TYPE = P
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 0 { PIC S9(8) COMP-3.
ELEMENT-LENGTH = 5
ELEMENT-TYPE = P
ELEMENT-SIZE = 9
ELEMENT-DECIMAL = 0 { PIC S9(9) COMP-3.
ELEMENT-LENGTH = 5
ELEMENT-TYPE = P
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 0 { PIC S9(10) COMP-3.
ELEMENT-LENGTH = 6
(Ten digits are used to force a 6 byte storage length.)
ELEMENT-TYPE = P
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 2 { PIC S9(5)V9(2) COMP-3.
ELEMENT-LENGTH = 4
The decimal point for the above entity requires a digit place.
VPLUS Data Items:
VPLUS forms only contain ASCII characters as storage format. Therefore,
regardless of the data types defined in the Dictionary, all VPLUS fields
are DISPLAY fields. You may choose to convert all VPLUS fields to PIC X
(regardless of the data type defined in the Dictionary). You may also
choose to define numeric fields as PIC 9. But you must ensure that
non-numeric data (except for a sign) will not appear in those fields.
The sign for signed numeric elements must appear in the first character
position unless the element was defined in the Dictionary as having a
TRAILING-SEPARATE sign. The trailing separate sign must appear in the
last character position.
The following shows the COBOL clauses generated for some VPLUS fields.
ELEMENT-TYPE = X
ELEMENT-SIZE = 8 { PIC X(8).
ELEMENT-LENGTH = 9
Note that the VPLUS field is generated by SIZE not by LENGTH. Also, the
next examples assume that the PIC 9 numeric option was enabled.
ELEMENT-TYPE = I+
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 0 { PIC 9(8).
ELEMENT-LENGTH = 4
ELEMENT-TYPE = I
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 0 { PIC S9(8) SIGN LEADING SEPARATE.
ELEMENT-LENGTH = 4
Note that the sign field generated the SIGN LEADING SEPARATE clause.
ELEMENT-TYPE = I
ELEMENT-SIZE = 8
ELEMENT-DECIMAL = 2 { PIC S9(5)V9(2) SIGN LEADING SEPARATE.
ELEMENT-LENGTH = 4
MPE/iX 5.0 Documentation