C$GETLASTFILEOP

C$GETLASTFILEOP retrieves information about the last file operation performed.

Usage

CALL "C$GETLASTFILEOP" 
    USING OPERATION, ADDR, X-ADDR

Parameters

OPERATION PIC X(n)

Receives the name of the last file operation performed in the current thread. If the current thread has not performed any file operations, then OPERATION is set to spaces. The possible values are:

Close ReadPreviousLock
Commit ReadPreviousNoLock
Delete Rewrite
DeleteFile Rollback
Open Start
ReadLock StartTransaction
ReadNextLock Unlock
ReadNextNoLock UnlockAll
ReadNoLock Write

If the current thread has not performed any file operations, then OPERATION is set to spaces.

ADDR Numeric (optional)    

Receives the virtual address of the instruction that performed the last file operation in the current thread. If no operation has been performed, zero is returned.

X-ADDR PIC X(n) (optional)

Receives a 6-character string that contains the hexadecimal equivalent of the value returned in ADDR.

Description

C$GETLASTFILEOP should be called from Declaratives when an unexpected I/O error has occurred. The return values can be useful in some debugging or customer support scenarios.

The ADDR parameter is provided primarily for compatibility with other COBOL systems. You would normally convert the value returned by ADDR to hexadecimal and look up the result in the program's compiler listing. As a convenience, the X-ADDR parameter performs the hexadecimal conversion for you. You can omit the ADDR parameter by specifying "NULL" or "OMITTED" in the CALL statement, for example:

77  FILE-OP     PIC X(20).
77  X-ADDR      PIC X(6).
CALL "C$GETLASTFILEOP" USING FILE-OP, NULL, X-ADDR

This routine always returns a value of 0 for ADDR and X-ADDR when called by a Version 5.1, or earlier, native-code object file. Non-native object files return correct values regardless of version.