──┬─ DATA ───┬─┬────────────────────────┬──────────────────────────────► └─ EBCDIC ─┘ └─ <file name constant> ─┘ ►─ <data images> ──────────────────────────────────────────────────────► ►─ <i> ────────────────────────────────────────────────────────────────┤
Explanation
A local data specification supplies input data in the form of card images to a particular task. The task reads from the local data specification as if it were an input file. A task that attempts to read from a card reader file will automatically read from a local data specification instead, if one is available. Tasks that read from other kinds of files can be file-equated to cause them to read from a local data specification instead.
Note: | The default MAXRECSIZE of a READER file is 14 words (84 characters), but a record contains only 80 characters of valid data. Take this into consideration when using a local data specification, since a record in a file generated by CANDE with a FILEKIND = JOBSYMBOL contains data in columns 1 through 80, spaces in columns 81 and 82, and the sequence number in columns 83 through 90. To avoid getting unwanted information, equate UNITS to CHARACTERS and set the MAXRECSIZE to 80 when reading the local data specification. |
The data images are records of EBCDIC data. DATA is a synonym for EBCDIC. The <i> construct that terminates the local data specification also separates the data specification from the next statement; it is not necessary to follow the data specification with a semicolon (;). For more information, see Global Data Specifications.
A local data specification differs from a global data specification in that it can only be used by a single task. The syntax for a local data specification is the same as that for a global data specification, with the following exceptions:
-
Local data specifications appear immediately after the task initiation statement for the task that it is going to read from. Only task attributes and file equations can be used between a task and its local data specifications.
-
Local data specifications can be included in subroutines, while global data specifications cannot.
-
Local data specifications do not have to include a file name; the file name is optional.
When a task tries to open a card reader file, it searches among the local data specifications associated with that task for the first unread local data specification with the correct file name or no file name.
Examples
The following example shows the simplest use of a local data specification. The program (WALLY)OBJECT/COUNTUP expects to read data from a single card reader file. In this situation, the local data specification does not need to be named, and no file equations are required.
RUN (WALLY)OBJECT/COUNTUP; DATA 6 ? % End of data
It is a good idea to give each local data specification a title if more than one local data specification is being used by the task. This makes it obvious which local data specification is being substituted for which input file. The local data specification should have the same title as the input file it is replacing in the program, unless the input file has been file-equated to a different title.
In the following example, the program reads the local data specification titled TERMIN1 instead of the input file of the same name, and reads the local data specification titled READDAT instead of the input file titled TERMIN2:
RUN (WALLY)OBJECT/COUNTTWO; FILE TERMIN1(KIND=READER); FILE TERMIN2(TITLE=READDAT,KIND=READER); DATA TERMIN1 3 128 ? % End of TERMIN1 data DATA READDAT 5 ? % End of READDAT data
When used after a COMPILE or BIND statement, local data specifications can be interpreted as input to the compiler or to the program that is compiled depending on the syntax used. Refer to Compiler Task Equation List for more information.
By default, a compiler expects to find the program source in a card reader file named CARD. For this reason, it is not necessary to include a file equation telling the compiler to read from the appropriate local data specification. It is sufficient to assign CARD as the title of the local data specification, and precede the local data specification with the word COMPILER or a compiler name, as in the following example.
A data specification can appear only in jobs stored in disk files that are initiated by START.
COMPILE OBJECT/X WITH ALGOL GO; COMPILER PRINTLIMIT=1000; PRINTLIMIT=2000; COMPILER DATA CARD % Beginning of data for compiler . . % These lines contain an ALGOL program. . ? % End of compiler data DATA % Beginning of program data . . . ? % End of program data
The form of the <name> construct that allows 17 EBCDIC characters other than quotation marks (") is not supported.