| Front Page | News Headlines | Technical Headlines | Planning Features | Advanced Search |
3k Associates Sponsor Message

September 2002

Boost Your HP 3000 Productivity

Knowing More About CCTL

By Bob Green

I have had several e-mails from programmers looking at old COBOL/FORTRAN systems and being totally lost dealing with carriage control for the printer. Here’s some tips on an MPE detail you might encounter while maintaining your applications.

Carriage Control explained

On MPE, CCTL stands for Carriage Control, which is the process of moving the print position (or “carriage”) to the next line or page, as well as performing advanced functions such as overprinting and printing through the perforation. Normally the program specifies the CCTL code for a line through the fwrite intrinsic. For a list of the code values, visit docs.hp.com on the net. MPE has too many ways to do CCTL and modern printers are controlled via PostScript or Printer Command Language (PCL) anyway.
When MPE creates a CCTL file, it puts the Carriage Control code in the first byte of each record. However, when you use the FCONTROL intrinsic to specify CCTL codes, they are not written to disc files and are encoded in a special way in spool files. Therefore, programs will be more robust if you stick to a subset of possible CCTL methods which works in all cases.

The most confusing thing: CCTL and record length

For files built with the CCTL option, the recsize you specify when you open a file is 1 byte smaller than that shown by :Listf and returned by the FGETINFO intrinsic. When duplicating a file with the :Build command, remember to subtract one from the recsize shown by :Listf.

Things you should do

When you open a file, specify CCTL in the FOPTIONS parameter for report files. In calls to the FWRITE intrinsic either put the CCTL value in the first data column and specify 1 in the last FWRITE parameter, or put the CCTL value as the last parameter to FWRITE. Always FWRITE with at least one data character, even if it is a blank. Otherwise, MPE may discard the CCTL value.

Use a simple set of CCTL values: “@” for single space, “1” for page eject, “+” to overprint, %320 for prompt messages, “@” for post-spacing, “A” for pre-spacing, “B” to skip over the perforation, and “C” to print through the perforation.

Things to avoid

Never use the FCONTROL intrinsic to do CCTL. Never FWRITE with a data length of 0. Do not use multirecord writes for “easy” folding of lines. Do not use fancy CCTL values, such as “-“ for “triple spacing without skip-on-perf.” Do not use binary 0 for single spacing; use Space (“ “) instead.

Prespacing Versus Postspacing

The default is postspacing: print the line, then the Return and Line feed, leaving the cursor on a new line. FORTRAN uses prespacing: first print the Return and Line feed, then the data, and leave the cursor after the last data character. If you call a FORTRAN subroutine that does terminal IO, reset $Stdlist postspacing upon return.

COBOL’s After Advancing feature uses prespacing; you do page ejects with a Special Name that is equal to TOP. When Listing a CCTL file with Qedit you can specify $PRE or $POST to explicitly set pre- or postspacing.

Editing CCTL disk files

Be careful when editing files with CCTL values in column one. EDITOR does not duplicate the CCTL attribute on Keep, but Qedit does. MPE has two CCTL values for single-space: Space and binary zero. Binary zero is the Null character and does not show on the Crt. This shifts the listing of the line left one column, making it difficult to edit columns. Qedit automatically converts the binary zero into a space when you Text a CCTL file. 


Copyright The 3000 NewsWire. All rights reserved.