Using the Task File

The task file is a predeclared printer backup file that is associated with each process. If a program dump is directed to a task file, the task file is automatically queued for printing, in the same way as other printer backup files produced by a process. If a process generates multiple program dumps, then by default, they are all stored in the same task file.

You can use the TASKFILE task attribute to write comments to the task file or interrogate the file attributes of the task file. You can also use this task attribute in a program to force multiple program dumps to be stored in separate backup files. The program can achieve this effect by closing the task file after each dump and then writing a comment to the task file. An example of this method is given in the TASKFILE task attribute description in the Task Attributes Programming Reference Manual.

A program can also use the TASKFILE task attribute to access the task file of an ancestor process.

You can assign file attributes to the task file through file equation. This task attribute can be assigned only before process initiation. The following is a WFL example of such an assignment:

RUN OBJECT/PROG;
  FILE TASKFILE (PRINTDISPOSITION=DONTPRINT,USERBACKUPNAME=TRUE,
                 FILENAME=PROG/DUMP);

You can also use the BDNAME task attribute to save the task file and assign a prefix other than *BD to the file title.

Some security restrictions apply if file equations or a BDNAME task attribute assignment is used to prefix the task file title with a usercode other than that of the process. The following are WFL examples of such statements:

RUN OBJECT/PROG;
  BDNAME = (FRAN)PROGDUMP;

RUN OBJECT/PROG;
  FILE TASKFILE (PRINTDISPOSITION=DONTPRINT,USERBACKUPNAME=TRUE,
                 FILENAME=(FRAN)PROGDUMP);

In general, a process must have privileged status to open a file under another usercode. The system enforces this rule even more strictly for task files by requiring that the process have a privileged usercode rather than merely being a privileged program. The purpose of this restriction is to prevent nonprivileged users of privileged programs from using a program dump to overwrite files under another usercode.

This restriction is not foolproof, however. If a privileged program is running under a nonprivileged usercode, and the program opens the task file with a write statement before the dump takes place, the program can successfully open the task file under another usercode. The following is an ALGOL example of such a write statement:

WRITE (MYSELF.TASKFILE,//,”DUMP NUMBER ONE”);

When the program dump takes place later, the dump is directed to the already-opened task file. For this reason, if you are designing a privileged program intended for use by nonprivileged users, you should not include any statements that would cause the task file to be opened before the dump.