Language Concepts (cont)
________________________________________________________________________
|The NUMVAL Function |
| |
|(ANS85) |
| |
|Description |
| |
|The NUMVAL function returns the numeric value represented by the |
|character string specified by argument-1. Leading and trailing spaces|
|are ignored. The type of this function is numeric. |
| |
|General Format |
| |
| FUNCTION NUMVAL (argument-1) |
| |
|Arguments |
| |
| |
| 1. Argument-1 must be a nonnumeric literal or alphanumeric |
| data item whose content has one of the following two |
| formats: |
________________________________________________________________________
________________________________________________________________________
|(ANS85) |
| |
| |
| |
| where space is a string of zero or more spaces and digit is a |
| string of one to 18 digits. |
| |
|2. The total number of digits in argument-1 must not exceed |
| 18. |
| |
|3. If the DECIMAL POINT IS COMMA clause is specified in the |
| SPECIAL-NAMES paragraph, a comma must be used in argument-1 |
| rather than a decimal point. |
| |
| |
|Returned Values |
| |
| |
| 1. The returned value is the numeric value represented by |
| argument-1. |
| |
| 2. The number of digits returned is 18. |
________________________________________________________________________
________________________________________________________________________
|The NUMVAL-C Function |
| |
|(ANS85) |
| |
|Description |
| |
|The NUMVAL-C function returns the numeric value represented by the |
|character string specified by argument-1. Any optional currency |
|sign specified by argument-2 and any optional commas preceding |
|the decimal point are ignored. The type of this function is |
|numeric. |
| |
|General Format |
| |
| FUNCTION NUMVAL-C (argument-1 [argument-2]) |
| |
|Arguments |
| |
| |
| 1. Argument-1 must be a nonnumeric literal or alphanumeric |
| data item whose content has one of the following two |
| formats: |
________________________________________________________________________
________________________________________________________________________
|(ANS85) |
| |
| |
| |
| where space is a string of zero or more spaces, cs is the string |
| of one or more characters specified by argument-2 and digit is a |
| string of one or more digits. |
| |
|2. If the DECIMAL POINT IS COMMA clause is specified in the |
| SPECIAL-NAMES paragraph, the functions of the comma and decimal |
| point in argument-1 are reversed. |
| |
|3. The total number of digits in argument-1 must not exceed |
| 18. |
| |
|4. Argument-2, if specified, must be a nonnumeric literal or |
| alphanumeric data item. |
| [REV BEG] |
| |
| It can not be a digit, comma, space, plus sign(+), minus sign (-)|
| or decimal point. (MF)[REV END] |
| |
|5. If argument-2 is not specified, the character used for cs is the |
| currency symbol specified for the program. |
| |
| |
|Returned Values |
| |
| |
| 1. The returned value is the numeric value represented by |
| argument-1. |
| |
| 2. The number of digits returned is 18. |
________________________________________________________________________
________________________________________________________________________
|The ORD Function |
| |
|(ANS85) |
| |
|Description |
| |
|The ORD function returns an integer value that is the ordinal position|
|of argument-1 in the collating sequence for the program. The |
|lowest ordinal position is 1. The type of this function is |
|integer. |
| |
|General Format |
| |
| FUNCTION ORD (argument-1) |
| |
|Argument |
| |
|Argument-1 must be one character in length and must be class |
|alphabetic or alphanumeric. |
| |
|Returned Value |
| |
|The returned value is the ordinal position of argument-1 in the |
|collating sequence for the program. |
________________________________________________________________________
________________________________________________________________________
|The ORD-MAX Function |
| |
|(ANS85) |
| |
|Description |
| |
|The ORD-MAX function returns a value that is the ordinal number of the|
|argument-1 that contains the maximum value. The type of this function|
|is integer. |
| |
|General Format |
| |
| FUNCTION ORD-MAX ({argument-1} ... ) |
| |
|Argument |
| |
|If more than one argument-1 is specified, all arguments must be of the|
|same class, except alphabetic and alphanumeric arguments which can be |
|mixed. |
| |
|Returned Values |
|[REV BEG] |
| |
| 1. The returned value is the ordinal number that corresponds to |
| the position of the argument-1 having the greatest value in the|
| argument-1 series.[REV END] |
| |
| 2. The comparisons used to determine the greatest valued argument |
| are made according to the rules for simple conditions. (See |
| the section "Simple Conditions" in the chapter The |
| Nucleus.) |
| |
| 3. If more than one argument-1 has the same greatest value, the |
| number returned corresponds to the position of the leftmost |
| argument-1 having that value. |
________________________________________________________________________
________________________________________________________________________
|[REV BEG]The ORD-MIN Function |
| |
|(ANS85) |
| |
|Description |
| |
|The ORD-MIN function returns a value that is the ordinal number of the|
|argument-1 that contains the minimum value. The type of this function|
|is integer. |
| |
|General Format |
| |
| FUNCTION ORD-MIN ({argument-1} ... ) |
| |
|Argument |
| |
|If more than one argument-1 is specified, all arguments must be of the|
|same class, except alphabetic and alphanumeric arguments which may be |
|mixed. |
| |
|Returned Values |
| |
| |
| 1. The returned value is the ordinal number that corresponds to |
| the position of the argument-1 having the lowest value in the |
| argument-1 series. |
| |
| 2. The comparisons used to determine the lowest valued argument |
| are made according to the rules for simple conditions. (See |
| the section "Simple Conditions" in the chapter The |
| Nucleus.) |
| |
| 3. If more than one argument-1 has the same lowest value, the |
| number returned corresponds to the position of the leftmost |
| argument-1 having that value. |
| [REV END] |
________________________________________________________________________
________________________________________________________________________
|The PRESENT-VALUE Function |
| |
|(ANS85) |
| |
|Description |
| |
|The PRESENT-VALUE function returns a value that approximates the |
|present value of a series of future period-end amounts specified by |
|argument-2 at a discount rate specified by argument-1. The type of |
|this function is numeric. |
| |
|General Format |
| |
| FUNCTION PRESENT-VALUE (argument-1 {argument-2} ...) |
| |
|Arguments |
| |
| |
| 1. Argument-1 and argument-2 must be of the class numeric. |
| |
| 2. The value of argument-1 must be greater than -1. |
| |
|Returned Value |
| |
|The returned value is an approximation of the summation of a series of|
|calculations with each term in the following form: |
| |
| argument-2 / (argument-1) ** n |
| |
|There is one term for each occurrence of argument-2. The exponent, n,|
|is incremented from one by one for each term in the series. |
________________________________________________________________________
________________________________________________________________________
|The RANDOM Function |
| |
|(ANS85) |
| |
|Description |
| |
|The RANDOM function returns a numeric value that is a pseudo-random |
|number from a rectangular distribution. The type of this function is |
|numeric. |
| |
|General Format |
| |
| FUNCTION RANDOM [(argument-1)] |
| |
|Arguments |
| |
| |
| 1. If argument-1 is specified, it must be zero or a positive |
| integer. It is used as the seed value to generate a sequence |
| of pseudo-random numbers. |
| |
| 2. If a subsequent reference specifies argument-1, a new sequence |
| of pseudo-random numbers is started. |
| |
| |
| |
|3. If the first reference to this function in the run unit does |
| not specify argument-1, the seed value of zero is used. |
| (MF) |
| |
|4. In each case, subsequent references without specifying argument-1 |
| return the next number in the current sequence. |
| |
| |
|Returned Values |
| |
| |
| 1. The returned value is greater than or equal to zero and less |
| than one. |
| |
| 2. For a given seed value on a given implementation, the |
| sequence of pseudo-random numbers will always be the |
| same. |
| |
| 3. The domain of argument-1 values will yield distinct sequences |
| of pseudo-random numbers. This subset includes the values from|
| 0 through at least 32767. |
________________________________________________________________________
________________________________________________________________________
|The RANGE Function |
| |
|(ANS85) |
| |
|Description |
| |
|The RANGE function returns a value that is equal to the value of |
|the maximum argument minus the value of the minimum argument. |
|The type of this function depends upon the argument types as |
|follows: |
| |
| |
|Argument Type Function Type |
| |
|All arguments integer Integer |
|Numeric |
|(some arguments may be integer)umeric |
| |
| |
|General Format |
| |
| FUNCTION RANGE ({argument-1} ... ) |
| |
|Argument |
| |
|Argument-1 must be class numeric. |
| |
|Returned Value |
| |
|The returned value is equal to the greatest value of argument-1 minus |
|the least value of argument-1. The comparisons used to determine the |
|greatest and least values are made according to the rules for simple |
|conditions. (See the section "Simple Conditions" in the chapter |
|The Nucleus.) |
________________________________________________________________________
_________________________________________________________________________________
|The REM Function |
| |
|Description |
| |
|The REM function returns a numeric value that is the remainder of |
|argument-1 divided by argument-2. The type of this function is |
|numeric. |
| |
|General Format |
| |
| FUNCTION REM (argument-1 argument-2) |
| |
|Arguments |
| |
| |
| 1. Argument-1 and argument-2 must be class numeric. |
| |
| 2. The value of argument-2 must not be zero. |
| |
|Returned Value |
| |
|The returned value is the remainder of argument-1 / argument-2. It is |
|defined as the expression: |
| |
| argument-1 -(argument-2 * FUNCTION INTEGER-PART (argument-1 / argument-2))|
_________________________________________________________________________________
________________________________________________________________________
|The REVERSE Function |
| |
|(ANS85) |
| |
|Description |
| |
|The REVERSE function returns a character string of exactly the same |
|length as argument-1 and whose characters are exactly the same as |
|argument-1, except that they are in reverse order. The type of this |
|function is alphanumeric. |
| |
|General Format |
| |
| FUNCTION REVERSE (argument-1) |
| |
|Argument |
| |
|Argument-1 must be class alphabetic or alphanumeric and must be at |
|least one character in length. |
| |
|Returned Value |
| |
|If argument-1 is a character string of length n, the returned value is|
|a character string of length n such that for 1 <= j <= n, the |
|character in position j of the returned value is the character from |
|position n-j+1 of argument-1. |
________________________________________________________________________
________________________________________________________________________
|The SIN Function |
| |
|(ANS85) |
| |
|Description |
| |
|The SIN function returns a numeric value that approximates the sine of|
|an angle or arc, expressed in radians, that is specified by |
|argument-1. The type of this function is numeric. |
| |
|General Format |
| |
| FUNCTION SIN (argument-1) |
| |
|Argument |
| |
|Argument-1 must be class numeric. |
| |
|Returned Value |
| |
|The returned value is the approximation of the sine of argument-1 |
|and is greater than or equal to -1 and less than or equal to |
|+1. |
________________________________________________________________________
________________________________________________________________________
|The SQRT Function |
| |
|(ANS85) |
| |
|Description |
| |
|The SQRT function returns a numeric value that approximates |
|the square root of argument-1. The type of this function is |
|numeric. |
| |
|General Format |
| |
| FUNCTION SQRT (argument-1) |
| |
|Arguments |
| |
| |
| 1. Argument-1 must be class numeric. |
| |
| 2. The value of argument-1 must be zero or positive. |
| |
|Returned Value |
| |
|The returned value is the absolute value of the approximation of the |
|square root of argument-1. |
________________________________________________________________________
The STANDARD-DEVIATION Function
________________________________________________________________________
|(ANS85) |
| |
|Description |
| |
|The STANDARD-DEVIATION function returns a numeric value that |
|approximates the standard deviation of its arguments. The type of |
|this function is numeric. |
| |
|General Format |
| |
| FUNCTION STANDARD-DEVIATION ({argument-1} ...) |
| |
|Argument |
| |
|Argument-1 must be class numeric. |
| |
|Returned Values |
| |
| |
| 1. The returned value is the approximation of the standard |
| deviation of the argument-1 series. |
| |
| 2. The returned value is calculated as follows: |
| |
| |
| a. The difference between each argument-1 value and the |
| arithmetic mean of the argument-1 series is calculated |
| and squared. |
| |
| b. The values obtained are then added together. This |
| quantity is divided by the number of values in the |
| argument-1 series. |
| |
| c. The square root of the quotient obtained is then |
| calculated. The returned value is the absolute value of|
| this square root. |
| |
| 3. If the argument-1 series consists of only one value, or if the |
| argument-1 series consists of all variable occurrence data |
| items and the total number of occurrences for all of them is |
| one, the returned value is zero. |
________________________________________________________________________
________________________________________________________________________
|The SUM Function |
| |
|(ANS85) |
| |
|Description |
| |
|The SUM function returns a value that is the sum of the arguments. |
|The type of this function depends upon the argument types as |
|follows: |
| |
| |
|Argument Type Function Type |
| |
|All arguments integer Integer |
|Numeric |
|(some arguments may be integer)umeric |
| |
| |
|General Format |
| |
| FUNCTION SUM ({argument-1} ... ) |
| |
|Argument |
| |
|Argument-1 must be class numeric. |
| |
|Returned Values |
| |
| |
| 1. The returned value is the sum of the arguments. |
| |
| 2. If the argument-1 series are all integers, the value returned |
| is an integer. |
| |
| 3. If the argument-1 series are not all integers, a numeric value |
| is returned. |
________________________________________________________________________
________________________________________________________________________
|The TAN Function |
| |
|Description |
| |
|The TAN function returns a value that approximates the tangent of an |
|angle or arc, expressed in radians, that is specified by argument-1. |
|The type of this function is numeric. |
| |
|General Format |
| |
| FUNCTION TAN (argument-1) |
| |
|Argument |
| |
|Argument-1 must be class numeric. |
| |
|Returned Value |
| |
|The returned value is the approximation of the tangent of argument-1. |
________________________________________________________________________
________________________________________________________________________
|The UPPER-CASE Function |
| |
|(ANS85) |
| |
|Description |
| |
|The UPPER-CASE function returns a character string that is the same |
|length as argument-1 with each lowercase letter replaced by the |
|corresponding uppercase letter. The type of this function is |
|alphanumeric. |
| |
|General Format |
| |
| FUNCTION UPPER-CASE (argument-1) |
| |
|Argument |
| |
|Argument-1 must be class alphabetic or alphanumeric and must be at |
|least one character in length. |
| |
|Returned Values |
| |
| |
| 1. The same character string as argument-1 is returned, except |
| that each lowercase letter is replaced by the corresponding |
| uppercase letter. |
| |
| 2. The character string returned has the same length as |
| argument-1. |
________________________________________________________________________
________________________________________________________________________
|The VARIANCE Function |
| |
|(ANS85) |
| |
|Description |
| |
|The VARIANCE function returns a numeric value that approximates |
|the variance of its arguments. The type of this function is |
|numeric. |
| |
|General Format |
| |
| FUNCTION VARIANCE ({argument-1} ... ) |
| |
|Argument |
| |
|Argument-1 must be class numeric. |
| |
|Returned Values |
| |
| |
| 1. The returned value is the approximation of the variance of the |
| argument-1 series. |
| |
| 2. The returned value is defined as the square of the standard |
| deviation of the argument-1 series. (See the section "The |
| STANDARD-DEVIATION Function" , Returned Values, rule 2 |
| earlier in this chapter.) |
| |
| 3. If the argument-1 series consists of only one value, or if the |
| argument-1 series consists of all variable occurrence data |
| items and the total number of occurrences for all of them is |
| one, the returned value is zero. |
________________________________________________________________________
________________________________________________________________________
|The WHEN-COMPILED Function |
| |
|(ANS85) |
| |
|Description |
| |
|The WHEN-COMPILED function returns the date and time the program was |
|compiled. The type of this function is alphanumeric. |
| |
|General Format |
| |
| FUNCTION WHEN-COMPILED |
| |
|Returned Values |
| |
| |
| 1. The character positions returned, numbered from left to right, |
| are: |
| |
| |
| |
| Character Positions Contents |
| |
| |
| |
| 1-4 Four numeric digits of the year in the |
| Gregorian calendar. |
| |
| 5-6 Two numeric digits of the month of |
| the year, in the range 01 through |
| 12. |
| |
| 7-8 Two numeric digits of the day of the |
| month, in the range 01 through |
| 31. |
| |
| 9-10 Two numeric digits of the hours past |
| midnight, in the range 00 through |
| 23. |
| |
| 11-12 Two numeric digits of the minutes past |
| the hour, in the range 00 through |
| 59. |
| |
| 13-14 Two numeric digits of the seconds past |
| the minute, in the range 00 through |
| 59. |
| |
| 15-16 Two numeric digits of the hundredths of a|
| second past the second, in the range 00 |
| through 99. If the system does not have |
| the facility to provide fractional |
| parts of a second, the value 00 is |
| returned. |
| |
________________________________________________________________________
________________________________________________________________________
|(ANS85) |
| |
| |
| |
|Character Positions Contents |
| |
| |
| |
|17 Either the character "-", the character "+", or |
| the character "0". The character "-" is |
| returned if the local time indicated in the |
| previous character positions is behind Greenwich|
| Mean Time. The character "+" is returned if the|
| local time indicated is the same or ahead of |
| Greenwich Mean Time. The character "0" is |
| returned if the system on which this function |
| is evaluated does not have the facility |
| to provide the local time differential |
| factor. |
| |
| If the system does not have the facility to |
| provide the local time differential factor, the |
| value 00000 is returned in character positions |
| 17 through 21. |
| |
|18-19 If character position 17 is "-", two numeric |
| digits are returned in the range 00 through 12, |
| indicating the number of hours that the reported|
| time is behind Greenwich Mean Time. If |
| character position 17 is "+", two numeric digits|
| are returned in the range 00 through 13 |
| indicating the number of hours that the reported|
| time is ahead of Greenwich Mean Time. If |
| character position 17 is "0", the value 00 is |
| returned. |
| |
|20-21 Two numeric digits are returned in the range 00 |
| through 59 indicating the number of additional |
| minutes that the reported time is ahead of or |
| behind Greenwich Mean Time, depending on whether|
| character position 17 is "+" or "-" , |
| respectively. If character position 17 is "0", |
| the value 00 is returned. |
| |
| |
| |
| |
|2. The returned value is the date and time of compilation of the |
| source program that contains this function. If the program is a |
| contained program, the returned value is the compilation date and|
| time associated with the separately compiled program in which it |
| is contained. |
| |
|3. The returned value denotes the same time as the compilation |
| date and time if provided in the listing of the source |
| program and in the generated object code for the source |
| program, although their representations and precisions may |
| differ. |
| |
________________________________________________________________________