The SOR$STAT routine returns one statistic about the sort or
    merge operation to the user program.
    Format
      SOR$STAT  code ,result [,context]
1 – Returns
    OpenVMS usage:cond_value
    type:         longword (unsigned)
    access:       write only
    mechanism:    by value
    Longword condition value. Most utility routines return a
    condition value in R0. Condition values that this routine can
    return are listed under Condition Values Returned.
2 – Arguments
 code
    OpenVMS usage:longword_unsigned
    type:         longword (unsigned)
    access:       read only
    mechanism:    by reference
    SORT/MERGE statistic code. The code argument is the address of
    a longword containing the code that identifies the statistic
    you want returned in the result argument. The following table
    describes the values that are accepted.
    Note: The high-performance Sort/Merge utility currently supports
    only the following subset of these values: SOR$K_REC_INP, SOR$K_
    REC_SOR, SOR$K_REC_OUT, SOR$K_LRL_INP.
    Code             Description
    SOR$K_IDENT      Address of ASCII string for version number
    SOR$K_REC_INP    Number of records input
    SOR$K_REC_SOR    Records sorted
    SOR$K_REC_OUT    Records output
    SOR$K_LRL_INP    Longest record length (LRL) for input
    SOR$K_LRL_INT    Internal LRL
    SOR$K_LRL_OUT    LRL for output
    SOR$K_NODES      Nodes in sort tree
    SOR$K_INI_RUNS   Initial dispersion runs
    SOR$K_MRG_       Maximum merge order
    ORDER
    SOR$K_MRG_       Number of merge passes
    PASSES
    SOR$K_WRK_ALQ    Work file allocation
    SOR$K_MBC_INP    Multiblock count for input
    SOR$K_MBC_OUT    Multiblock count for output
    SOR$K_MBF_INP    Multibuffer count for input
    SOR$K_MBF_OUT    Multibuffer count for output
    Note that performance statistics (such as direct I/O, buffered
    I/O, and elapsed and CPU times) are not available because user-
    written routines may affect those values. However, they are
    available if you call LIB$GETJPI.
 result
    OpenVMS usage:longword_unsigned
    type:         longword (unsigned)
    access:       write only
    mechanism:    by reference
    SORT/MERGE statistic value. The result argument is the address
    of a longword into which SORT/MERGE writes the value of the
    statistic identified by the code argument.
 context
    OpenVMS usage:context
    type:         longword (unsigned)
    access:       modify
    mechanism:    by reference
    Value that distinguishes between multiple, concurrent SORT/MERGE
    operations. The context argument is the address of a longword
    containing the context value. When your program makes its first
    call to a SORT/MERGE routine for a particular sort or merge
    operation, the context longword must equal zero. SORT/MERGE
    then stores a value in the longword to identify the operation
    just initiated. When you make subsequent routine calls for the
    same operation, you must pass the context value supplied by
    SORT/MERGE.
3 – Description
    The SOR$STAT routine returns one statistic about the sort or
    merge operation to your program. You can call the SOR$STAT
    routine at any time while the sort or merge is active.
    Some of the following condition values are used with different
    severities, depending on whether SORT/MERGE can recover. Thus,
    if you want to check for a specific status, you should use
    LIB$MATCH_COND.
4 – Condition Values Returned
    SOR$_ENDDIAGS      Completed with diagnostics.
    SOR$_MISS_PARAM    A required subroutine argument is missing.
    SOR$_NYI           Functionality is not yet implemented.
    SOR$_SYSERROR      System service error.