MEDIA - media codes, types of standard system format files.

Most files on the system are stored in what is known as GFRC format. This format is documented fully in the GMAP Pocket Guide and in the GCOS-8 File and Record Control manual. Here we will only give a rough outline of GFRC format types and their uses.

Every GFRC file is made up of a number of records; in a standard ASCII text file, for example, every line of text is a separate record. Each record has an accompanying Record Control Word (RCW) that contains the length of the record plus a few other tid-bits of information about the record. In particular, the RCW specifies the record's Report Code and its Media Code.

Report codes and media codes were originally designed for use by SYSOUT, the program that supervises such major output devices as printers and punches. However, other programs now pay attention to these codes (especially media codes), simply because they are convenient ways for determining the nature of a file's contents.

Report codes provide a way for SYSOUT to separate output according to its source. For example, a Fortran program may have several open output units, each of which may be receiving output destined for SYSOUT. Every time a record is written to one of these units, the unit number is used as the report code for the record. Later on, SYSOUT can go through the total output of the program and use the report codes to separate which records came from unit 06, which from 42, and so on. This allows the output from each unit to be printed separately instead of having the output records intermingled.

Media codes tell SYSOUT what processing is necessary when outputting each record. In particular, the media codes tell SYSOUT whether the output is designed for printing or punching. (At Waterloo we no longer have a punch, but some of the older software works with files in punched card formats, so we have not "retired" any of the elderly media codes.)

Each media code indicates a different type of record. Since files usually only consist of one type of record, it is common to use such terms as "a Media6 file", even though the media code refers to individual records in the file, not the file as a whole. Below we list the currently recognized media codes.

Media0
variable length BCD text.
Media1
binary data, variable length or card image. This media code is used for object decks and compressed source decks (comdks). When a Media1 record contains a binary card image, it is always 27 words long.
Media2
card image BCD. Media2 records are always 14 words long.
Media3
print image BCD. Media3 records always contain printer control codes.
Media4
user-specified format. The Waterloo B library uses Media4 as a binary byte stream file. This is the only file format that the library guarantees to read back the same sequence of bytes that were written out. Other media codes undergo one kind of translation or another that may lose some information.
Media5
old format TSS ASCII. This particular format is no longer used.
Media6
standard ASCII text. This is the sort of output that FRED normally produces, for example.
Media7
print image ASCII. This is standard ASCII text, but the records contain printer control codes. One of the main functions of SLIST is to convert files into Media7 format so that they can be printed.
Media8
is used for the file-header record of most Media6 files. A Media8 record has a fixed length of 20 words.
Media9
special print image BCD.
Media10
card image ASCII.
Media13
special print image ASCII.

As mentioned earlier, different programs use the various media codes for their own purposes. The way SYSOUT handles different media codes is described below.

  1. Media 0 records are printed as is, uninterpreted in any way.
  2. Media codes 1, 2, and 10 are sent to the punch. The punch may hang if the records are not the proper length. Media1 records will be treated as if they contain raw binary data; Media2 records will be treated as if they contain BCD data; and Media10 records will be treated as if they contain ASCII data.
  3. Media codes 3 and 7 will be printed on the line printer using the printer codes that are imbedded in the records.
  4. Media 4 and 6 records are NOT printed by SYSOUT; they are simply ignored.
  5. Media codes 9 and 13 are treated like Media codes 3 and 7 except that the first two characters of each record are assumed to contain an extended report code and are therefore ignored.

Copyright © 1996, Thinkage Ltd.