OUT.VALUE
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 14 NOV 1989 | 2.X | EXPERT | OUT.VALUE |
OUT.VALUE is a function that converts a value according to a specified pattern.
new_value = OUT.VALUE(value, outpat, status)
Using OUT.VALUE
OUT.VALUE is an external function that converts value according to the operation specified in outpat. Advanced Revelation uses OUT.VALUE to process data entered at a prompt.
value
Use value to pass the value to be converted.
outpat
Use outpat to specify the validation or conversion operation to be used. OUT.VALUE identifies the specified operation on the basis of the format.
The following is a list of the pattern operations available, the required formats, and a description of each:
Conversion | Value is modified according to the specified conversion pattern (see R/BASIC OCONV and the "Data Formatting" section of "Adding Advanced Features to Windows with Paint" in Designing an Application.). The syntax is: (conversion). |
CATALYST | The System Subroutine CATALYST is called with the specified code and command as its arguments. If CATALYST returns a value in @ANS, this is passed in value (value is assigned to @ANS prior to the CATALYST call). Otherwise, value is unchanged. The syntax is: @code command@. Notice that a space precedes the command. |
Dictionary | The appropriate file and dictionary file must be opened prior to the call to OUT.VALUE. The dictionary record specified is passed to R/BASIC CALCULATE and evaluated, returning the result in value (value is assigned to @ANS prior to the CALCULATE call). Otherwise, value is unchanged.The syntax is: {dictionary record} |
Subroutine | The catalogued R/BASIC subroutine is expected to perform a user-specified conversion and is passed as the second argument to OCONV (value is the first), returning the result in value (see R/BASIC OCONV).The syntax is: [subroutine{,argument}] |
status
A variable used by OUT.VALUE to return true if the outpat operation was successfully performed (false otherwise). A failed operation will cause OUT.VALUE to return immediately, and any subsequent outpat operations that may have been specified are not processed.
If value does not conform to the validation pattern, or if a conversion cannot be performed, an error message is displayed informing the user.
Values returned
OUT.VALUE returns value, possibly converted by an outpat operation. The status flag is passed in the argument list.
Correct Use of OUT.VALUE
* The following code demonstrates various functions of OUT.VALUE. DECLARE SUBROUTINE MSG, FSMSG DECLARE FUNCTION OUT.VALUE value = 7494 outpattern = "(DE)" new_value = OUT.VALUE(value, outpattern, status) IF status THEN MSG("value is ":new_value,"","","") END ELSE MSG("output conversion failed","","","") END /* Call CATALYST and process the specified code and command. No value returned. */ value = 0 outpattern = "@HL, 'Now processing...'@" new_value = OUT.VALUE(value, outpattern, status) IF status THEN MSG("Call to CATALYST was successful","","","") END ELSE MSG("output conversion failed","","","") END * Evaluate a dictionary record, returning the price of the product. filename = "SAMPLE_PRODUCTS" @@ID = "HR-1" value = "" outpattern = "{RETAIL_PRICE}" OPEN filename TO product_file ELSE FSMSG(); STOP OPEN "DICT ":filename TO @DICT ELSE FSMSG(); STOP READ @RECORD FROM product_file, @ID ELSE FSMSG(); STOP new_value = OUT.VALUE(value, outpattern, status) MSG("The output value is ":OCONV(new_value,"MD2$"),"","","")