1 USER_FUNCTIONS
 The currently defined VAX-11 Datatrieve functions are listed below.
 A description of each is available as a subtopic to HELP USER_FUNCTIONS.

2 FN$ABS

 Calculates: Absolute value of input
      Input: Signed decimal number
     Output: Unsigned decimal number
    Example: DTR> PRINT FN$ABS(-128)
               FN$ABS
             128.000000
             DTR>


2 FN$AMOD

 Calculates: Value of input according to specified modulus
      Input: Floating point value and modulus
     Output: Floating point value
    Example: DTR> PRINT FN$AMOD(31.0,7.0)
               FN$AMOD
             3.000E+00
             DTR>


2 FN$ATAN

 Calculates: Arctangent of input
      Input: Signed decimal number
     Output: Signed decimal number
    Example: DTR> PRINT FN$ATAN (45)
               FN$ATAN
             1.54857778
             DTR>


2 FN$COS

 Calculates: Cosine of input
      Input: Signed decimal number
     Output: Signed decimal number
    Example: DTR> PRINT FN$COS (45)
               FN$COS
             .525321960
             DTR>


2 FN$DAY

 Calculates: Day part of input
      Input: Date
     Output: Unsigned integer from 1 to 31
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$DAY (Y)
               FN$DAY
                       1
             DTR>


2 FN$EXP

 Calculates: Value of e to specified power
      Input: Signed decimal number
     Output: Signed decimal number
    Example: DTR> PRINT FN$EXP (2)
               FN$EXP
             7.38905620
             DTR>


2 FN$FLOOR

 Calculates: Integer part of input
      Input: Signed decimal number
     Output: Signed decimal number
    Example: DTR> PRINT FN$FLOOR (59.99)
               FN$FLOOR
             59.0000000
             DTR>


2 FN$HEX

 Calculates: Hexadecimal equivalence of input
      Input: Signed decimal number
     Output: Hexadecimal character string
    Example: DTR> PRINT FN$HEX (183)
               FN$HEX
                    B7
             DTR>


2 FN$HOUR

 Calculates: Hour part of input
      Input: Date
     Output: Unsigned integer from 1 to 24
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$HOUR (Y)
               FN$HOUR
                       8
             DTR>


2 FN$HUNDREDTH

 Calculates: Hundredth-of-a-second part of input
      Input: Date
     Output: Unsigned integer from 0 to 99
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$HUNDREDTH (Y)
               FN$HUNDREDTH
                        55
             DTR>


2 FN$INIT_TIMER

 Calculates: Nothing, initializes a timer
      Input: NONE
     Output: NONE
    Example: DTR> PRINT FN$INIT_TIMER
                  FN$INIT
                   TIMER
                          1
             DTR>


2 FN$JULIAN

 Calculates: Julian date of input
      Input: Date
     Output: Unsigned integer from 1 to 366
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$JULIAN (Y)
               FN$JULIAN
                       51
             DTR>


2 FN$LN

 Calculates: Natural log of input
      Input: Signed decimal number
     Output: Signed decimal number
    Example: DTR> PRINT FN$LN (36)
               FN$LN
             3.58351898
             DTR>


2 FN$LOG10

 Calculates: Common (base 10) log  of input
      Input: Signed decimal number
     Output: Signed decimal number
    Example: DTR> PRINT FN$LOG10 (36)
               FN$LOG10
             1.5563E+00
             DTR>


2 FN$MINUTE

 Calculates: Minute part of input
      Input: Date
     Output: Unsigned integer from 0 to 59
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$MINUTE (Y)
               FN$MINUTE
                       51
             DTR>


2 FN$MOD

 Calculates: Value of input according to specified modulus
      Input: Signed number, modulus
     Output: Unsigned integer
    Example: DTR> PRINT FN$MOD (31,7)
               FN$MOD
                       3
             DTR>


2 FN$MONTH

 Calculates: Month part of input
      Input: Date
     Output: Unsigned integer from 1 to 12
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$MONTH (Y)
               FN$MONTH
                        4
             DTR>


2 FN$NINT

 Calculates: Integer nearest to input
      Input: Signed number
     Output: Signed number
    Example: DTR> PRINT FN$NINT (59.99)
               FN$NINT
                      60
             DTR>


2 FN$OPENS_LEFT

 Calculates: Number of additional files you can open
      Input: None
     Output: Unsigned integer
    Example: DTR> PRINT FN$OPENS_LEFT
               FN$OPENS
                 LEFT
                        3
             DTR>


2 FN$SECOND

 Calculates: Second part of input
      Input: Date
     Output: Unsigned integer from 0 to 59
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$SECOND (Y)
               FN$SECOND
                       11
             DTR>


2 FN$SHOW_TIMER

 Calculates: Nothing, displays timer statistics
      Input: NONE
     Output: NONE
    Example: DTR> PRINT FN$SHOW_TIMER
                  FN$SHOW
                   TIMER
             ELAPSED 00....
                     1
             DTR>


2 FN$SIGN

 Calculates: Sign of input
      Input: Floating value in R0
     Output: Floating value passed by reference
    Example: DTR> PRINT FN$SIGN (-45)
               FN$SIGN
                      -1
             DTR>


2 FN$SIN

 Calculates: Sine of input
      Input: Signed decimal number
     Output: Signed decimal number
    Example: DTR> PRINT FN$SIN (45)
               FN$SIN
             .850903511
             DTR>


2 FN$SQRT

 Calculates: Square root of input
      Input: Zero or positive decimal number
     Output: Zero or positive decimal number
    Example: DTR> PRINT FN$SQRT (196)
               FN$SQRT
             14.0000000
             DTR>


2 FN$STR_EXTRACT

 Calculates: Extracts substring from input
      Input: Character string, ordinal number of starting
             character, length of desired substring
     Output: Substring
    Example: DTR> DECLARE X PIC X(12).
             DTR> X = "603-555-1212"
             DTR> PRINT FN$STR_EXTRACT (X,5,3)
               FN$STR
               EXTRACT
              555
             DTR>


2 FN$STR_FIRST_CH

       Name: FN$STR_FIRST_CHAR
 Calculates: ASCII value of first character of input
      Input: Character string
     Output: ASCII value as unsigned integer
    Example: DTR> DECLARE X PIC X(12).
             DTR> X = "603-555-1212"
             DTR> PRINT FN$STR_FIRST_CHAR (X)
               FN$STR
               FIRST
                CHAR
                      54
             DTR>


2 FN$STR_LOC

 Calculates: Starting position of substring in input
      Input: Character string, substring
     Output: Unsigned integer
    Example: DTR> DECLARE X PIC X(12).
             DTR> X = "603-555-1212"
             DTR> PRINT FN$STR_LOC (X,"555")
               FN$STR
                LOC
             5
             DTR>


2 FN$TAN

 Calculates: Tangent of input
      Input: Signed decimal number
     Output: Signed decimal number
    Example: DTR> PRINT FN$TAN (45)
               FN$TAN
             1.61977529
             DTR>


2 FN$TIME

 Calculates: Time part of input
      Input: Date
     Output: Time in VAX/VMS format
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$TIME (Y)
               FN$TIME
              08:51:11.5
             DTR>


2 FN$TRANS_LOG

 Calculates: Value of logical name
      Input: Character string
     Output: Character string
    Example: DTR> PRINT FN$TRANS_LOG("DTR$SYNONYM") USING X(30)
                           FN$TRANS
                             LOG
             DB0:[JONES.DAT]SYNONYM.DAT
             DTR>


2 FN$UPCASE

 Calculates: Upshift all characters in input string
      Input: Character string
     Output: Character string
    Example: DTR> PRINT FN$UPCASE("This is a test string") USING X(30)
                           FN$UPCASE
             THIS IS A TEST STRING
             DTR>


2 FN$YEAR

 Calculates: Year part of input
      Input: Date
     Output: Unsigned integer for years from 1858 to 9999
    Example: DTR> DECLARE Y USAGE DATE EDIT_STRING X(23).
             DTR> Y = "NOW"
             DTR> PRINT Y
                        Y
              1-Apr-1982 08:51:11.55
             DTR> PRINT FN$YEAR (Y)
               FN$YEAR
                    1982
             DTR>


2 FN_CHK_HEX

 Calculates: Checks for hexadecimal input string
      Input: Input string
     Output: Boolean value
    Example: DTR> PRINT FN_CHK_HEX ("A2")
               FN
               CHK
               HEX
                     1
             DTR>


2 FN_CHK_OCT

 Calculates: Checks for octal input string
      Input: Input string
     Output: Boolean value
    Example: DTR> PRINT FN_CHK_OCT ("77")
               FN
               CHK
               OCT
                     1
             DTR>


2 FN_CVT_BIN

 Calculates: Converts unsigned byte or word to signed longword
      Input: Unsigned integer value and length (1,2,4 bytes)
     Output: Signed integer
    Example: DTR> PRINT FN_CVT_BIN (255,1)
               FN
               CVT
               BIN
                     -128
             DTR>


2 FN_CVT_HTB

 Calculates: Binary equivalent of hexadecimal input
      Input: Hexadecimal input string
     Output: Signed integer
    Example: DTR> PRINT FN_CVT_HTB ("A2")
               FN
               CVT
               HTB
                     162
             DTR>


2 FN_CVT_OTB

 Calculates: Binary equivalent of octal input
      Input: Octal input string
     Output: Signed integer
    Example: DTR> PRINT FN_CVT_OTB ("144")
               FN
               CVT
               OTB
                     100
             DTR>


2 FN_CVT_QHTB

 Calculates: Binary equivalent of hexadecimal input
      Input: Hexadecimal input string
     Output: Unsigned quadword integer
    Example: DTR> PRINT FN_CVT_QHTB ("A2")
               FN
               CVT
               HTB
                     162
             DTR>


2 FN_QHEX

 Calculates: Hexadecimal equivalence of input
      Input: Unsigned quadword number
     Output: Hexadecimal character string
    Example: DTR> PRINT FN_QHEX (183)
               FN_QHEX
                    B7
             DTR>


