Marc's Place

DIBIOL/DBL - Functions

DIBOL functions are routines referenced by symbolic names. When the function name is
referenced the routined defined by the function name is executed and the resulting
value replaces the function name. (See bottom for a user-defined function)

C - Indicates a compile-time function.
Z - Zoned.
P - Packed.
I - Integer
A - Alpha
X - Return type same as type passed.
¥ - May be used in the Data Division

%ABS     - Returns the absolute value of a numeric expression.

X     %ABS (exp)


%ADDR    - Returns the address  of the field.

I     %ADDR (field)


%ARGA    - Returns the alpha string of an argument passed to a subroutine or function.

A     %ARGA (arg)


%ARGN    - Returns the numeric value of an argument passed to a subroutine or function.

X     %ARGN (arg)


%B       ¥ Interprets the numeric value following as a binary number.

IC     %B (value)


%BIN     - Returns binary representation (alpha data type) of symbol;
           flag = 1, 8 pos; = 2, 16 pos; = 4, 32 pos (default).

A     %BIN (exp {,flag})


%BIT_IS_CLR - Returns a 0 or a 1 dependent upon a bit value in the binary
              representation of an expression.

I     %BIT_IS_CLR (bitnum,value)


%BIT_IS_SET - Returns a 0 or a 1 dependent upon a bit value in the binary
              representation of an expression.

I     %BIT_IS_SET (bitnum,value)


%BKSTR    - Returns position (integer data type) of last occurrence of substring
            in main string. (vervanger voor DBL$BKSTR)
            start_pos > 0, positioneer vanaf links; < 0, positioneer vanaf het einde.

I     %BKSTR (start_pos,string,substring)


%CHAR     ¥ Returns the ASCII character (alpha data type) for the expression.
            (vervanger voor XCALL ASCII)

A(C)     %CHAR (exp)


%CHOPEN   - Returns zero (integer data type) if channel not open; non-zero
            otherwise. (vervanger voor DBL$CHOPEN)

I     %CHOPEN (ch)


%CPUTIME  - Returns CPU-time (integer data type) accumulated by the process in
            tics. (vervanger voor DBL$CPUTM)

I     %CPUTIME


%CTS300   - Returns a non-zero value if the program is being compiled by the
            cross-compiler with the target system %CTS300; otherwise returns
            an integer data type.

     %CTS300


%D        ¥ Interprets the numeric value following as an decimal number.

IC     %D (value)


%DATE     - Returns the current date (alpha data type, 9 pos).
            (vervanger voor XCALL DATE)

A     %DATE


%DECML    ¥ Returns the numeric (integer data type) character code of the
            string's first character. (vervanger voor XCALL DECML)

I(C)     %DECML (string)


%DESCR    - Passes the argument using the "by descriptor" mechanism (default).

     %DESCR (exp)


%DEFINED  ¥ Returns a non-zero (integer data type) value if the symbol is
            defined.

IC     %DEFINED (symbol)


%ERLINE   - Returns the line number of the last error encountered (integer data
            type). (vervanger voor XCALL ERROR (, LIN)

I     %ERLINE


%ERRMOD   - Returns the name of the module which contained the error.

     %ERRMOD


%ERROR    - Returns the error number (integer data type) of the last error
            encountered. (vervanger voor XCALL ERROR (ERR,))

I     %ERROR


%HEX      - Returns hexadecimal (alpha data type) representation of exp.
            flag = 1, 2 pos; = 2, 4 pos; = 4, 8 pos (default).

A     %HEX (exp {,flag})


%INRANGE  - Matches any values within the range given by USING-RANGE. Returns
            same data type as passed.

XC     %INRANGE


%INSTR    - Returns position (integer data type) of substring in main string.
            (vervanger voor XCALL INSTR)

I     %INSTR (start_pos,string,substring)


%INT      - Returns the integer portion of the expression.

X     %INT (exp)


%INTEGER  - Causes a conversion of the symbol to be integer decimal.

I     %INTEGER (exp)


%JBNO     - Returns current job number (integer data type); the process id.
            (vervanger voor XCALL JBNO)

I     %JBNO


%NUMARGS  - Returns the number of arguments passed to a subroutine or function.

I     %NUMARGS


%O        ¥ Interprets the numeric value following as an octal number. Returns an
            integer data type.

IC     %O (value)


%OCT      - Returns octal (integer data type) representation of numeric exp.
            flag = 1, 3 pos; = 2, 6 pos; = 4, 11 pos (default).

A     %OCT (exp {,flag})


%OUTRANGE - Matches any values outside the limits given by USING-RANGE.
                       Returns same data type as passed.

XC     %OUTRANGE


%PACKED   - Causes a conversion of the symbol to be a packed decimal.

P     %PACKED (exp)


%PASSED   - Returns a value which indicates whether or not an argument was passed.
            Use before using %SIZE.

I(C)     %PASSED (argname)


%PRO      - Returns a non-zero value if the program is being compiled by the
            cross-compiler with the target system %PRO; otherwise returns
            an integer data type.

     %PRO


%REF      - Passes or declares the argument using the "by ref" mechanism.

     %REF (exp)


%RFA      - Passes the address of a record in a file of any oranization.
            (vervanger voor XCALL GETFA)

I     %RFA


%RSIZE    - Returns the size (integer data type) of the last record read.
            (vervanger voor XCALL RSTAT(D))

I     %RSIZE


%RSTS     - Returns a non-zero value if the program is being compiled by the
            cross-compiler with the target system RSTS; otherwise reurns an integer
            data type.

     %RSTS


%RSX      - Returns a non-zero value if the program is being compiled by the
            cross-compiler with the target system RSX.

     %RSX


%RTERM    - Returns the last numeric code (integer data type) of the terminating
            character of the last record read. (vervanger voor XCALL RSTATD)

I     %RTERM


%SIZE     ¥ Returns the size (integer data type) of the field.
            (vervanger voor XCALL SIZE)

I(C)     %SIZE (field)


%STRING   - Causes a conversion of the symbol to be alpha.

A     %STRING (exp)


%SUCCESS  - Returns 1 (integer data type) if the value is a successful error
            value, otherwise 0.

I     %SUCCESS (value)


%SYSERR   - Returns the error number of the RMS system error associated with
            the last trappable error that occurred.
            (vervanger voor XCALL ERROR (ERR,))

I     %SYSERR


%TIME     - Returns the current time (zoned data type, 6 pos).
            (vervanger voor XCALL TIME)

Z     %TIME


%TNMBR    - Returns the number of the terminal to which the program is attached.
            (vervanger voor XCALL TNMBR)

I     %TNMBR


%TTNAME   - Returns the name (alpha data type) of the terminal the program is
            running on. (vervanger voor DBL$TTNAME)

A     %TTNAME


%TTSTS    - Returns a number (integer data type) of characters which have been
            entered on the terminal attached to the specified channel.
            (vervanger voor XCALL TTSTS)

I     %TTSTS (ch)


%UNSIGNED - Returns the unsigned value of a numeric expression.

X     %UNSIGNED (exp)


%VAL      - Passes or declares the argument using the "by value" mechanism.

     %VAL (arg/exp)


%VARIANT  ¥ Returns the value of the /VARIANT compiler switch (integer data type).

IC     %VARIANT


%VERSN    - Returns DIBOL version (alpha data type).
            (vervanger voor XCALL VERSN)

A     %VERSN


%VMS      ¥ Returns a non-zero value if the program is being compiled by the
            cross-compiler with the target system VMS; otherwise returns an integer
            data type.

IC     %VMS


%WAIT     - Specifies what to wait for and returns which event (integer data
            type) caused program to abort the wait.
            (vervanger van XCALL WAIT) (zie ook (S)SEND en (S)RECV))

I     %WAIT (event {,seconds})

          WAIT Option Fields
          ------------
          | 4 | 3 | 2 | 1 |
          ------------

               1    Wait for specified time to expire.
               2    Wait for terminal input at any one of the terminals
                     opened by the program.
               3    Wait for a terminator to be typed at any one of the
                     terminals opened by the program.
               4    Wait for a message.


%WKDAY     - Returns an integer data type which identifies the day of the week
             (e.g. 1 indicates Sunday, 2 Monday, etc.).
             (vervanger voor DBL$WKDAY)

I     %WKDAY


%X         ¥ Interprets the alpha-numeric value following as a hexadecimal number.
             Returns an integer data type.

IC     %X (value)


%XTRNL     ¥ Directs the Linker to supply the Link-time value of the
             externally-defined symbol.

     %XTRNL (symbol)


%ZONED     - Causes a conversion of the symbol to be a zoned decimal.

Z     %ZONED (exp)
Example

User-defined function LENGTH

(Main program)

record
          buffer,     A132

external function
          length,     I

.proc
          ...
          display (1, buffer(1, %length(buffer))
          ...
.end

(Function LENGTH)

function LENGTH
          buf,          A

record
          max,         I4
          size,         I4

.proc
          max = %size(buf)

          for size from max thru 1 by -1
                    if buf(size,size).ne." " exitloop

          freturn size
.end
© 1997- Marc Vos (and others)   -   Privacy Statement   -    Contact Me

On this website, Google Analytics is used to track visitor statistics. These are anonymised data about the number of visitors, which pages they visit on this site, from which regions they visit, which web browsers they use, etc.. You will also see non-personalised ads via Google AdSense. Cookies from Paddle or Paypal are placed when you click on a 'Buy now!' or 'Donate!' button, and possible cookies from Disqus when you use that system to comment on one or more blogposts.
Privacy Statement