%SUCCESS

Determine if low-order bit is on or off

 

 

VSupported on OpenVMS

 

status = %SUCCESS(expression)

Return value

status

0 if the low-order bit of expression is off, or 1 if the low-order bit is on. (i)

Arguments

expression

Any valid numeric expression. (n)

Discussion.

Tip

We recommend using a .BAND. test of bit 1 rather than %SUCCESS.

Examples

This example function calls an OpenVMS system function to determine whether or not a file exists. It calls %SUCCESS to check the status of the return value from this system function.

function file_exists
external function
    lib$find_file        ,^val  ;OpenVMS system function 
record
    context              ,i4    ;Arguments for lib$find_file
    return_file_spec     ,i4
    ffile                ,i4    ;For the return value 
proc
    context = 0
    ffile = %lib$find_file(filename, return_file_spec, ^ref(context),,,,) 
    xcall lib%find_file_end(^ref(context))    ; Release context block
    if (%success(ffile)) then
      freturn (%true)           ;File exists 
    else
      freturn (%false)          ;File doesn't exist
endfunction