Previous Topic Next topic Print topic


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 class JVM type C# type 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 unsigned integer

Not CLS-compliant

binary-short unsigned System.UInt16 ushort A 16-bit signed 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:
pic n usage national System.Char char char A unicode (16-bit) character
object reference sys-Decimal * System.Decimal decimal A 96-bit decimal value
object reference sys-IntPtr * System.IntPtr A signed integer whose size depends on the underlying platform (a 32-bit value on a 32-bit platform and a 64-bit value on a 64-bit platform)
object reference sys-UIntPtr * System.UIntPtr An unsigned integer whose size depends on the underlying platform (a 32- bit value on a 32-bit platform and a 64-bit value on a 64-bit platform)

Not CLS-compliant

Class objects:
object reference System.Object java.lang.Object object The root of the object hierarchy
object reference sys-String * System.String java.lang.String string An immutable, fixed-length string of Unicode characters

Where sys-decimal, sys-IntPtr, sys-UIntPtr, sys-Object and sysString are names that you choose, and where the code defines these as follows:

repository .
    class sys-decimal as "System.Decimal"
    class sys-IntPtr as "System.IntPtr"
    class sys-UIntPtr as "System.UIntPtr"
    class sys-Object as "System.Object"
    class sys-String as "System.String"
.
Previous Topic Next topic Print topic