1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Error Message Processor +_____ _______ _________ 0The error message processor provides an easy method to notify a user of errors detected during the operation of a program. It provides facilities to type messages supplied in a message file as well as those provided directly within the program. A substitution facility is available whereby selected numbers, character strings or file names may be substituted into specified position of the message. The error message processor uses the facilities of the file control services (FCS) throughout thereby ensuring proper operation when outputting to a spooled device (RSX-llD). 0Use of the error message procesor requires the definition of the error control block by use of the ERR$B macro. 0ERR$B: Create an Error Control Block +_____ ______ __ _____ _______ _____ 0The ERR$B macro call is of the followig form: 0[label:] ERR$B lun,flun,fspec,subsiz 0where lun is the lun to be used for output. The FDB pointed to by error control block location E.FDB is initialized to use the lun. This parameter is required. 0flun is an optional lun to be used to read messages from the error message file. If not specified, the error message file description fspec may not be specified. 0fspec is the file specifier for the error message file of the form 0 0 fspec is used to create and initialize a dataset desciptor table within the error control block. The file described by fspec must be a file with fixed length records on a mounted FILES-11 volume. If it is not, a error return will be made by the ERR$P macro. 0subsiz is the size (in words) of the substitution parameter list to be allocated within the error control block. If the value 0 is used, the user must initialize error control block location E.SUBL with the address of a substitution list he creates himself. 0 0 0 0 0 0 PAGE 2 0 The Error Control Block +___ _____ _______ _____ 0The error control block consists of a fixed length portion followed by a variable length one. The fixed length portion is initialized (either by the user or by one of the error macros) with pointers into the variable length portion or into the user's program. Offsets into the fixed length portion are defined by the ERR$ macro as follows: 0E.STRL the length of the "message" text string E.STRL is zero if no string is specified and after an invocation of the ERR$P macro. 0E.STR the address of the "message" text string E.STR is destroyed by the ERR$P macro. 0E.RECN the record number in the error message file to be used after "message" is processed. 0E.FDB the address of the error message output FDB. 0E.BUF the address of the error message processor's work buffer. 0E.BUFS is a symbol whose value is the length of the error message buffer. 0E.SUBL is the address of the substitution parameter list. This list is a series of entries of the form: 0 .WORD function .WORD arg1 .WORD arg2 . . . . .WORD argn 0 followed by a word containing 0. 0 function may take one of the following values: 0 EF.SPE SPECIAL EF.DEC DECIMAL EF.OCT OCTAL EF.ASC ASC11 EF.RAD RAD50 EF.FNB File Name Block 0E.FFDB is the address of the error message file FDB. 0E.MODE is an option byte. Flog bits have the following meanings: 0 0 0 0 0 PAGE 3 0 0 EM.OCL Close the output FDB after every message. If the user resets this bit for any reason, the error message processor leaves the file open between accesses. 0 EM.ECL Close the message file FDB after retrieving every message. If the user resets this bit for any reasn, the error message processor leaves the file open between accesses. 0 The default value is EM.OCL!EM.ECL. 0E.ERR is an error byte. It contains the following values: 0 ES.SUC Success EE.OPN Error opening output FDB EE.CLS Error closing output FDB EE.SUB Invalid substitution code EE.GET Error reading error message file EE.PUT Error writing output line EE.FOP Error opening error message file EE.FCL Error closing error message file EE.NDB No error message file FDB is present 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 PAGE 4 0 ERR$P Print an Error Message +_____ _____ __ _____ _______ 0The ERR$P macro is used to print an error message with specified substitutions. The ERR$P macro call is of the form: 0[label:] ERR$P errblk,message,code,subs,subl,psect 0where 0errblk represents the address of an error control block. If not specified, the address is assumed to be in register 0. 0message is the text string corresponding to the message to be typed. If the text string includes any special characters, it must be enclosed in angle brackets. The message is stored in psect $MESSAG. 0code is the record number of the error message skeleton in the error message file. The error message skeleton is all characters in that record up to (but not including) the first 0 byte. If both code and message are specified, the message from the file is printed following the message specified in the macro call. 0subs is a substitution parameter list in the format described in the following section. The values specified here are used to update the substitution list pointed to by error control block location E.SUBL. 0subl is the address in the user's program of a substitution list. The macro expansion updates error control block location E.SUBL with this value. 0psect is the name of the psect to resume code generation in after processing the message. If not specified, the blank psect is assumed. 0 0 0 0 0 0 0 0 0 0 0 PAGE 5 0 Substitution Parameter List +____________ _________ ____ 0The substitution parameter list is used to control the values and modes of conversion used in substituting into the message. One value is taken from this list every time the character '%' is encountered in the error message skeleton. The format of this list is: 0<[,...]> 0where 0sub-type specifies the type of conversion to be performed. This keyword may take the values: 0 DECIMAL - convert the argument to decimal. OCTAL - convert the argument to octal. ASC11 - argument 2 characters starting at the address specified by argument 1. RAD50 - argument 1 (a radix-50word) is converted to characters. FNB - substitutes the file specifier corresponding to the file name block specified by argument 1. If argument 2 is non-zero and a directory ID is present in the file name block, the UIC corresponding to that directory ID is inserted. Argument 2 is a lun that will be assigned to the device specified in the name block and used to determine the directory UIC. SPECIAL - a JSR PC,@arg1 is done. At this point, R4 points to arg 2 and RO points to the next byte in the output buffer. argi are the arguments to the conversion function. 0Initialize A Substitution Parameter List +__________ _ ____________ _________ ____ 0The ERR$S macro may be used to initialize a substitution parameter list. This macro might be used if the error message skeleton and substitution list are too long to fit on a ERR$P macro call 0[label:] ERR$S subl,sub 0where 0subl is the address of the substitution parameter list. Ordinarily, this value is the contents of error control block offset E.SUBL. subs is a substitution list in the format described above. 0 0 0 0 0 0 PAGE 6 0 Example +_______ 0The following code fragments illustrate the use of the error message processor in a program that parses a command string and opens a file: 0 CSI$2 #CSIBLK, INPUT BCC OK2 ERR$S ERRBLK+E.SUBL,<> ERR$P #ERRBLK,,, JMP NEXT OK2: OPEN$R #FNFDB ; OPEN FILE BCC OKIN ; OK MOVB INFDB+F.ERR,R1 ; ERROR GET ERROR CODE MOV R1,R2 ; COPY NEG R2 ; MAKE IT INTO RECORD NUMBER ERR$S ERRBLK+E.SUBL,<,> ERR$P #ERRBLK,,R2 JMP NEXT OKIN: . . . ERRBLK: ERR$B TILUN,,10. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0