Printable formatting in DFSORT refers to how report output is prepared for printing or viewing: specifically carriage control (the first byte of each record that tells the printer to eject a page, skip a line, or single space) and the options that change or remove it. When DFSORT builds reports with HEADER1, HEADER2, LINES=, SECTIONS=, and related parameters, it typically inserts ASA (American Standards Association) or machine carriage control in the first byte of each line. For output sent to a printer, that byte is needed so the printer can advance correctly. For output that will be viewed online, edited, or imported (e.g. into Excel or HTML), that byte can cause problems, so you use REMOVECC to strip it. Options like BLKCCH1, BLKCCH2, and BLKCCT1 replace specific control characters with blanks so headers and trailers do not force unwanted page ejects. This page explains carriage control, when to use REMOVECC, and how BLKCCH1/BLKCCH2/BLKCCT1 affect report layout. For report structure (headers, trailers, pagination), see Report writing and Building reports.
On the mainframe, carriage control is the convention that the first byte of each record in a print file is not data but an instruction to the printer: advance to the next page, skip one line, single space, or overprint. The printer reads that byte and acts on it; it does not print that byte as part of the line. So from the application's point of view, the "content" of the line starts at byte 2, but the full record (including the control byte) is what gets written to the dataset or sent to the printer. ASA (American Standards Association) carriage control uses single-byte codes; some environments use machine (MCC) control with different conventions. DFSORT report output often uses ASA by default when you build reports with LINES=, HEADER, and TRAILER.
The exact meaning of each character can vary by site and printer; the following are typical:
| Character | Meaning |
|---|---|
| 1 | Page eject: advance to the top of the next page. Used at the start of a new page (e.g. first line of HEADER2 on each page). |
| 0 | Double space: skip one blank line (advance two lines). Used to leave a blank line between sections or after a title. |
| Single space: advance one line. Normal line spacing for detail lines. | |
| + | No advance (overprint): do not advance; print on the same line. Used for underlining or overprinting. |
| - | Triple space: skip two blank lines (advance three lines). Less common. |
So when DFSORT writes a report with pagination (LINES=), it may put "1" in the first byte of the first line of each page (the page header) so the printer ejects to a new page. Detail lines may have " " (blank) for single spacing. If you view that file in an editor or send it to a program that does not interpret the first byte, you see that character as part of the line (e.g. a leading "1" or blank), which can look wrong or break fixed-position parsing. REMOVECC removes that first byte so the line contains only the printable content.
REMOVECC tells DFSORT to remove the first byte (the carriage control character) from each record written by that OUTFIL. After REMOVECC, each record is one byte shorter. Use REMOVECC when:
Do not use REMOVECC when the output is going to a printer or print subsystem that expects ASA (or machine) control. In that case the first byte is required for correct page ejects and line spacing; removing it would cause incorrect paging or spacing.
Because REMOVECC removes one byte from each record, the output record length is one less than it would be without REMOVECC. For example, if the report would normally produce 81-byte records (1 control + 80 data), with REMOVECC each record is 80 bytes. The DD statement for the OUTFIL output should specify an LRECL that matches the actual output (80 in this example). Some products adjust this automatically for OUTFIL; check your DFSORT manual. If you copy the file or use it in a downstream step, ensure the receiving program or dataset expects the shorter record length.
By default, the first character of the first line of HEADER1 might be set to a control character that causes a page eject. So the report title would appear on its own page, and the first data would start on the next page—leaving a blank page in between. BLKCCH1 (block carriage control header 1) tells DFSORT to replace that first character with a blank. After that, the first line of HEADER1 no longer triggers a page eject, so the report header and the first detail lines can appear on the same page. Use BLKCCH1 when you want the title and the first data together instead of on separate pages.
Similarly, the first character of HEADER2 (the page header) might be a page-eject character. That can cause the first page header to eject before printing, so the first page of data appears to start with a blank or wrong line. BLKCCH2 replaces the first character of the first line of HEADER2 with a blank so the first page header does not force an extra page eject. Use BLKCCH2 when you want the first page header and the first data on the same page (e.g. when HEADER1 and HEADER2 are both used and you do not want two ejects before the data).
BLKCCT1 (block carriage control trailer 1) replaces the first character of the first line of TRAILER1 with a blank. That prevents the report trailer from forcing a new page. So the last detail lines and the report trailer (e.g. grand total, record count) can appear on the same page instead of the trailer alone on a new page. Use BLKCCT1 when you want the report footer to follow the last data on the same page.
| Option | Effect |
|---|---|
| REMOVECC | Remove the first byte (carriage control) from each record. Use for online/view/file output. |
| BLKCCH1 | Replace first char of first line of HEADER1 with blank; avoid page eject after report title. |
| BLKCCH2 | Replace first char of first line of HEADER2 with blank; avoid extra page eject on first page. |
| BLKCCT1 | Replace first char of first line of TRAILER1 with blank; keep report trailer on same page as last data. |
Same OUTFIL can be used for two outputs: one for the printer (with carriage control) and one for viewing (with REMOVECC). You would use two OUTFIL statements with different FNAMES= and only one would specify REMOVECC. Conceptually:
12OUTFIL FNAMES=PRINT,BUILD=(1,80),HEADER1=(1:'REPORT'),LINES=60 OUTFIL FNAMES=VIEW,BUILD=(1,80),HEADER1=(1:'REPORT'),LINES=60,REMOVECC
PRINT might go to a printer DD; VIEW might go to a dataset for browsing or export. PRINT keeps the first-byte control character; VIEW strips it. BUILD and headers are the same; only REMOVECC differs. In practice you might use a single OUTFIL and choose REMOVECC based on where the output is going.
Imagine every line of the report has a secret first letter that tells the printer "go to the next page" or "move down one line." The printer reads that letter and does the action but does not print it. When you look at the file on the screen, that letter is still there and can look funny or mess up your columns. REMOVECC is like erasing that first letter so the line only has the real words and numbers. When you send the report to a real printer, you leave that letter in so the printer knows what to do.
1. What is the first byte of each record used for in traditional mainframe print files?
2. When should you use REMOVECC on OUTFIL?
3. What does BLKCCH1 do?
4. After REMOVECC, what happens to the record length?
5. Why might you omit REMOVECC when sending a report to a printer?