Carriage Control - Print positioning
In IBM mainframe systems, carriage control refers to special characters or bytes embedded as the first character of a print record that instruct the printer on how to position the paper vertically before printing the rest of the line. It dictates vertical spacing, such as single spacing, double spacing, skipping lines, or advancing to a new page.
Key Characteristics
-
- Implicit Control: Carriage control characters are typically implicit, meaning they are the first byte of the print record and are not printed themselves, but rather interpreted by the printer or print spooler (e.g., JES).
- ASA (American Standard Association) Control: A widely used standard where specific characters (e.g., blank for single space, '0' for double space, '1' for new page, '+' for no space/overprint) are placed in the first byte.
- Machine Code Control: An older, IBM-specific standard using hexadecimal values (e.g., X'09' for single space, X'11' for double space) for similar vertical positioning.
- JCL Integration: The type of carriage control is specified in JCL via the
DCBparameter, typicallyRECFM=FBAfor ASA control orRECFM=FBMfor Machine code control. - Record Length Impact: When using carriage control, the logical record length (
LRECL) specified in theDCBmust account for the control character, meaning the user's data length isLRECL - 1. - Printer Interpretation: The Job Entry Subsystem (JES) or the printer driver translates these control characters into actual printer commands (e.g., form feeds, line feeds) before sending the data to the physical printer.
Use Cases
-
- Report Generation: COBOL programs generating batch reports use carriage control extensively to format output, ensuring proper page breaks for headings, consistent spacing between detail lines, and summary sections.
- Invoice and Statement Printing: Applications printing financial documents rely on precise carriage control to align data accurately on pre-printed forms, ensuring fields like customer address, item details, and totals appear in the correct positions.
- Log File Formatting: Batch jobs or system utilities use basic carriage control (e.g., single spacing) to produce readable output for audit trails, job logs, or diagnostic messages.
- Form Letter Creation: Advanced usage, like the
'+'(overprint) ASA character, allows printing multiple lines on the same physical line, useful for creating bold text or combining data elements for specific formatting needs. - Spooling and Archiving: JES processes output datasets with carriage control, which is crucial for correct rendering whether the output is sent to a physical printer, a print server, or archived electronically (e.g., in AFP format or as a PDF).
Related Concepts
Carriage control is a fundamental aspect of print dataset formatting on z/OS. It is intrinsically linked to JCL (Job Control Language), where the DCB parameter defines the record format (RECFM) that dictates the presence and type of carriage control. COBOL programs are typically responsible for embedding these control characters as the first byte of their print records. The Job Entry Subsystem (JES) plays a critical role in interpreting these characters and managing the print queue, translating them into physical printer commands before sending the output to printers or VTAM/SNA devices.
- Standardize Control Type: Consistently use either ASA or Machine code control within an application or across related applications to simplify maintenance and ensure predictable output. ASA is generally preferred for its readability.
- Match JCL and Program: Always ensure that the
DCBparameters in the JCL (e.g.,RECFM=FBAfor ASA,RECFM=FBMfor Machine) accurately reflect the carriage control characters embedded by the application program. Mismatches lead to garbled output. - Test Thoroughly: Rigorously test print programs with various data volumes and edge cases to verify correct page breaks, spacing, and alignment, especially when printing to pre-printed forms.
- Document Usage: Clearly document which carriage control characters are used by programs and their intended effect