• Aucun résultat trouvé

ION ERRORI

Dans le document COS 300/310 (Page 54-66)

1.4.13 ON ERROR

This statement can be inserted in the source program to cause a branch to the statement with the specified label when a non-fatal executed error occurs in the next program statement. The form of this statement is:

where

ON ERROR label

label is a statement label assigned to the statement in the PROC section where control is to be transferred.

The ON ERROR statement can be the object of an IF statement.

Examples:

ON ERROR ERRTRP TEMP=lOO*ORIG/NEW

ERRTRP,

ON ERROR TRAP DEC = ALPHA

TRAP,

The ON ERROR statement eliminates a return to the Monitor for the following run time errors.

zero divisor

bad digit in an alpha to decimal conversion

more than 15 digits in decimal field used in calculation an end of file label was not specified in an XMIT statement input line overflowed block i t was read into

no file specified in RUN command to satisfy INIT (SYS) statement

in a random-access operation (see READ and WRITE) the file contains variable length records, record number is too large or 0, or length specified in the record header word does not match the length of the XMIT block.

1.4.14 PRoe

The PROe statement separates the two sections of a DIBOL program, the data definition section and the procedure section. It is of the form:

PRoe [n] [Ix] [icomment]

where n

Ix

comment

is a single digit, 0-7, (not an expression) indicating the maXimum number of mass storage logical units which the program will have open simultaneously. If no number is specified, the compiler assumes 7. The available core is divided into buffers to handle the number of logical units specified. The more buffers necessary, the smaller they must be and the slower the 1/0 process.

is an optional listing switch to the compiler IN temporarily halts compiler listing of source

program

IL resume listing source program and errors on line printer

IT resume listing source program and errors on terminal

The PRoe option switch is active until disabled by a START or END statement with an option switch.

There can be only one PRoe statement. If no option switch is specified, a compiler listing is produced as usual. The PRoe option switch can be overridden with an option switch at compile time.

(Refer to Chapter 4.)

is an optional string of text preceded by a semicolon which is stored for output as a heading for the procedure section of the compiler listing.

When the compiler encounters the PROe statement the line printer moves to the top of the next sheet of paper and outputs the comment, if any, as a header line.

If IN is specified in the RUN eOMP command, it overrides any IL's or IT's in the source program. However, IL and IT determine on what device errors are listed. If the program simultaneously opens more mass storage logical units than were specified in the PRoe statement, a run time error occurs.

Examples:

Legal PRoe

PRoe 3;BILLING V3 PRoe 3/N

PRoe;

PRoe 4/L; TEST PROG.

Illegal PRoe 32 PROe, 4 PROe 5+2

PROe BILLING V3 PROe A

1.4.15 READ

The direct access READ statement allows a specified data record to be moved from a named file to a specified area in core and has the form:

where

READ (channel, record,rec#)

channel

record rec#

is a decimal expression with a value of 1-15 specifying a channel number which links the READ statement to the related INIT statement. (The INIT statement must specify INPUT or UPDATE as the COS dev ice.)

is the record into which data is to be read.

is a decimal arithmetic expression specifying the sequence number of the record to be read.

If the program READS past the end-of-file mark, the results are undefined. See Section 1.4.22 for restrictions on usage.

Examples:

READ (5,REX,88)

reads the 88th record of the device linked to the channel which was INITed with the INIT (5, .•. ) statement and places i t in the core area labeled REX.

READ (6,BLT,EXPR)

reads the record specified by the expression EXPR and stores i t in the core area labeled BLT.

Refer to Appendix L for more examples and a discussion of direct access techniques.

I RECORD I

1.4.16 RECORD

The RECORD statement reserves areas of core where records are stored during processing. Block can be used interchangeably with RECORD.

The RECORD statement is of the form: characters are significant). The first character must be alphabetic.

A comma may be used without a field name if the program does not reference the individual field. This specification is used when formatting an output line for the printer, for example, so that

total size of all data fields in a record must not exceed 510, if the record has a name (i.e. can be input or output), otherwise the total size must not exceed 4094.

Examples:

Legal

RECORD MASTER A, D3 Ml, D4 M2, A6 , A6 RECORD TRANS

CUST, A16 ADD, A30 KEY, D

D03 Illegal

RECORD NUMBER SETNO Dll ORDERS, D632 RECORD NUMBER

B, A-6

Inserting Initial Values

Initial values can be assigned to data fields as part of the field statements following a RECORD statement. The initial value may be set as part of the data field definition or marked for insertion via the terminal when the program is ready for execution. The maximum size (limited by the Monitor) of an initial value is approximately 110 characters. If no initial value is assigned to a field it is initially set to all blanks (if alphanumeric) or zeroes (if decimal) . If entered as part of the program, the alphanumeric or decimal constant is placed after the type and size specification. A comma must separate the constant from the type and size specification. The initial value to be entered must agree with the size and type specified for the field. The alphanumeric constant must be enclosed in single quotation marks (' ') and may contain any printable characters except \ , ' ,or Tabs inside the single quotation marks are treated as spaces, 1 space per tab. A decimal constant is a string of decimal digits optionally preceded by a sign (+ or -) and optionally followed by a minus sign. The signs (+ or -) and quotes do not count as part of the size of the initial value. The compiler does not insert leading zeros or trailing spaces in initial values.

Examples:

,A4, 'TEXT' M,D6,000400 PA,A2,'ll' AA,D3,123 AC,A3,'l23' A,D3,-146 B,D3,146-C,D3,+123

Illeg al ,A4: 'NOTE' , A4, , 3Q' ,A3,345 ,D4, 'WEED' ,D4, 12 ,D4,12345 A3 '2'

A3, 'HELLO' AIT

AD,A3,

If the initial value is to be entered when the program is executed, put a comma and the character P after the type and size specification.

Example:

fldnam,A8,P

The character P is used in the data field specification to allow the user to enter data at run time. Before execution, the message

ENTER fldnam

is displayed on the terminal. The specification QZBI35,A6,P

causes the message ENTER QZBl35

to be printed at the terminal at run time.

characters

999999

The reply may use six

The terminal entry is stored in the field named. If the value entered at run time in response to the ENTER message is shorter than the field, the value is padded with blanks, if longer, an error will occur. The P should only be used with named fields and is executed once each time the program is run.

NOTE When using the P option from the terminals is e.g.,

LABEL,A6,P

all information entered treated as alphanumeric

in the data section causes the message ENTER LABEL

If the user replies ABCD..}

LABEL will equal 'ABCD LABEL,D7,P ENTER LABEL AB123..J

The sequence

causes LABEL to equal AB12300.

A variable to be initialized with the P option can also be given an initial default value.

Example:

NAME ,A3, 'DOE' ,P

The default value must agree in type and size with that specified for the field. The program uses the default value if CTRL/Z is typed in answer to the run time ENTER message.

Examples:

Legal ENT,A6,P DUP,D8,P

ZIP,A5,' OOOOO',p

Illegal ,D2P

The character D is used in the data field specification to insert the

The character S is used in the data field to assign the value of a variable (A2) equal to the value of the options used at run time.

Example:

VAR,A2,S

will set VAR to 'XY' if .RU pronam/XY is run.

RECORD Overlay Option

The X option in a RECORD statement allows multiple definition fields within a RECORD. Specify the overlay option as follows:

of

Dans le document COS 300/310 (Page 54-66)

Documents relatifs