| Windows | COBOL | Data Size |
| char[n], str[n], tchar[n] | PIC X(n) | n bytes |
| long, long | PIC S9(18) COMP-5 | 8 bytes |
| unsigned long long |
PIC X(8) COMP-X or PIC 9(18) COMP-X |
8 bytes |
| long | SIGNED-LONG | 4 bytes |
| int | SIGNED-INT | 4 bytes |
| dword, ulong | UNSIGNED-LONG | 4 bytes |
| lpxxx | POINTER | 4 or 8 bytes (32-bit or 64-bit runtime) |
|
float, double |
FLOAT, DOUBLE | 4 or 8 bytes |
| short | SIGNED-SHORT | 2 bytes |
| word, ushort | UNSIGNED-SHORT | 2 bytes |
We recommend using COMP-N for most cases, although COMP-N data types are HEX, unsigned, and thus difficult for negative numbers.
If you want to use COMP-5, be sure to use the "--TruncANSI" compiler option. This causes truncation in binary to the capacity of the allocated storage for COMP-5 items. (By default, ACUCOBOL-GT truncates in decimal to the number of digits given in the PICTURE clause on arithmetic and non-arithmetic stores into COMP-5 items.) Note that the "-Dz" option overrides "--TruncANSI".
C structure to include:
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[ MAX_PATH ];
TCHAR cAlternateFileName[ 14 ];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
Resulting ACUCOBOL-GT group item:
01 WIN32-FIND-DATA.
03 dwFileAttributes UNSIGNED-LONG.
03 ftCreationTime.
05 dwLowCreateDT UNSIGNED-LONG.
05 dwHighCreateDT UNSIGNED-LONG.
03 ftLastAccessTime.
05 dwLowAccessDT UNSIGNED-LONG.
05 dwHighAccessDT UNSIGNED-LONG.
03 ftLastWriteTime.
05 dwLowWriteDT UNSIGNED-LONG.
05 dwHighWriteDT UNSIGNED-LONG.
03 nFileSizeHigh UNSIGNED-LONG.
03 nFileSizeLow UNSIGNED-LONG.
03 dwReserved0 UNSIGNED-LONG.
03 dwReserved1 UNSIGNED-LONG.
03 cFileName PIC X(260).
03 cAlternateFileName PIC X(14).