HP 3000 Manuals

Ap E. COBOL Functions [ HP COBOL II/XL Quick Reference Guide ] MPE/iX 5.0 Documentation


HP COBOL II/XL Quick Reference Guide

Appendix E  COBOL Functions 

The following tables lists and briefly describes each COBOL function.
The syntax for each function follows.

          Table E-1.  Date Functions 

--------------------------------------------------------------------
-    Function    -     Type     -          Value Returned          -
--------------------------------------------------------------------
| CURRENT-DATE   | Alphanumeric | Current date and time and        |
|                |              | difference from Greenwich Mean   |
|                |              | Time.                            |
--------------------------------------------------------------------
| DATE-OF-       | Integer      | Standard date equivalent         |
| INTEGER        |              | (YYYYMMDD) of integer date.      |
--------------------------------------------------------------------
| DAY-OF-INTEGER | Integer      | Julian date equivalent (YYYYDDD) |
|                |              | of integer date.                 |
--------------------------------------------------------------------
| INTEGER-OF-    | Integer      | Integer date equivalent of       |
| DATE           |              | standard date (YYYYMMDDD).       |
--------------------------------------------------------------------
| INTEGER-OF-DAY | Integer      | Integer date equivalent of       |
|                |              | Julian date (YYYYDDD).           |
--------------------------------------------------------------------
| WHEN-COMPILED  | Alphanumeric | Date and time program was        |
|                |              | compiled.                        |
--------------------------------------------------------------------

          Table E-2.  String Functions 

--------------------------------------------------------------------
-    Function    -     Type     -          Value Returned          -
--------------------------------------------------------------------
| CHAR           | Alphanumeric | The character in a specified     |
|                |              | position of the program          |
|                |              | collating sequence.              |
--------------------------------------------------------------------
| LENGTH         | Integer      | Length, in character positions,  |
|                |              | of the parameter.                |
--------------------------------------------------------------------
| LOWER-CASE     | Alphanumeric | The same parameter with all      |
|                |              | uppercase letters replaced by    |
|                |              | lowercase letters.               |
--------------------------------------------------------------------
| NUMVAL         | Numeric      | Numeric value of a simple        |
|                |              | numeric string.                  |
--------------------------------------------------------------------
| NUMVAL-C       | Numeric      | Numeric value of a numeric       |
|                |              | string with optional commas and  |
|                |              | currency sign.                   |
--------------------------------------------------------------------
| ORD            | Integer      | Ordinal position of the          |
|                |              | parameter in collating sequence. |
--------------------------------------------------------------------
| REVERSE        | Alphanumeric | Same parameter with characters   |
|                |              | in reverse order.                |
--------------------------------------------------------------------
| UPPER-CASE     | Alphanumeric | Same parameter with all          |
|                |              | lowercase letters replaced by    |
|                |              | uppercase letters.               |
--------------------------------------------------------------------

          Table E-3.  General Functions 

--------------------------------------------------------------------
-    Function    -     Type     -          Value Returned          -
--------------------------------------------------------------------
| MAX            | Depends on   | Maximum value of all parameters. |
|                | parameters.  |                                  |
--------------------------------------------------------------------
| MIN            | Depends on   | Minimum value of all parameters. |
|                | parameters.  |                                  |
--------------------------------------------------------------------
| ORD-MAX        | Integer      | Ordinal position of maximum      |
|                |              | parameter.                       |
--------------------------------------------------------------------
| ORD-MIN        | Integer      | Ordinal position of minimum      |
|                |              | parameter.                       |
--------------------------------------------------------------------

          Table E-4.  Arithmetic Functions 

--------------------------------------------------------------------
-    Function    -     Type     -          Value Returned          -
--------------------------------------------------------------------
| INTEGER        | Integer      | The greatest integer not greater |
|                |              | than the given numeric value.    |
--------------------------------------------------------------------
| INTEGER-PART   | Integer      | Integer part of the given        |
|                |              | numeric value.                   |
--------------------------------------------------------------------
| LOG            | Numeric      | Natural logarithm of a numeric   |
|                |              | value.                           |
--------------------------------------------------------------------
| LOG10          | Numeric      | Logarithm to base 10 of a        |
|                |              | numeric value.                   |
--------------------------------------------------------------------
| MOD            | Integer      | Modulo of two integer            |
|                |              | parameters.                      |
--------------------------------------------------------------------
- RANDOM         - Numeric      - Pseudo-random number.            -
--------------------------------------------------------------------
- REM            - Numeric      - Remainder after division.        -
--------------------------------------------------------------------
- SQRT           - Numeric      - Square root of a numeric value.  -
--------------------------------------------------------------------
| SUM            | Integer or   | Sum of parameters.               |
|                | Numeric      |                                  |
--------------------------------------------------------------------

          Table E-5.  Financial and Statistical Functions 

--------------------------------------------------------------------
-    Function    -     Type     -          Value Returned          -
--------------------------------------------------------------------
| ANNUITY        | Numeric      | Ratio of an annuity paid for a   |
|                |              | specified number of periods at a |
|                |              | specified interest rate to an    |
|                |              | initial investment of one.       |
--------------------------------------------------------------------
- FACTORIAL      - Integer      - Factorial of an integer value.   -
--------------------------------------------------------------------
- MEAN           - Numeric      - Arithmetic mean of parameters.   -
--------------------------------------------------------------------
- MEDIAN         - Numeric      - Median of parameters.            -
--------------------------------------------------------------------
| MIDRANGE       | Numeric      | Mean of smallest and largest     |
|                |              | parameters.                      |
--------------------------------------------------------------------
| PRESENT-VALUE  | Numeric      | Present value of a series of     |
|                |              | future period-end amounts at a   |
|                |              | given discount rate.             |
--------------------------------------------------------------------
| RANGE          | Integer or   | Value of largest parameter minus |
|                | Numeric      | value of smallest parameter.     |
--------------------------------------------------------------------
| STANDARD-      | Numeric      | Standard deviation of            |
| DEVIATION      |              | parameters.                      |
--------------------------------------------------------------------
- VARIANCE       - Numeric      - Variance of parameters.          -
--------------------------------------------------------------------

          Table E-6.  Trigonometric Functions 

--------------------------------------------------------------------
-    Function    -     Type     -          Value Returned          -
--------------------------------------------------------------------
- COS            - Numeric      - Cosine of an angle in radians.   -
--------------------------------------------------------------------
- SIN            - Numeric      - Sine of an angle in radians.     -
--------------------------------------------------------------------
- TAN            - Numeric      - Tangent of an angle in radians.  -
--------------------------------------------------------------------
| ACOS           | Numeric      | Arccosine, in radians, of a      |
|                |              | numeric value.                   |
--------------------------------------------------------------------
| ASIN           | Numeric      | Arcsine, in radians, of a        |
|                |              | numeric value.                   |
--------------------------------------------------------------------
| ATAN           | Numeric      | Arctangent, in radians, of a     |
|                |              | numeric value.                   |
--------------------------------------------------------------------



MPE/iX 5.0 Documentation