Barr S/370 file format is the internal data format Barr software uses for routing data to channel printers. The software converts files to this format, or you can generate files in this format on the PC.
When you select S/370 Channel receive mode on the Assign Devices screen, the software converts files received from mainframe or midrange systems to S/370 format. When you send PC-generated ASCII files to the printer, the software also converts them to S/370 format. However, plain ASCII files cannot take advantage of the printer’s channel command capabilities.
If you want PC-generated files to use channel commands, you can modify your programs to generate data in S/370 file format with channel commands.
You might want to generate PC files in the S/370 file format for these situations:
You do not want data translation to occur. For example, if you print files in the Xerox Metacode format to Xerox laser printers, data should not be translated. The software does not translate files that are already in the S/370 format.
You need complete control of channel commands. (For plain ASCII files, Barr software performs only the Skip to Channel 1 and Space 1 Line commands.)
You create printer resource files on the PC. Printer resources must be in S/370 file format. (Typically, you put resource files with the S/370 format in the forms overlay directory.)
If you only need to control channel skips for an ASCII file and you print to a Xerox printer with built-in forms, you do not need to use Barr S/370 format. Instead, you can use the channel skip sequences for Xerox printers described in Appendix C.
Two S/370 record formats are available: S/370 Byte-Length Record format and S/370 Word-Length Record format. The two formats support different maximum record lengths. With S/370 Byte-Length format, records can contain a maximum of 254 characters. With S/370 Word-Length format, records can be longer than 254 characters. (Realia COBOL uses the same formats.)
The software automatically uses S/370 Word-Length Record format for files received with S/370 Channel receive mode because some host systems allow records longer than 254 bytes. The software also uses Word-Length format for simple PC ASCII files. When you generate PC files in the S/370 format, you can create files in either Word-Length or Byte-Length format, but Byte-Length format usually is sufficient.
Files in S/370 format must have a four-byte format header at the beginning of the file. The format header bytes must have specific hexadecimal values. Because the format header indicates the maximum length of the data records within the file, format headers for the Word-Length and Byte-Length formats are slightly different.
Data records follow the file format header and are usually in EBCDIC because most channel printers require EBCDIC data. Records must contain count bytes indicating the record length and channel command characters. Additionally, most records contain print data. Follow the guidelines below when you create data records.
Include a record length count at the beginning and end of the record. Both length counts must have the same value and must include the number of data bytes plus one byte for carriage control.
Include only one channel command byte per record. For a list of channel commands, see section A.3.
Use the Byte-Length Record format for records that contain no more than 254 bytes of data.
Format header |
76 1A FF 00 |
|
Records |
Beginning length byte |
1 byte (01-FF) |
Channel command |
1 byte | |
Print data |
0 - 254 bytes | |
Ending length byte |
1 byte* |
*The Beginning and Ending length bytes have the same value.
In this example, the file contains a header and three records. Two of the records contain print text.
Header |
76 1A FF 00 |
|
Record 1 |
01 |
Beginning length byte (record contains one byte) |
|
8B |
Channel command (Skip to Channel 1) |
|
01 |
Ending length byte |
Record 2 |
04 |
Beginning length byte (record contains four bytes) |
|
09 |
Channel command (Write and Space 1 Line) |
|
C8 C9 5A |
EBCDIC data (HI!) |
|
04 |
Ending length bytes |
Record 3 |
05 |
Beginning length byte (record contains five bytes) |
|
89 |
Channel command (Write and Skip to Channel 1) |
|
C4 D6 D5 C5 |
EBCDIC data (DONE) |
|
05 |
Ending length byte |
Use the S/370 Word-Length Record format for records that contain more than 254 bytes. Note the different format headers for S/370 Word-Length Record format and S/370 Byte-Length Record format. Also, the record length counts for Word-length Record format have two bytes.
Format header |
76 1A FF FF |
|
Records |
Beginning length byte |
2 bytes (01-FF, LSB MSB) |
Channel command |
1 byte | |
Print data |
0 - n bytes | |
Ending length byte |
2 bytes* |
*The Beginning and Ending length bytes have the same values.
For S/370 Word-Length Record format, you must give the record length counts in INTEL format, where the most significant byte (MSB) follows the least significant byte (LSB). For example, you would represent the length value 0150 as 50 01.
This example contains the same carriage control commands and print text as the Byte-Length example, but the information is in Word-Length format.
Header |
76 1A FF FF |
|
Record 1 |
01 00 |
Beginning length bytes (record contains one byte) |
|
8B |
Channel command (Skip to Channel 1) |
|
01 00 |
Ending length bytes |
Record 2 |
04 00 |
Beginning length bytes (record contains four bytes) |
|
09 |
Channel command (Write and Space 1 Line) |
|
C8 C9 5A |
Data (HI!) |
|
04 00 |
Ending length bytes |
Record 3 |
05 00 |
Beginning length bytes (five bytes of information) |
|
89 |
Channel command (Write and Skip to Channel 1) |
|
C4 D6 D5 C5 |
Data (DONE) |
|
05 00 |
Ending length bytes |
When you code or decode files with the S/370 format, refer to the channel commands described in this section. The three types of channel command types are as follows:
Commands that perform carriage control functions
Commands that perform other functions
Commands reserved for the Barr software
Carriage control is the ability to control the position of text on an output device. You can use carriage control commands to move the printer carriage from one line on the page to another or move to a new page.
For some systems, such as PC’s, data is a stream of characters being sent to an output device. Some of these characters are carriage control characters such as CR (carriage return), LF (line feed), and FF (form feed). SCS (SNA Character Stream) works in the same fashion: a stream of characters, some of which are control characters.
While mainframes store data records, each record of printer output has both carriage control and data associated with it. The carriage control is usually the first position of the record and the data follows. The data field may be empty. When the file is referenced, there is a record format parameter that tells the system if carriage control exists and what type of carriage control is being used. When these records are being directed to the printer, the channel software converts the carriage control (if necessary) into the appropriate channel command. The software then passes this command and any data in the record to the printer.
Table A-1. Channel Commands without Data
Carriage Control |
Machine |
Machine |
ASA (ANSI) |
SCS |
ASCII |
Do Not Space |
03 (No Op) |
01 |
+ |
0D |
0D |
Space one line |
0B |
09 |
Space |
15 |
0D 0A |
Space two lines |
13 |
11 |
0 |
15 15 |
|
Space three lines |
1B |
19 |
- |
15 15 15 |
|
Skip to Channel 1 |
8B |
89 |
1 |
0C or 04 81 |
0C |
Skip to Channel 2 |
93 |
91 |
2 |
04 82 |
|
Skip to Channel 3 |
9B |
99 |
3 |
04 83 |
|
Skip to Channel 4 |
A3 |
A1 |
4 |
04 84 |
|
Skip to Channel 5 |
AB |
A9 |
5 |
04 85 |
|
Skip to Channel 6 |
B3 |
B1 |
6 |
04 86 |
|
Skip to Channel 7 |
BB |
B9 |
7 |
04 87 |
|
Skip to Channel 8 |
C3 |
C1 |
8 |
04 88 |
|
Skip to Channel 9 |
CB |
C9 |
9 |
04 89 |
|
Skip to Channel 10 |
D3 |
D1 |
A |
04 7A |
|
Skip to Channel 11 |
DB |
D9 |
B |
04 7B |
|
Skip to Channel 12 |
E3 |
E1 |
C |
04 7C |
|
There are differences between carriage control commands. ASA and Machine carriage control are both based on records, however, they perform their skip at different times. ASA carriage control is executed before the line of data is written. Machine carriage control is executed after the data is written. These two techniques will be referred to as Skip Before and Skip After. It is not correct to refer to ASCII or SCS as Skip Before or Skip After, they are character streams and the carriage control has a relationship to the data based on its position in the character stream.
PRINT370 uses machine carriage control commands. These commands are grouped into two categories: commands you can include in records without data (see Table A-2) and commands you can include in records with data (Table A-3).
For example, use the 0B command in Table A-2 to advance the printer one line, but use the 09 command in Table A-3 to print a data record and then advance one line.
Table A-2. Channel Commands without Data
Command Description |
Command |
No Operation |
03 |
Space 1 Line Immediate |
0B |
Space 2 Lines Immediate |
13 |
Space 3 Lines Immediate |
1B |
Skip to Channel 1 Immediate |
8B |
Skip to Channel 2 Immediate |
93 |
Skip to Channel 3 Immediate |
9B |
Skip to Channel 4 Immediate |
A3 |
Skip to Channel 5 Immediate |
AB |
Skip to Channel 6 Immediate |
B3 |
Skip to Channel 7 Immediate |
BB |
Skip to Channel 8 Immediate |
C3 |
Skip to Channel 9 Immediate |
CB |
Skip to Channel 10 Immediate |
D3 |
Skip to Channel 11 Immediate |
DB |
Skip to Channel 12 Immediate |
E3 |
Table A-3. Channel Commands with Data
Command Description |
Command |
Write without Spacing |
01 |
Write and Space 1 Line |
09 |
Write and Space 2 Lines |
11 |
Write and Space 3 Lines |
19 |
Write and Skip to Channel 1 |
89 |
Write and Skip to Channel 2 |
91 |
Write and Skip to Channel 3 |
99 |
Write and Skip to Channel 4 |
A1 |
Write and Skip to Channel 5 |
A9 |
Write and Skip to Channel 6 |
B1 |
Write and Skip to Channel 7 |
B9 |
Write and Skip to Channel 8 |
C1 |
Write and Skip to Channel 9 |
C9 |
Write and Skip to Channel 10 |
D1 |
Write and Skip to Channel 11 |
D9 |
Write and Skip to Channel 12 |
E1 |
Some channel commands perform functions other than carriage control (see Table A-4). For example, they cause the printer to disable printer Data Check errors, fold lowercase characters to uppercase, load a Forms Control Buffer (FCB), or load a Universal Character Set Buffer (UCSB).
Table A-4. Other Channel Commands
Command Description |
Command |
Block Data Check |
73 |
Allow Data Check |
7B |
Fold |
43 |
Unfold |
23 |
Load FCB |
63 |
Load UCSB |
FB |
A few commands are reserved by the Barr software (see Table A-5). The C6 and FF commands are used in the Barr spool header. The software processes records beginning with these commands, but does not necessarily send the records to the printer. Be careful not to code these two commands when you generate PC files in the S/370 format. Instead, you can use the special FD command described in this section.
Table A-5. Commands Reserved by Barr Software
Command Description |
Command |
3211 FCB |
C6 |
Translate Next Command |
FD |
Start of Spool Header Record |
FF |
The FD command causes the software to translate a channel command to another command before the software sends the command to the printer. You can use this command when you receive data from a mainframe and the data contains a printer command character that is not defined to the SNA character set. Normally, the mainframe discards undefined command characters, so the non-standard command character is not sent to the PC.
At the mainframe, you can substitute a valid channel command that you are not using in your print jobs. When the PC receives the job, the substitute command is intact. When the job is sent to the printer, the Barr software replaces the substitute command with the desired printer command.
When you use the FD command, you must code it as a record in the Barr S/370 format. The record must have four bytes of command information and two count bytes. The command bytes are the FD command, the command to translate from, the command to translate to, and the command type. The translation remains in effect until another translate request is issued using the same substitute command.
For example, assume that you have an IBM 3800 or equivalent printer that uses the Mark Form command (17). This command marks the page perforation to make job separation easier. Although Mark Form is a valid command for printing to a mainframe-attached channel printer, it is not valid for remote printing. Pick a valid channel command that you do not use, such as Skip to Channel 10 (D1), and substitute it for all instances of the 17 character in the mainframe data. Then code the FD command in a printer initialization file, a form overlay file, or a printer control data string as follows:
04 |
Beginning count byte (four bytes of data). |
FD |
Translate command. |
D1 |
Command to translate from (Skip to Channel 10). |
17 |
Command to translate to (Mark Form). |
00 |
Type of the command you are translating to. Use 00 for commands without data (control commands) or 03 for commands with print data (write commands). |
04 |
Ending count byte (matches beginning count byte). |
When the Barr software sends the data to the printer, it performs the translation according to the FD command sequence and converts all instances of D1 to 17. The software continues to translate the command, until it encounters another translate request for the unused command (Skip to Channel 10) in the file.