Function
Causes a named filestore file to be opened and associated with the current program in such a way that PERI instructions for the specified peripheral are simulated by reading from or writing to the file. It is also possible to use the job source or monitoring file in place of a named file.
Format
ASSIGN peripheral name,file description
The file description parameter is optional. If it is omitted or NULL the job source is assigned to an input channel and the monitoring file (and, for MOP jobs, the MOP terminal) is assigned to an output channel. This is allowed when peripheral name specifies a basic peripheral or a file handler; further details are given under Execution.
When both parameters are specified they can be in either order. peripheral name can in some cases be followed by a qualifier, as shown in the table below. file description can in some cases be followed by one or more entrant description qualifiers, as listed below.
| Peripheral Type | Effective entrant description qualifiers |
|---|---|
| All types | NOWAIT, REPLY, FROZEN |
| *TR | COMMUNE, GDR |
| *CR | COMMUNE, GDR |
| *TP | ALLCHAR, APPEND, COMMUNE, GDR, GRAPHIC, LIMIT, MULTIPLE, NORMAL, OWNERACC, TRAPGO, TRAPSTOP (but see Note 1) |
| *LP | APPEND, COMMUNE, GDR, LIMIT, MULTIPLE, OWNERACC, TRAPGO, TRAPSTOP (but see notes below) |
| *CP | APPEND, COMMUNE, GDR, LIMIT, MULTIPLE, OWNERACC, TRAPGO, TRAPSTOP (but see notes below) |
| *MT | READ, WRITE, EMPTY, LIMIT, OWNERACC, TRAPGO, TRAPSTOP, GIVE |
| *DA | CLEAN, GIVE, MAYBE, OFFSET, OVERLAY, WRITE, EMPTY, SCRATCH, OWNERACC |
| *DR | CLEAN, GIVE, MAYBE, WRITE, EMPTY, SCRATCH, OWNERACC |
| *FR | COMMUNE, GDR |
| *FW | ALLCHAR, APPEND, COMMUNE, GDR, GRAPHIC, LIMIT, MULTIPLE, NORMAL, OWNERACC, TRAPGO, TRAPSTOP |
| *FH | ALLCHAR, APPEND, COMMUNE, EMPTY, GDR, GRAPHIC, LIMIT, MULTIPLE, NORMAL, OWNERACC, READ, TRAPGO, TRAPSTOP, WRITE |
Notes
The allowed associations between peripheral types and file types are shown in the table below.
| Peripheral Type | File type | ||
|---|---|---|---|
| *TR *TR(NLNULL) *CR |
Basic | ||
| *TP | If to be emptied, basic | If APPEND only, GRAPHIC | If APPEND plus type qualifier, GRAPHIC, NORMAL or ALLCHAR, as qualifier |
| *LP *LP(AUTO) *CP |
If to be emptied, basic | If APPEND, GRAPHIC (file type qualifiers are ignored) | |
| *LP(EXTENDED) | If to be emptied, basic | If APPEND, ALLCHAR (file type qualifiers are ignored) | |
| *MT | Magnetic tape | ||
| *DA | Disc | ||
| *DR | Drum | ||
| *FR | Any terminal serial file | ||
| *FW | If to be emptied, any terminal serial file | If APPEND only, any terminal serial file | If APPEND plus type qualifier, GRAPHIC, NORMAL or ALLCHAR, as qualifier |
| *FH | If to be emptied or only read, any terminal serial file | If APPEND or WRITE only, any terminal serial file | If APPEND or WRITE plus type qualifier, GRAPHIC, NORMAL or ALLCHAR, as qualifier |
Note that if a serial file is to be emptied, its type may be changed. If a *TP, *LP or *CP is ASSIGNed and no type qualifier is given, the file type becomes GRAPHIC (the default option). If a *FW or *FH is ASSIGNed and no type qualifier is given, the file type becomes amorphous (the default option). If a *TP, *FW or *FH is ASSIGNed and a type qualifier (GRAPHIC, NORMAL or ALLCHAR) is given, the file type becomes that given in the qualifier.
The TRAPGO entrant description qualifier can be used on the creation or overwriting of any file to permit a user or group of users access to the file in the specified modes. Similarly the TRAPSTOP qualifier can be used to prevent such access.
Forbidden contexts
NO CORE IMAGE
Execution
Basic Input Peripherals
If the peripheral specified in the ASSIGN command is *CR ot *TR (or *FR, see below), reading must be permitted to this user and the file must exist unless COMMUNE is specified, in which case the implementation of the command will be suspended until either the named file is created or a set period of time (the value of the installation parameter WAITTIME) has elapsed. If the file is not in on-line storage, it will be transferred and then opened and assigned unless the NOWAIT qualifier was given. A basic input peripheral may be ASSIGNed to a file of any basic peripheral type. In some cases conversion of somme of the characters in the file may be necessary to allow the file to be read.
Example
| ASSIGN *TR0,:A.B(2/D) | The file will be opened for reading provided that the proper user has READ access to it. |
Basic Output Peripherals
If the peripheral specified is *CP, *TP or *LP, the implied directory of the named file must exist. The named file itself need not exist. Note, however, in the case of workfiles. if the user does not wish to overwrite an already existing workfile, a CREATE command is needed before the ASSIGN command. If the named fle does exist, it must be a basic peripheral file and it must be available for writing or appending to, depending in whether APPEND is specified. In the normal case, an existing file is emptied and then written to from the start, but if APPEND is specified, records will be added to the end of the file. If it is desired to communicate with one or more readers, each appender and each reader must include the COMMUNE qualifier; it is also advisable for the Appender to include the TRAPGO qualifier to give each of the prospective COMMUNE readers read access to the file as soon as it is created. This prevents a command error occuring since the appender will probably be unable to issue a TRAPGO command for a user before the user accesses the newly created file in COMMUNE mode. If a new file is to be set up and a multifile is required, the MULTIPLE qualifier must be given. The LIMIT qualifier may be included to place a limit on the number of PERIs which may be made to the file by the program. If LIMIT is omitted, it will be set to the value of the installation parameter VOLUME.
Examples
| ASSIGN *LP1,OUTFILE(APPEND) | The file will be opened for appending provided that the proper user has APPEND access to it. |
| ASSIGN *LP1,RESULTFILE(APPEND,COMMUNE,- TRAPGO(:USERA,READ), TRAPGO(:USERB,READ),- TRAPGO(:USERC,READ)) |
The file will be opened for appending, provided the user has APPEND access to it, also COMMUNE mode access is permitted with any APPENDER to or READER of the file who has specified COMMUNE, also READ access is granted to the file yp :USERA, :USERB and :USERC. |
Storage Peripherals
Direct Access
The peripheral specified must be *DR or *DA and the file must exists before the command is issued. The file will be opened for reading unless WRITE (for a DR file) or OVERLAY, WRITE or OFFSET (for a DA file) qualfies the entrant description. In this case thefile will be opened for reading and writing after both traps have been checked. The CLEAN qualifier must be included if a writer and one or more readers are to access the file simultaneously.
If an ALLOT is performed between an ASSIGN command and an Open PERI, a negative reply will be given; a PERI that is performed without a previous Open does an implied Open, that is a subsequent ALLOT instruction gets an affirmative reply. When opening scratch files, the control area for the Open PERI will be overwritten with the size and bucket size of the file that has been opened.
If GIVE is specified, the file will be regarded as open without an Open PERI beding given for it, that it, ALLOT will get an affirative reply and an Open PERI will be illegal, If MAYBE is specified (with #600 for discs or #400 or #600 with drums), a negative reply will be given to an Open PERI if the bucket size is wrong or if the file that has been opened is smaller than that specified in the control area.
Examples
| ASSIGN *DA1,MASTERFILE(3)(OVERLAY,CLEAN) | The file will be opened for reading and writing, as by a PERI Open mode #100, provided that the proper user has READ and WRITE access to it. |
| ASSIGN *DR,AFILE(CLEAN) | The file will be opened for reading, provided that the proper user has READ access to it. One writer and other readers may access the file at the same time as the user, provided they specify CLEAN. |
Magnetic Tape
The peripheral specified must be *MT. If the file is to be read by the object program, the file must exist and the user who issues the ASSIGN command must have READ access to it. If the file is to receive output from the object program the user must have WRITE access to the file. If he is the owner of the file he may give any user, including himself, the required modes of access to the file by including the TRAPGO qualifier in the ASSIGN command. Output files need not exist before an ASSIGN command is given to them; if the file does not exist ASSIGN will create the specified file.
If WRITE is specified the file will be opened for writing. If EMPTY is specified the file will be empried or created as an empty file and will be opened for writing. This will save time when a file already exists but is off-line, as it will be re-created on direct access backing store rather than being restored merely to be emptied.
EMPTY and WRITE may be given together separated by a comma. If EMPTY is given alone WRITE, EMPTY is always implied.
If READ is specified as a qualifier or if none of the above qualifiers are specified, the file will be opened for reading.
The LIMIT qualifier is meaningful only when a file is to be opened for writing; it then sets the maximium number of PERIs that the object program may make to the file. If the GIVE qualifier is specified an ALLOT instruction always receives a positive reply and open mode PERIs are always illegal. If GIVE is not specified ALLOT will receive a negative reply until a PERI is performed on the file. This first PERI need not be an open mode nor even a legal PERI; however after this first PERI to the file, ALLOT receives a positive reply and subsequent open mode PERIs are illegal.
The execution of the ASSIGN command depends on whether the object program issues an open mode as its first PERI to the file. The file is initially opened by the ASSIGN command. On encountering the first PERI to the file GEORGE checks if GIVE has been specified. If it has not GEORGE takes the first PERI as including an implied open mode and arranges that ALLOT will subsequently receive an affirmative reply. If GIVE has been specified an open mode is illegal, but if GIVE was not specified the first PERI is allowed to be an open mode. If EMPTY or WRITE were not given the open mode must be #100 or #200. If WRITE was specified the mode must be #100, #300, #400 or #600. If WRITE, EMPTY or EMPTY alone was specified the open mode must be #400 or #600. In these cases (#400, #600) GEORGE also knows that the file is an output file and, therefore, a new header label, derived from the control area of the open PERI, is written to the first MT block of the file. The file is then positioned for writing to the MT block after the first MT block in the file. If the mode of the PERI is #100, #200 or #300 and the file is empty, the PERI is illegal. If the file is not empty it is positioned to allow reading or writing of the MT block after the firstone in the file.
If GIVE was specified or if the first PERI is not an open mode a check is made as to whether the file is empty or not. If it is empty it should be open for writing, otherwise the PERI is illegal. If the file is empty and open for writing, a header label derived from the directory entry of the file is written to the first record and the file is positioned to write to the second record in the file. If the file is not empty the file is positioned for reading or writing after the first record in the file. The first PERI on the file isnow obeyed.
After this initial positioning procedure PERIs are checked for mode and processed normally. It will be seen that this is compatible with ONLINEing of standard magnetic tapes except that the header label is not checked in the normal way. However, program should still not use non-standard header labels.
Examples
| ASSIGN *MT0,SCRATCH TAPE(EMPTY) | If the file does not already exist or is offline it will be created empty and opened for writing. If the file is online it will be emptied. |
| ASSIGN *MT0,PROGRAM TAPE | Assigns a file called PROGRAM TAPE and opens it for reading. |
File Handlers
A file handler can be assigned only to a terminal serial file. The qualifiers APPEND, LIMIT and COMMUNE have the same effect as with basic peripherals.
A file type/mode qualifier may be included in the file description for a
file writer. The types permitted are:
*TR, *TP, *LP, *CP, *CR
Subsidiary qualifiers to specify the mode may be given with *TR and *CR. These mode qualifiers are the same as the mode parameters for INPUT.
If the type/mode qualifier for the file writer is accompanied by APPEND, the file will be opened only if the type is compatible. If the type/mode parameter is included but APPEND is not present the file will be emptied and the type and mode will be changed to that specified.
Examples
| ASSIGN *FR0,MASTERFILE | The file will be opened for reading provided that the proper user has READ access to it. |
| ASSIGN *FW0,FILEA(*TR(NORMAL)) | The file will be created if it does not exist, or emptied if it does and given the type *TR with mode #02, provided the user has the correct traps to this file. |
Note
If the specified peripheral has already been ASSIGNed or ONLINEd, it will be released and re-ASSIGNed. It will be released even if the second ASSIGN command results in an error, provided the error is not in the verb or the peripheral name.
Error Messages
DEVICE TYPE z CANNOT BE ASSIGNED
FILE z FOUND IS OF THE WRONG PERIPHERAL TYPE
1ST PARAMETER MISSING
2ND PARAMETER MISSING