Capítulo II: Aspectos relevantes para la evaluación económica financiera
3.5 Resultados comparativos de la Factibilidad del Proyecto
The sequential input of data is accomplished in HAL/S by employing either a READ or READALL statement. The choice depends upon the format of the character input and the conversions (if any) which are to be performed.
A READALL statement is used whenever arbitrary character string images are to be input without conversion; otherwise, READ is used.
<format list>s may be used with READ statements when data is not in a standard external format; e.g., if two numbers are located in consecutive columns without separation.
SYNTAX:
Figure 10-1 READ and READALL statements - #65 GENERAL SEMANTIC RULES:
1. <arith exp> is an unarrayed scalar or integer arithmetic expression. The value is treated as an integer: scalar values are rounded to the nearest integer prior to use. The value must represent a legal I/O channel number.
2. <i/o control> is any legal I/O control function used to position the device mechanism explicitly.
3. Unless overridden by explicit <i/o control> or <format list>, the device mechanism is automatically moved to the leftmost column position and advanced to the next line prior to reading the first <variable>. A SKIP, LINE, or PAGE before the first <variable> overrides the automatic line advancement. A TAB or COLUMN overrides the automatic column position.
4. An unexpected end of file reached during the reading of data from the input file causes a runtime error.
5. <variable>s are read in order. Each <variable>'s subscript is evaluated just prior to its input. basic statement variable i/o control format list arith exp 20 67 82 : ; ( ) , 24
example:READ (5) VAR, (Y, Z) IN ‘F5.2’ , DELTA3;
65
label
READ
SEMANTIC RULES (READALL version):
1. <variable> may be any character or structure variable in an assignment context. This specifically excludes input parameters of functions and procedures. If it is of structure type, all the terminals of the template it references must be of character type. In this case, no nested structure template references are allowed.
2. If <variable> is an array or structure each element thereof is filled sequentially in its “natural sequence”.
3. Data is read from the input file character by character from left to right, each <variable> element being filled in turn. Filling of an element is completed either when the end of a line on the file is reached, or when the element has reached its declared maximum length, whichever happens sooner.
4. <format list> may not be used with READALL. SEMANTIC RULES (READ version):
1. <variable> is any variable which may be used in an assignment context. This specifically excludes input parameters of functions and procedures.
2. If <variable> is a vector or matrix, or an array or structure, each element thereof is filled sequentially in its “natural sequence”.
3. When reading data specified in a <format list> the device mechanism is positioned by the <format list>. All the characters in the field determined by the format are transmitted and converted to the internal HAL/S data type. If the width of the specified field is greater than the number of characters remaining on the line, an implementation dependent mechanism is invoked.
4. In the absence of a <format list>, the device mechanism (subject to <i/o control>) scans the input file left to right, from line to line, looking for fields of contiguous characters separated by commas, semicolons, or blanks. Each field found is in turn transmitted and converted from its standard external format to an appropriate HAL/S data value. Fields may not cross line boundaries except when reading character strings.
5. When not under control of a <format list>, a semicolon field separator encountered during a normal sequential scan to fill a variable element terminates the READ statement as follows:
• The current <variable> element is left unchanged;
• All remaining <variable>s in the statement are unchanged; • All remaining control functions in the statement are ignored.
<i/o control> functions can force the device mechanism over the semicolon without causing early termination.
6. When not under the control of a <format list>, a null field is transmitted whenever a comma or semicolon is detected when data is expected. This occurs when a comma or semicolon is:
• preceded by a comma or semicolon;
When under control of a <format list>, a null field is transmitted and an error sent whenever the field being read is entirely blank.
A null field causes the corresponding variable element to remain unchanged following transmission.
7. For READ statements, fields must either be read using <format list> or else they must appear in a standard external format. A list of standard external formats is given in Appendix E. A type mismatch causes a runtime error.