Skip to main content

Problem:

Is the data stored in a COBOL file stored as portable data?

That is, if copying a COBOL file to little or high endian systems, will still be able to access the data?

Resolution:

The answer is no, but there are workarounds.

Defining data within programs as COMP-5, the local bit ordering will be used and therefore it will vary within different platforms.  Obviously this is the type needed to define if passing this data to C programs that the define it as int, long....

But Micro Focus COBOL allows to define data as COMP-X which is a platform portable data type.  COMP-X has the same bit ordering as COMP-5 in some platforms but it differs in others.

So the solution would be to store data in files as COMP-X, but if doing a lot of mixed language programming, ensure to move COMP-X to COMP-5 data items to be used as parameters for the call.

Old KB# 4302