Previous | Contents | Index |
The ACOS function returns a numeric value in radians that approximates the arccosine of the argument.
General Format
FUNCTION ACOS (arg) |
arg
is a numeric argument with a value greater than or equal to -1 and less than or equal to +1.
COMPUTE RSULT = FUNCTION ACOS (.85). |
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 the second argument) to an initial investment of one. Interest is earned at the rate specified (by the first argument), and is applied at the end of the period, before the payment.
interest-rate
is a numeric argument with a value greater than or equal to 0, representing the interest rate applied at the end of the period before the payment.num-periods
is a positive integer argument representing the number of periods.
COMPUTE RSULT = FUNCTION ANNUITY (INTEREST-RATE, NUM-PERIODS). |
The ARGCOUNT function returns a numeric integer equal to the number of arguments passed to the Compaq COBOL program.
IF FUNCTION ARGCOUNT = 3 PERFORM PROCESS-OPTIONAL-3RD-ARGUMENT. |
See the Argument Information Register in the OpenVMS Calling Standard. <>
The ASIN function returns a numeric value in radians that approximates the arcsine of the argument.
arg
is a numeric argument with a value greater than or equal to -1 and less than or equal to +1.
COMPUTE RSULT = FUNCTION ASIN (.675). |
The ATAN function returns a numeric value in radians that approximates the arctangent of the argument.
arg
is a numeric argument.
COMPUTE RSULT = FUNCTION ATAN (MEASUREMENT-IN-RADIANS). |
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 the argument.
position
is a positive integer argument representing the ordinal position of the desired character in the program collating sequence, and having a value less than or equal to the number of positions in the collating sequence.
MOVE FUNCTION CHAR (13) TO FORM-FEED-CH. |
The COS function returns a numeric value that approximates the cosine of an angle or arc, expressed in radians, that is specified by the argument.
angle
is a numeric argument having the value of the measurement in radians of an angle or arc.
COMPUTE COSIN-RSLT = FUNCTION COS (X). |
The CURRENT-DATE function returns a 21-character alphanumeric value that represents the calendar date and the time of day.
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 (Tru64 UNIX and OpenVMS systems. The digits are 00 Windows NT systems, which does not show fractions of a second.) |
17-21 | The value 00000. (Reserved for future use.) |
The COBOL syntax for this function (similar to the example) is common to all platforms:
MOVE FUNCTION CURRENT-DATE TO RSULT. |
199701101652313200000 (Tru64 UNIX and OpenVMS systems) 199701101652310000000 (Windows NT systems) |
The DATE-OF-INTEGER function converts a date from an integer date form representing the number of days after December 31, 1600, to standard date form (YYYYMMDD).
num-days
is a positive integer argument that represents a number of days succeeding December 31, 1600, in the Gregorian calendar.
COMPUTE RSULT = FUNCTION DATE-OF-INTEGER (20). |
16010120 |
The DATE-TO-YYYYMMDD function converts a date in the form YYMMDD to the form YYYYMMDD. An optional second argument, when added to the current year (at the time the program executes), defines the ending year of a 100-year interval. This interval determines to what century the two-digit year belongs.
General Format
FUNCTION DATE-TO-YYYYMMDD ( arg-1 [ arg-2 ] ) |
arg-1
is a nonnegative integer between 0 and 999999.arg-2
is an integer. Its value, when added to the current year, must be between 1700 and 9999. If it is omitted, the default value is 50.
YY = int(arg-1 / 10000) mmdd = mod (arg-1, 10000) return FUNCTION YEAR-TO-YYYY(YY, arg-2) * 10000 + mmdd |
IF FUNCTION DATE-TO-YYYYMMDD (801123, 50 ) = 19801123 DISPLAY "correct". IF FUNCTION DATE-TO-YYYYMMDD (801123, 100 ) = 20801123 DISPLAY "correct". IF FUNCTION DATE-TO-YYYYMMDD (801123, -100 ) = 18801123 DISPLAY "correct". |
DATE-TO-YYYYMMDD implements a sliding window algorithm. To use it for a fixed window, you can specify arg-2 as follows:
(fixed-ending-year - function numval (function current-date (1:4))) |
If fixed-ending-year is 2100, then in 1999 arg-2 has the value 101. If arg-1 is 501123, the returned-value is 20501123. If arg-1 is 991123, the returned-value is 20991123.
The DAY-OF-INTEGER function converts a date from an integer date form representing the number of days succeeding December 31, 1600, to a date form (sometimes called "Julian") representing year and days (YYYYDDD).
num-days
is a positive integer argument that represents a number of days succeeding December 31, 1600, in the Gregorian calendar.
COMPUTE RSULT = FUNCTION DAY-OF-INTEGER (28). |
1601028 |
The DAY-TO-YYYYDDD function converts a date in the form YYDDD to the form YYYYDDD. An optional second argument, when added to the current year (at the time the program executes), defines the ending year of a 100-year interval. This interval determines to what century the two-digit year belongs.
General Format
FUNCTION DAY-TO-YYYYDDD ( arg-1 [ arg-2 ] ) |
arg-1
is a nonnegative integer between 0 and 99999.arg-2
is an integer. Its value, when added to the current year, must be between 1700 and 9999. If it is omitted, the default value is 50.
YY = int(arg-1 / 1000) ddd = mod (arg-1, 1000) return FUNCTION YEAR-TO-YYYY(YY, arg-2) * 1000 + ddd |
IF FUNCTION DAY-TO-YYYYDDD (80111, 50 ) = 1980111 DISPLAY "correct". IF FUNCTION DAY-TO-YYYYDDD (80111, 100 ) = 2080111 DISPLAY "correct". IF FUNCTION DAY-TO-YYYYDDD (80111, -100 ) = 1880111 DISPLAY "correct". |
(fixed-ending-year - function numval (function current-date (1:4))) |
The FACTORIAL function returns an integer that is the factorial of the argument specified.
num
is 0 or a positive integer argument whose value is less than or equal to 19.
COMPUTE RSULT = FUNCTION FACTORIAL (NUM). |
The INTEGER function returns the greatest integer value that is less than or equal to the argument.
num
is a numeric argument.
The type of this function is integer.
COMPUTE RSULT = FUNCTION INTEGER (NUM). |
The INTEGER-OF-DATE function converts a date from standard date form (YYYYMMDD) to an integer date form representing the number of days after December 31, 1600.
num
is an integer argument of the form YYYYMMDD representing a date subsequent to December 31, 1600.
COMPUTE RSULT = FUNCTION INTEGER-OF-DATE (NUM). |
COMPUTE DAYS-IN-BILLING-CYCLE = FUNCTION INTEGER-OF-DATE(THIS-ENDING-DATE) - FUNCTION INTEGER-OF-DATE(LAST-ENDING-DATE) |
Previous | Next | Contents | Index |