COBOL files in CFF stage

It could be a complex cobol copybook structure which has a good mix of occurs, redefines and level 88, COMP and COMP3.

Note

Packed (Comp-3)

Binary (Comp)

Or it could be a simple one such as below:

********************************
* COBOL DECLARATION FOR ORDERS *
********************************

01 HEADER.
05 RECTYPE PIC X(1).
05 NAME PIC X(20).
05 ORDDATE PIC X(10).

01 DETAIL.
05 ORDERNUM PIC S9(5).
05 RECTYPE PIC X(1).
05 PRODUCTID PIC S9(5).
05 QTY PIC S9(5).

But the main issue is that the source file would be in a native EBCDIC binary format and not ASCII. The source text file is generated from Mainframe and uses EBDIC format. Each row has different type of data columns and varies depending on available data.  Mostly a header, one or more type of detail records and a trailer record.

what stage?

Either way, use a CFF stage, import the copybook layout and view the source content through CFF (server) stage. Using sequential stage could throw errors such as import error, buffer overrun, etc. Seq file stage does do the EBCIDIC to ACII conversion, but not well if it has odd fields like packed decimal and such.

endianness

endianness (Byte Order) setting would need to be checked for Binary/Comp fields. The same file definition could change based on the byte order

849 = x0351 Big Endian
20739 = x5103 Little Endian

more details on Endianness https://en.wikipedia.org/wiki/Endianness

Convertion to ASCII string

COMP-3 is a decimal storage format. When a decimal is converted to a string, it will contain a decimal point. If the scale of the decimal is 0, that decimal point will still be present in the string as the last byte.

If the scale is 0, you can likely just convert the decimal to an integer column before writing to your output.

Check with the mainframe whether they are using CCSID 037 or CCSID 500 or others. Sometime simple COBOL files can be read as binary data type and by using ASCII function in the transformer stage.

Make sure “Unicode” is used in column property

IBM037 or IBM500 is used in NLS (default is probably UTF-8)

More COBOL notes

CCSID 500 — This is an EBCDIC code page, used mainly on z/OS. It is known as the ‘International’ codepage. The related CCSID with Euro support is 1148.

CCSID 037 — This is another popular EBCDIC code page, used on OS/400 and VSE/ ESA. It is the ‘US English’ codepage. The related CCSID with Euro support is 1140.

Leave a Reply

Your email address will not be published. Required fields are marked *