Type Compatibility of Managed COBOL with Other Managed Languages

Many managed COBOL types have a strict correspondence with managed types in other languages, such as binary-long and float-short. For those that don't have a correspondence, there are alternatives.

The following table lists the correspondence between managed COBOL types and classes and types in other managed languages.

Managed COBOL .NET type JVM type C# keyword Description
Integer types:
binary-char System.SByte byte sbyte An 8-bit signed integer

Not CLS-compliant

binary-char unsigned System.Byte byte An 8-bit unsigned integer
binary-short System.Int16 short short A 16-bit signed integer

Not CLS-compliant

binary-short unsigned System.UInt16 ushort A 16-bit unsigned integer
binary-long System.Int32 int int A 32-bit signed integer
binary-long unsigned System.UInt32 uint A 32-bit unsigned integer

Not CLS-compliant.

binary-double System.Int64 long long A 64-bit signed integer
binary-double unsigned System.UInt64 ulong A 64-bit unsigned integer

Not CLS-compliant

Floating point types:
float-short System.Single float float A single-precision (32-bit) floating-point number
float-long System.Double double double A double-precision (64-bit) floating-point number
Logical types:
condition-value System.Boolean boolean bool A boolean value (true or false)
Other types:
character System.Char char char A unicode (16-bit) character
decimal System.Decimal see JVMDECIMAL. decimal A 96-bit decimal value
Class objects:
object System.Object java.lang.Object object The root of the object hierarchy
string System.String java.lang.String string An immutable, fixed-length string of Unicode characters
Collection types:
list System.Collections.Generic.IList<T> java.util.List An ordered collection of items
dictionary System.Collections.Generic.IDictionary<TKey, TValue> java.util.Map A mapping of keys to values

Examples:

       local-storage section.
       01 aByte binary-char unsigned.
       01 aSignedByte binary-char.
       01 anInt16 binary-short.
       01 anInt32 binary-long.
       01 anInt64 binary-double.
       01 anUnsignedInt16 binary-short unsigned.
       01 anUnsignedInt32 binary-long unsigned.
       01 anUnsignedInt64 binary-double unsigned.
       01 aSingle float-short.
       01 aDouble float-long.
       01 aBoolean condition-value.
       01 aChar character.
       01 aDecimal decimal.
       01 anIntPtr type IntPtr.
       01 anUnsignedIntPtr type UIntPtr.
       01 anObject object.
       01 aString string.