Table 2-4 lists compatible data types for determining equivalent argument type correspondence. Some data types (for example, char in C) are used more than once in the table to show the correspondence of equivalent types in more than two languages. The subscripts used in the table have the following meanings:
PL/I | ||||||
---|---|---|---|---|---|---|
COBOL | C | C++ | FORTRAN | BASIC | PASCAL | |
Fixed Bin, P <= 7 | COMP PIC S9 (1) – S9 (2) |
char | char | INTEGER*1 | – | – |
Fixed Bin, 8 <= P <= 15 |
COMP PIC S 9 (3) – S 9 (4) |
short | short | INTEGER*2 | INTEGER (%) | Integer |
Fixed Bin, P >15 | COMP PIC S 9 (5) – S 9 (9) |
int or long | int or long | INTEGER*4 | – | Integer |
– | – | char | char | INTEGER*1 | – | Packed Array[1...5] |
Character (n) | DISPLAY A(n) or PIC X(n) | char [n] | char[n] | CHARACTER*n | – | – |
Character (N) Varying | DISPLAY PIC X OCCURS num1 to num2 DEPENDING on N |
struct {short s; char c[n];} |
struct {short s; char c[n];} |
– | – | Char |
Character (1) | DISPLAY PIC X | char | char | CHARACTER*1 | – | – |
Character (*) | – | char[ ] | char[ ] | – | – | – |
Fixed Decimal | COMP–3 PIC S9 (n) | – | – | – | – | – |
DISPLAY PIC S9(n) SIGN TRAILING | – | – | – | – | – | |
– | DISPLAY PIC S9(n) SIGN LEADING SEPARATE | – | – | – | – | – |
– | DISPLAY PIC S9(n) SIGN TRAILING SEPARATE | – | – | – | – | – |
Bit(1) | – | – | – | – | – | – |
Bit(1) Aligned | – | char | char | – | – | Boolean |
Bit(N) Aligned | COMP–5 PIC [S] 9 (n), n<5 |
– | – | – | – | Set |
– | – | int or long | int or long | LOGICAL*4 | – | – |
– | – | short | short | LOGICAL*2 | – | – |
– | – | char | char | LOGICAL*1 /BYTE | – | – |
Float Bin, p > 23 | COMP–2 | double | double | REAL*8 | REAL (#) (MBASIC) | – |
Float Bin, p <= 22 | COMP–1 | float | float | REAL*4 | REAL (1) (MBASIC) | Real |
– | – | struct {float real, imaginary;} |
struct {float real, imaginary;} |
COMPLEX*8 | – | – |
– | – | struct {double real; double imaginary} |
#include <complex.h> class complex | COMPLEX*16 | – | – |
Pointer | – | Pointer | Pointer | – | – | Pointer |
Label | – | – | – | alternate return | – | – |
Entry | DISPLAY PIC X(32) | – | – | Dummy procedure | – | – |
Float Decimal | – | – | – | – | REAL (CBASIC) | – |
– | – | – | – | – | STRING ($) |
– |
Area | – | – | – | – | – | – |
Offset | COMP PIC S 9 (5) – S 9 (9) |
int or long | int or long | INTEGER*4 | – | integer |