HP 3000 Manuals

Language Concepts [ COBOL/HP-UX Language Reference for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Language Reference for the Series 700 and 800

Language Concepts 

(ANS85)

Function-name 

(ANS85)

In the Intrinsic Function module, a function is a temporary data item
whose value is determined at the time the function is referenced during
the execution of a statement.  A function-name is a COBOL word that is
one of a specified list of COBOL words which can be used in COBOL source
programs.  (See the section "Definitions of Functions"  later in this
chapter.)

Value Returned by a Function 

(ANS85)

The value returned by a function is considered to be a data value.  A
mechanism is provided at run-time to assign a data value to a function
when it is referenced.  In order to determine the function's value, the
evaluation mechanism can require access to data values provided by the
referencing program.  These data values are provided by specifying
parameters, known as arguments, when referencing the function.  Specific
functions can place constraints on these arguments, such as range, and so
on.  If, at the time a function is referenced, the arguments specified
for that reference do not have values that comply with the specified
constraints, then the returned value for the function is undefined.

Function-identifier 

(ANS85)

A function-identifier is used by the programmer to reference a function
within the Procedure Division of a COBOL source program.  (See the
section "Function-Identifier"  in the chapter COBOL Concepts.)

Function Definition and Returned Value 

(ANS85)

The definition of a function identifies:

   1.  For alphanumeric functions, the size of the returned value.

   2.  For numeric and integer functions, the sign of the returned value
       and whether the function is integer.

   3.  For some other cases, the value returned.

Date Conversion Functions 

(ANS85)

The Gregorian calendar is used in the date conversion functions.  The
starting date of Monday, January 1, 1601, was chosen to establish a
simple relationship between the Standard Date and DAY-OF-WEEK; that is,
the integer date 1 was a Monday, DAY-OF-WEEK 1.
[REV BEG]

For example, the statement:

     COMPUTE DoW = FUNCTION REM (FUNCTION INTEGER-OF-DATE
     (date-field) , 7)

will return the day of week for a given date, where 0 is Sunday, 1 is
Monday, and so on.
[REV END]

Arguments 

(ANS85)

Arguments specify values used in the evaluation of a function.  Arguments
are specified in the function-identifier.  These arguments can be
specified as identifiers, as arithmetic expressions, or as literals.  The
definition of a function specifies the number of arguments required,
which can be zero, one, or more.  For some functions, the number of
arguments which can be specified can be variable.  The order in which
arguments are specified in a function-identifier determines the
interpretation given to each value in arriving at the function value.
Arguments may be required to have a certain class or a subset of a
certain class.  The types of argument are:

   1.  Numeric.  An arithmetic expression must be specified.  The value
       of the arithmetic expression, including operational sign, is used
       in determining the value of the function.

   2.  Alphabetic.  An elementary data item of the class alphabetic or a
       nonnumeric literal containing only alphabetic characters must be
       specified.  The size associated with the argument can be used in
       determining the value of the function.

   3.  Alphanumeric.  A data item of the class alphabetic or alphanumeric
       or a nonnumeric literal must be specified.  The size associated
       with the argument can be used in determining the value of the
       function.

   4.  Integer.  An arithmetic expression which will always result in an
       integer value must be specified.  The value of the arithmetic
       expression, including operational sign, is used in determining the
       value of the function.

The rules for a function can place constraints on the permissible values
for arguments in order to permit meaningful determination of the
function's value.  If, at the time a function is referenced, the
arguments specified for that reference do not have values within the
permissible range, the returned value for the function is undefined.

When the definition of a function permits an argument to be repeated a
variable number of times, a table can be referenced by specifying the
data-name and any qualifiers that identify the table, followed
immediately by subscripting where one or more of the subscripts is the
word ALL.

When ALL is specified as a subscript, the effect is as if each table
element associated with that subscript position were specified.  The
order of the implicit specification of each occurrence is from left to
right, with the first (or leftmost) specification being the identifier
with each subscript specified by the word ALL replaced by one, the next
specification being the same identifier with the rightmost subscript
specified by the word ALL incremented by one.  This process continues
with the rightmost ALL subscript being incremented by one for each
implicit specification until the rightmost ALL subscript has been
incremented through its range of values.  If there are any additional ALL
subscripts, the subscript immediately to the left of the rightmost ALL
subscript is incremented by one, the rightmost ALL subscript is reset to
one and the process of varying the rightmost ALL subscript is repeated.
The ALL subscript to the left of the rightmost ALL subscript is
incremented through its range of values.  For each additional ALL
subscript this process is repeated in turn until the leftmost ALL
subscript has been incremented by one through its range of values.  If
the ALL subscript is associated with an OCCURS DEPENDING ON clause, the
range of values is determined by the object of the OCCURS DEPENDING ON
clause.  The evaluation of an ALL subscript must result in at least one
argument, otherwise the returned value is undefined.

Types of Functions 

(ANS85)

Data item functions are elementary data items and return alphanumeric,
numeric or integer values.  Data item functions are treated as elementary
data items and cannot be receiving operands.  Types of data item
functions are:

   1.  Alphanumeric functions.  These are of the class and category
       alphanumeric.  The number of character positions in this data item
       is specified in the function definition.  Alphanumeric functions
       have an implicit usage of DISPLAY.

   2.  Numeric functions.  These are of the class and category numeric.
       A numeric function is always considered to have an operational
       sign.
       [REV BEG]

       A numeric function can be used only in an arithmetic expression or 
       as the source of a MOVE statement.  (MF)[REV END]

       A numeric function can not be referenced where an integer operand
       is required, even though a particular reference can yield an
       integer value.

   3.  Integer functions.  These are of the class and category numeric.
       An integer function is always considered to have an operational
       sign.
       [REV BEG]

       An integer function can be used only in an arithmetic expression
       or as the source of a MOVE statement.  (MF)[REV END]

       An integer function can be referenced where an integer operand is
       required and where a signed operand is allowed.

Definitions of Functions 

(ANS85)

The following table summarizes the functions that are available.

The Arguments column defines the type and number of arguments as follows:

A    means alphabetic
I    means integer
N    means numeric
X    means alphanumeric

The Type column defines the type of the function as follows:

I    means integer
N    means numeric
X    means alphanumeric

          Table 4-1.  Table of Functions (ANS85) 

------------------------------------------------------------------------------------
|                   |              |          |                                    |
| Function-Name     | Arguments    |   Type   | Value Returned                     |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| ACOS              | N1           |    N     | Arcosine of N1                     |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| ANNUITY           | N1, I2       |    N     | Ratio of annuity paid for I2       |
|                   |              |          | periods at interest of N1 to       |
|                   |              |          | initial investment of one          |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| ASIN              | N1           |    N     | Arcsine of N1                      |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| ATAN              | N1           |    N     | Arctangent of N1                   |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| CHAR              | I1           |    X     | Character in position I1 of        |
|                   |              |          | program collating sequence         |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| COS               | N1           |    N     | Cosine of N1                       |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| CURRENT-DATE      | None         |    X     | Current date and time and          |
|                   |              |          | difference from Greenwich Mean     |
|                   |              |          | Time                               |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| [REV BEG]DATE-OF- | I1           |    I     | Standard date equivalent           |
| INTEGER           |              |          | (YYYYMMDD) of integer date I1 [REV |
|                   |              |          | END]                               |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| [REV BEG]DAY-OF-  | I1           |    I     | Julian date equivalent (YYYYDDD)   |
| INTEGER           |              |          | of integer date I1 [REV END]       |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| FACTORIAL         | I1           |    I     | Factorial of I1                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| INTEGER           | N1           |    I     | The greatest integer not greater   |
|                   |              |          | than N1                            |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| INTEGER-OF-DATE   | I1           |    I     | The integer date equivalent of     |
|                   |              |          | standard date (YYYYMMDD)           |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| INTEGER-OF-DAY    | I1           |    I     | The integer date equivalent of     |
|                   |              |          | Julian date (YYYYDDD)              |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| INTEGER-PART      | N1           |    I     | Integer part of N1                 |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| LENGTH            | A1 or N1 or  |    I     | Length of argument                 |
|                   | X1           |          |                                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| LOG               | N1           |    N     | Natural logarithm of N1            |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| LOG10             | N1           |    N     | Logarithm of base 10 of N1         |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| LOWER-CASE        | A1 or X1     |    X     | All letters in the argument are    |
|                   |              |          | set of lowercase                   |
|                   |              |          |                                    |
------------------------------------------------------------------------------------

          Table 4-1.  Table of Functions (cont.)  (ANS85) 

------------------------------------------------------------------------------------
|                   |              |          |                                    |
| Function-Name     | Arguments    |   Type   | Value Returned                     |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| MAX               | A1 ...  or   | Depends  | Value of maximum arguments         |
|                   | I1 ...  or   | upon ar- |                                    |
|                   | N1 ...  or   | guments* |                                    |
|                   | X1 ...       |          |                                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| MEAN              | N1 ...       |    N     | Arithmetic mean of arguments       |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| MEDIAN            | N1 ...       |    N     | Median of arguments                |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| MIDRANGE          | N1 ...       |    N     | Mean of minimum and maximum        |
|                   |              |          | arguments                          |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| MIN               | A1 ...  or   | Depends  | Value of minimum argument          |
|                   | I1 ...  or   | upon ar- |                                    |
|                   | N1 ...  or   | guments* |                                    |
|                   | X1 ...       |          |                                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| MOD               | I1, I2       |    I     | I1 modulo I2                       |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| NUMVAL            | X1           |    N     | Numeric value of simple numeric    |
|                   |              |          | string                             |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| NUMVAL-C          | X1, X2       |    N     | Numeric value of numeric string    |
|                   |              |          | with optional commas and currency  |
|                   |              |          | sign                               |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| ORD               | A1 or X1     |    I     | Ordinal position of the argument   |
|                   |              |          | in collating sequence              |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| ORD-MAX           | A1 ...  or   |    I     | Ordinal position of maximum        |
|                   | N1 ...  or   |          | argument                           |
|                   | X1           |          |                                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| ORD-MIN           | A1 ...  or   |    I     | Ordinal position of minimum        |
|                   | N1 ...  or   |          | argument                           |
|                   | X1           |          |                                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| PRESENT-VALUE     | N1 N2 ...    |    N     | Present value of a series of       |
|                   |              |          | future period-end amounts, N2, at  |
|                   |              |          | a discount rate of N1              |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| RANDOM            | I1           |    N     | Random number                      |
|                   |              |          |                                    |
------------------------------------------------------------------------------------

          Table 4-1.  Table of Functions (cont.)  (ANS85) 

------------------------------------------------------------------------------------
|                   |              |          |                                    |
| Function-Name     | Arguments    |   Type   | Value Returned                     |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| RANGE             | I1 ...  or   | Depends  | Value of maximum argument minus    |
|                   | N1           | upon ar- | value of minimum arguments         |
|                   |              | guments* |                                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| REM               | N1, N2       |    N     | Remainder of N1/N2                 |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| REVERSE           | A1 or X1     |    X     | Reverse order of the characters in |
|                   |              |          | the argument                       |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| SIN               | N1           |    N     | Sine of N1                         |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| SQRT              | N1           |    N     | Square root of N1                  |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| STANDARD-         | N1 ...       |    N     | Standard deviation of arguments    |
| DEVIATION         |              |          |                                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| SUM               | I1 ...  or   | Depends  | Sum or arguments                   |
|                   | N1 ...       | on argu- |                                    |
|                   |              |  ments*  |                                    |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| TAN               | N1           |    N     | Tangent of N1                      |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| UPPER-CASE        | A1 of X1     |    X     | All letters in the argument are    |
|                   |              |          | set to uppercase                   |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| VARIANCE          | N1 ...       |    N     | Variance of argument               |
|                   |              |          |                                    |
------------------------------------------------------------------------------------
|                   |              |          |                                    |
| WHEN-COMPILED     | None         |    X     | Date and time program was compiled |
|                   |              |          |                                    |
------------------------------------------------------------------------------------

________________________________________________________________________
|The ACOS Function                                                     |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The ACOS function returns a numeric value in radians that approximates|
|the arccosine of argument-1.  The type of this function is numeric.   |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION ACOS (argument-1)                                       |
|                                                                      |
|Arguments                                                             |
|                                                                      |
|                                                                      |
|   1.  Argument-1 must be class numeric.                              |
|                                                                      |
|   2.  The value of argument-1 must be greater than or equal to -1 and|
|       less than or equal to +1.                                      |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is the approximation of the arccosine of argument-1|
|and is greater than or equal to zero and less than or equal to        |
|pi.                                                                   |
________________________________________________________________________

            
________________________________________________________________________
|The ANNUITY Function                                                  |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The ANNUITY function (annuity immediate) returns a numeric value that |
|approximates the ratio of an annuity paid at the end of each period   |
|for the number of periods specified by argument-2 to an initial       |
|investment of one.  Interest is earned at the rate specified by       |
|argument-1 and is applied at the end of the period, before the        |
|payment.  The type of this function is numeric.                       |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION ANNUITY (argument-1 argument-2)                         |
|                                                                      |
|Arguments                                                             |
|                                                                      |
|                                                                      |
|   1.  Argument-1 must be class numeric.                              |
|                                                                      |
|   2.  The value of argument-1 must be greater than or equal to       |
|       zero.                                                          |
|                                                                      |
|   3.  Argument-2 must be a positive integer.                         |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  When the value of argument-1 is zero, the value of the function|
|       is the approximation of:                                       |
|                                                                      |
|            1 / argument-2                                            |
|                                                                      |
|   2.  When the value of argument-1 is not zero, the value of the     |
|       function is the approximation of:                              |
|                                                                      |
|            argument-1 / (1 - (1 + argument-1) ** (- argument-2))     |
________________________________________________________________________

            
________________________________________________________________________
|The ASIN Function                                                     |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The ASIN function returns a numeric value in radians that approximates|
|the arcsine of argument-1.  The type of this function is numeric.     |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION ASIN (argument-1)                                       |
|                                                                      |
|Arguments                                                             |
|                                                                      |
|                                                                      |
|   1.  Argument-1 must be class numeric.                              |
|                                                                      |
|   2.  The value of argument-1 must be greater than or equal to -1 and|
|       less than or equal to +1.                                      |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is the approximation of the arcsine of argument-1  |
|and is greater than or equal to -pi/2 and less than or equal to       |
|+pi/2.                                                                |
________________________________________________________________________

            
________________________________________________________________________
|The ATAN Function                                                     |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The ATAN function returns a numeric value in radians that approximates|
|the arctangent of argument-1.  The type of this function is           |
|numeric.                                                              |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION ATAN (argument-1)                                       |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be class numeric.                                     |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is the approximation of the arctangent of          |
|argument-1 and is greater than -pi/2 and less than +pi/2.             |
________________________________________________________________________

            
________________________________________________________________________
|The CHAR Function                                                     |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The CHAR function returns a one character alphanumeric value that is a|
|character in the program collating sequence having the ordinal        |
|position equal to the value of argument-1.  The type of this function |
|is alphanumeric.                                                      |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION CHAR (argument-1)                                       |
|                                                                      |
|Arguments                                                             |
|                                                                      |
|                                                                      |
|   1.  Argument-1 must be an integer.                                 |
|                                                                      |
|   2.  The value of argument-1 must be greater than zero and less than|
|       or equal to the number of positions in the collating           |
|       sequence.                                                      |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  If more than one character has the same position in the program|
|       collating sequence, the character returned as the function     |
|       value is that of the first literal specified for that character|
|       position in the ALPHABET clause.                               |
|                                                                      |
|       2. If the current program collating sequence was not specified |
|       by an ALPHABET clause, the native collating sequence is used.  |
|       (MF)                                                           |
________________________________________________________________________

            
________________________________________________________________________
|The COS Function                                                      |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The COS function returns a numeric value that approximates the cosine |
|of an angle or arc, expressed in radians, that is specified by        |
|argument-1.  The type of this function is numeric.                    |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION COS (argument-1)                                        |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be class numeric.                                     |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is the approximation of the cosine of argument-1   |
|and is greater than or equal to -1 and less than or equal to          |
|+1.                                                                   |
________________________________________________________________________

            
________________________________________________________________________
|The CURRENT-DATE Function                                             |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The CURRENT-DATE function returns a 21-character alphanumeric value   |
|that represents the calendar date, time of day, and local time        |
|differential factor provided by the system on which the function is   |
|evaluated.  The type of this function is alphanumeric.                |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION CURRENT-DATE                                            |
|                                                                      |
|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.                       |
|                                                                      |
________________________________________________________________________

            
________________________________________________________________________
|The DATE-OF-INTEGER Function                                          |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The DATE-OF-INTEGER function converts a date in the Gregorian calendar|
|from integer date form to standard date form (YYYYMMDD). The type of  |
|this function is integer.                                             |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION DATE-OF-INTEGER (argument-1)                            |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 is a positive integer that represents a number of days     |
|succeeding December 31, 1600, in the Gregorian calendar.              |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  The returned value represents the ISO Standard date equivalent |
|       of the integer specified in argument-1.                        |
|                                                                      |
|   2.  The returned value is in the form (YYYYMMDD) where YYYY        |
|       represents a year in the Gregorian calendar; MM represents the |
|       month of that year; and DD represents the day of that          |
|       month.                                                         |
________________________________________________________________________

            
________________________________________________________________________
|The DAY-OF-INTEGER Function                                           |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The DAY-OF-INTEGER function converts a date in the Gregorian calendar |
|from integer date form to Julian date form (YYYYDDD). The type of this|
|function is integer.                                                  |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION DAY-OF-INTEGER (argument-1)                             |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 is a positive integer that represents a number of days     |
|succeeding December 31, 1600, in the Gregorian calendar.              |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  The returned value represents the Julian equivalent of the     |
|       integer specified in argument-1.                               |
|                                                                      |
|   2.  The returned value is an integer of the form (YYYYDDD) where   |
|       YYYY represents a year in the Gregorian calendar and DDD       |
|       represents the day of that year.                               |
________________________________________________________________________

            
________________________________________________________________________
|The FACTORIAL Function                                                |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The FACTORIAL function returns an integer that is the factorial of    |
|argument-1.  The type of this function is integer.                    |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION FACTORIAL (argument-1)                                  |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be an integer greater than or equal to zero.          |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  If the value of argument-1 is zero, the value 1 is returned.   |
|                                                                      |
|   2.  If the value of argument-1 is positive, its factorial is       |
|       returned.                                                      |
________________________________________________________________________

            
________________________________________________________________________
|The INTEGER Function                                                  |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The INTEGER function returns the greatest integer value that is less  |
|than or equal to the argument.  The type of this function is          |
|integer.                                                              |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION INTEGER (argument-1)                                    |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be class numeric.                                     |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is the greatest integer less than or equal to the  |
|value of argument-1.  For example, if the value of argument-1 is      |
|-1.5, -2 is returned.  If the value of argument-1 is +1.5, +1 is      |
|returned.                                                             |
________________________________________________________________________

            
________________________________________________________________________
|The INTEGER-OF-DATE Function                                          |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The INTEGER-OF-DATE function converts a date in the Gregorian calendar|
|from standard date form (YYYYMMDD) to integer date form.  The type of |
|this function is integer.                                             |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION INTEGER-OF-DATE (argument-1)                            |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be an integer of the form YYYYMMDD, whose value is    |
|obtained from the calculation:                                        |
|                                                                      |
|(YYYY * 10,000) + (MM * 100) + DD.                                    |
|                                                                      |
|                                                                      |
|   a.  YYYY represents the year in the Gregorian calendar.  It must be|
|       an integer greater than 1600.                                  |
|                                                                      |
|   b.  MM represents a month and must be a positive integer less than |
|       13.                                                            |
|                                                                      |
|   c.  DD represents a day and must be a positive integer less than 32|
|       provided that it is valid for the specified month and year     |
|       combination.                                                   |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is an integer that is the number of days the date  |
|represented by argument-1 succeeds December 31, 1600, in the Gregorian|
|calendar.                                                             |
________________________________________________________________________

            
________________________________________________________________________
|The INTEGER-OF-DAY Function                                           |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The INTEGER-OF-DAY function converts a date in the Gregorian calendar |
|from Julian date form (YYYYDDD) to integer date form.  The type of    |
|this function is integer.                                             |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION INTEGER-OF-DAY (argument-1)                             |
|                                                                      |
|Argument Argument-1 must be an integer of the form YYYYDDD, whose     |
|value is obtained from the calculation:                               |
|                                                                      |
|(YYYY * 1000) + DDD.                                                  |
|                                                                      |
|                                                                      |
|   a.  YYYY represents the year in the Gregorian calendar.  It must be|
|       an integer greater than 1600.                                  |
|                                                                      |
|   b.  DDD represents the day of the year.  It must be a positive     |
|       integer less than 367 provided that it is valid for the year   |
|       specified.                                                     |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is an integer that is the number of days the date  |
|represented by argument-1 succeeds December 31, 1600, in the Gregorian|
|calendar.                                                             |
________________________________________________________________________

            
________________________________________________________________________
|The INTEGER-PART Function                                             |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The INTEGER-PART function returns an integer that is the integer      |
|portion of argument-1.  The type of this function is integer.         |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION INTEGER-PART (argument-1)                               |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be class numeric.                                     |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  If the value of argument-1 is zero, the returned value is      |
|       zero.                                                          |
|                                                                      |
|   2.  If the value of argument-1 is positive, the returned value is  |
|       the greatest integer less than or equal to the value of        |
|       argument-1.  For example, if the value of argument-1 is +1.5,  |
|       +1 is returned.                                                |
|                                                                      |
|   3.  If the value of argument-1 is negative, the returned value is  |
|       the least integer greater than or equal to the value of        |
|       argument-1.  For example, if the value of argument-1 is -1.5,  |
|       -1 is returned.                                                |
________________________________________________________________________

            
________________________________________________________________________
|The LENGTH Function                                                   |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The LENGTH function returns an integer equal to the length of the     |
|argument in character positions.  The type of this function is        |
|integer.                                                              |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION LENGTH (argument-1)                                     |
|                                                                      |
|Arguments                                                             |
|                                                                      |
|                                                                      |
|   1.  Argument-1 can be a nonnumeric literal or a data item of any   |
|       class or category.                                             |
|                                                                      |
|       It must not be DBCS. (MF)                                      |
|                                                                      |
|   2.  If argument-1 or any data item subordinate to argument-1 is    |
|       described with the DEPENDING phrase of the OCCURS clause, the  |
|       contents of the data item referenced by the data-name specified|
|       in the DEPENDING phrase are used at the time the LENGTH        |
|       function is evaluated.                                         |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  If argument-1 is a nonnumeric literal or an elementary data    |
|       item or argument-1 is a group data item that does not contain a|
|       variable occurrence data item, the value returned is an        |
|       integer equal to the length of argument-1 in character         |
|       positions.                                                     |
|                                                                      |
|   2.  If argument-1 is a group data item containing a variable       |
|       occurrence data item, the returned value is an integer         |
|       determined by evaluation of the data item specified in the     |
|       DEPENDING phrase of the OCCURS clause for that variable        |
|       occurrence data item.  This evaluation is accomplished         |
|       according to the rules in the OCCURS clause dealing with the   |
|       data item as a sending data item.  (See the sections "The      |
|       OCCURS Clause"  and "The USAGE Clause"  in the chapter   |
|       The Nucleus).                                                  |
|                                                                      |
|   3.  The returned value includes implicit FILLER characters, if     |
|       any.                                                           |
________________________________________________________________________

            
________________________________________________________________________
|The LOG Function                                                      |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The LOG function returns a numeric value that approximates the        |
|logarithm to the base e (natural log) of argument-1.  The type of this|
|function is numeric.                                                  |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION LOG (argument-1)                                        |
|                                                                      |
|Arguments                                                             |
|                                                                      |
|                                                                      |
|   1.  Argument-1 must be class numeric.                              |
|                                                                      |
|   2.  The value of argument-1 must be greater than zero.             |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is the approximation of the logarithm to the base e|
|of argument-1.                                                        |
________________________________________________________________________

            
________________________________________________________________________
|The LOG10 Function                                                    |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The LOG10 function returns a numeric value that approximates the      |
|logarithm to the base 10 of argument-1.  The type of this function is |
|numeric.                                                              |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION LOG10 (argument-1)                                      |
|                                                                      |
|Arguments                                                             |
|                                                                      |
|                                                                      |
|   1.  Argument-1 must be class numeric.                              |
|                                                                      |
|   2.  The value of argument-1 must be greater than zero.             |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is the approximation of the logarithm to the base  |
|10 of argument-1.                                                     |
________________________________________________________________________

            
________________________________________________________________________
|The LOWER-CASE Function                                               |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The LOWER-CASE function returns a character string that is the same   |
|length as argument-1 with each uppercase letter replaced by the       |
|corresponding lowercase letter.  The type of this function is         |
|alphanumeric.                                                         |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION LOWER-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 uppercase letter is replaced by the corresponding    |
|       lowercase letter.                                              |
|                                                                      |
|   2.  The character string returned has the same length as           |
|       argument-1.                                                    |
|                                                                      |
|   3.  If the computer character set does not include lowercase       |
|       letters, no changes take place in the character string.        |
________________________________________________________________________

            
________________________________________________________________________
|The MAX Function                                                      |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The MAX function returns the content of the argument-1 that contains  |
|the maximum value.  The type of this function depends upon the        |
|argument types as follows:                                            |
|                                                                      |
|                                                                      |
|Argument Type          Function Type                                  |
|                                                                      |
|Alphabetic             Alphanumeric                                   |
|Alphanumeric           Alphanumeric                                   |
|All arguments integer  Integer                                        |
|Numeric                Numeric                                        |
|                                                                      |
|                                                                      |
|     (some arguments can be integer)                                  |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION 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                                                       |
|                                                                      |
|                                                                      |
|   1.  The returned value is the content of the argument-1 having the |
|       greatest value.  The comparisons used to determine the greatest|
|       value are made according to the rules for simple conditions.   |
|       (See the section "Simple Conditions"  in the chapter The    |
|       Nucleus.)                                                      |
|                                                                      |
|   2.  If more than one argument-1 has the same greatest value, the   |
|       content of the argument-1 returned is the leftmost argument-1  |
|       having that value.                                             |
|                                                                      |
|   3.  If the type of the function is alphanumeric, the size of the   |
|       returned value is the same as the size of the selected         |
|       argument-1.                                                    |
________________________________________________________________________

            
________________________________________________________________________
|The MEAN Function                                                     |
|                                                                      |
|Description                                                           |
|                                                                      |
|The MEAN function returns a numeric value that is the arithmetic      |
|mean (average) of its arguments.  The type of this function is        |
|numeric.                                                              |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION MEAN ({argument-1} ... )                                |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be class numeric.                                     |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  The returned value is the arithmetic mean of the argument-1    |
|       series.                                                        |
|                                                                      |
|   2.  The returned value is defined as the sum of the argument-1     |
|       series divided by the number of occurrences referenced by      |
|       argument-1.                                                    |
________________________________________________________________________

            
________________________________________________________________________
|The MEDIAN Function                                                   |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The MEDIAN function returns the content of the argument whose value is|
|the middle value in the list formed by arranging the arguments in     |
|sorted order.  The type of this function is numeric.                  |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION MEDIAN ({argument-1} ... )                              |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be class numeric.                                     |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  The returned value is the content of the argument-1 having the |
|       middle value in the list formed by arranging all the argument-1|
|       values in sorted order.                                        |
|                                                                      |
|   2.  If the number of occurrences referenced by argument-1 is       |
|       odd, the returned value is such that at least half of          |
|       the occurrences referenced by argument-1 are greater           |
|       than or equal to the returned value and at least half          |
|       are less than or equal.  If the number of occurrences          |
|       referenced by argument-1 is even, the returned value is the    |
|       arithmetic mean of the values referenced by the two middle     |
|       occurrences.                                                   |
|                                                                      |
|   3.  The comparisons used to arrange the argument-1 values in sorted|
|       order are made according to the rules for simple conditions.   |
|       (See the section "Simple Conditions"  in the chapter The    |
|       Nucleus.)                                                      |
________________________________________________________________________

            
________________________________________________________________________
|The MIDRANGE Function                                                 |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The MIDRANGE (middle range) function returns a numeric value that     |
|is the arithmetic mean (average) of the values of the minimum         |
|argument and the maximum argument.  The type of this function is      |
|numeric.                                                              |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION MIDRANGE ({argument-1} ... )                            |
|                                                                      |
|Argument                                                              |
|                                                                      |
|Argument-1 must be class numeric.                                     |
|                                                                      |
|Returned Value                                                        |
|                                                                      |
|The returned value is the arithmetic mean of the greatest argument-1  |
|value and the least argument-1 value.  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 MIN Function                                                      |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The MIN function returns the content of the argument-1 that contains  |
|the minimum value.  The type of this function depends upon the        |
|argument types as follows:                                            |
|                                                                      |
|                                                                      |
|Argument Type          Function Type                                  |
|                                                                      |
|Alphabetic             Alphanumeric                                   |
|Alphanumeric           Alphanumeric                                   |
|All arguments integer  Integer                                        |
|Numeric                Numeric                                        |
|                                                                      |
|                                                                      |
|     (some arguments can be integer)                                  |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION 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 can be  |
|mixed.                                                                |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  The returned value is the content of the argument-1 having the |
|       least value.  The comparisons used to determine the least value|
|       are made according to the rules for simple conditions.  (See   |
|       the section "Simple Conditions"  in the chapter The         |
|       Nucleus.)                                                      |
|                                                                      |
|   2.  If more than one argument-1 has the same least value, the      |
|       content of the argument-1 returned is the leftmost argument-1  |
|       having that value.                                             |
|                                                                      |
|   3.  If the type of the function is alphanumeric, the size of the   |
|       returned value is the same as the size of the selected         |
|       argument-1.                                                    |
________________________________________________________________________

            
________________________________________________________________________
|The MOD Function                                                      |
|                                                                      |
|(ANS85)                                                               |
|                                                                      |
|Description                                                           |
|                                                                      |
|The MOD function returns an integer value that is argument-1 modulo   |
|argument-2.  The type of this function is integer.                    |
|                                                                      |
|General Format                                                        |
|                                                                      |
|     FUNCTION MOD (argument-1 argument-2)                             |
|                                                                      |
|Arguments                                                             |
|                                                                      |
|                                                                      |
|   1.  Argument-1 and argument-2 must be integers.                    |
|                                                                      |
|   2.  The value of argument-2 must not be zero.                      |
|                                                                      |
|Returned Values                                                       |
|                                                                      |
|                                                                      |
|   1.  The returned value is argument-1 modulo argument-2.  The       |
|       returned value is defined as:                                  |
|                                                                      |
|       argument-1 - (argument-2 * FUNCTION INTEGER (argument-1 /      |
|       argument-2))                                                   |
|                                                                      |
|   2.  The following illustrates the expected results for some values |
|       of argument-1 and argument-2.                                  |
|                                                                      |
|            Argument-1  Argument-2  Return                            |
|                                                                      |
|             11            5          1                               |
|            -11            5          4                               |
|             11           -5         -4                               |
|            -11           -5         -1                               |
________________________________________________________________________

            



MPE/iX 5.0 Documentation