TSS - Cobol 68 file processing in TSS.

This explain file discusses how to write and use Cobol 68 programs to perform processing using sequential files and/or the terminal in TSS.

The information given here has been extracted from the "Standard Cobol-68 User's Guide", which should be consulted if this explain file does not meet your needs.

Compile time considerations:

The way you associate a file description in your DATA DIVISION with some external file or device is to use a SELECT statement in the FILE-CONTROL portion of the ENVIRONMENT DIVISION. The standard form of the SELECT statement is

SELECT fd-name ASSIGN TO fc-SYSFORM

where "fd-name" is the name of the file description given in the DATA DIVISION and "fc" is an external file code that consists of a letter followed by a letter or a digit and which is not the same as any COBOL 68 reserved word. The "-SYSFORM" after the file code indicates that the file is to be in standard system format, just like files you prepare with FRED. Other options are shown in the manual, but this is the one you need to handle an ordinary sequential file.

There should be one SELECT statement for every file you intend to process.

Run time considerations:

When you use the OPEN verb on one of your file descriptions in TSS, COBOL 68 run-time routines first look in the AFT for a file with a name that is the same as the file code. If it is not present, the run-time routines will call ACCESS to let you access the file. The result will be something like this.

open-mode FILE fc NOT IN AFT - ACCESS CALLED
    FUNCTION ?

where "open-mode" is either READ or WRITE and "fc" is the file code in question.

You can respond to the FUNCTION~? question with an ACCESS command, a carriage return, or a "!" followed by any TSS command. You may want to use the latter to get a permanent file into the AFT under an altname that matches the "fc" in the message, or to define a temporary file whose name matches the given "fc" (this is useful only when writing). In any case, to get out of ACCESS just type a null line (carriage return only).

When ACCESS returns, the run-time routines again search the AFT for a file with the same name as the file code. If it is found, it is used; otherwise the terminal is used.

Thus if you want to associate a file description with a disk file before running a program, use either the TEMP or GET command to place in the AFT a file with an AFT name which matches the file code. If you want to associate a file description with the terminal, remove from the AFT any file with an AFT name matching the file code and type a carriage return in reply to the FUNCTION~? question.

A TSS COBOL program will read BCD or ASCII files. It will use ASCII when dealing with the terminal. For output files, it will write what is technically known as media 0 (variable length) BCD.

Although one usually works with Media 6 ASCII files in TSS, you should have no problem working with Media 0 files as long as you use UW Tools commands. For instance, FRED will read them, L will list them, and SLIST will print them. On the other hand, some stock GCOS-8 commands will refuse to touch them.

Copyright © 1996, Thinkage Ltd.