IBM Support

How to generate ASCII (or ASA) carriage control for COBOL print files.

Question & Answer


Question

The first character of a record, which is the printer carriage control byte, may contain an ASCII byte or a machine byte. I want to use only ASCII for my printer. Page eject ASCII X'F1' or C'1' - not machine X'8B' Space line ASCII X'40' or C(blank) - not machine X'09' Double space ASCII X'F0' or C'0' - not machine X'11' Triple space ASCII X'60' or C'-' - not machine X'19' No spacing ASCII X'4E' or C'+' - not machine X'01'

Cause

The COBOL Language reference just says "a control byte". There isn't anything in the ANSI standard that guarantees ASCII or machine. Implementation of paper positioning is left up to the vendor. The page-eject byte for example, on mainframes is either the ASA hex X'F1' or machine X'8B'. On Windows machines it may be hex X'0D0A'. On Unix machines it is usually hex X'0C'.

Answer

Please view APAR PL24833 for additional documentation.
It says to use WRITE AFTER ADVANCING exclusively to get ANSII or ASA control characters.
In other words, don't mix these commands for the same file:
WRITE rec-name AFTER ADVANCING 1 LINE.
WRITE rec-name BEFORE ADVANCING 1 LINE.
WRITE rec-name.
Using BEFORE ADVANCING or a mix of BEFORE and AFTER will produce machine format control characters.
But as the warning above in the "cause" section says, relying on the ASA byte method for vertical page control is dangerous. If you rely on the ASA byte with Enterprise COBOL for z/OS then you will not be able to port the program to COBOL for AIX.

When a print file is defined as EXTERNAL, machine control characters are always used.

[{"Product":{"code":"SS6SG3","label":"Enterprise COBOL for z\/OS"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Component":"Runtime","Platform":[{"code":"PF025","label":"Platform Independent"},{"code":"PF035","label":"z\/OS"}],"Version":"3.4;4.1;4.2","Edition":"","Line of Business":{"code":"LOB17","label":"Mainframe TPS"}},{"Product":{"code":"SS6SGM","label":"COBOL for AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Runtime","Platform":[{"code":"","label":""}],"Version":"4.1.1","Edition":"","Line of Business":{"code":"LOB17","label":"Mainframe TPS"}}]

Document Information

Modified date:
08 August 2018

UID

swg21240217