7.11 FETCH_CURRENT_RECORD_WITH_LOCK

Use FETCH_CURRENT_RECORD_WITH_LOCK to get the record from the target table with the same key as the current source record, locking the record for update. This makes the record buffer available to be read into the user exit by completing a call to GET_RECORD for the target image.

FETCH_CURRENT_RECORD_WITH_LOCK is supported only for key-sequenced and entry-sequenced Enscribe files. The implementation for entry-sequenced files requires the use of a specified ALTKEY for proper positioning. The use of FETCH_CURRENT_RECORD_WITH_LOCK is not recommended for inserts into entry-sequenced files.

Fetching from the target table is only supported by Replicat, and only if a mapped target buffer is available. Replicat fetches the current record by key.

Syntax

For C:

#include "usrdecs"
short     result;
typedef struct {
  long error_num; 
  char error_msg;
  long max_length; 
  long actual_length;
  short msg_truncated;
} error_info_def;
error_info_def error_info_ptr;
result = FETCH_CURRENT_RECORD_WITH_LOCK(&error_info_ptr);

For TAL:

?source usrdect
int result;
int .ext error_info_ptr(error_info_def);
result := FETCH_CURRENT_RECORD_WITH_LOCK(error_info_ptr);

For COBOL:

?CONSULT =REPLICAT
01 result          PIC S9(4) COMP.
01 error-info.
  02 error-num     PIC S9(4) COMP.
  02 error-msg     PIC X(600).
  02 max-length    PIC S9(4) COMP.
  02 actual-length PIC S9(4) COMP.
  02 msg-truncated PIC S9(4) COMP.
ENTER C "FETCH_CURRENT_RECORD" using error-info giving result.
actual-length

The actual length of the error message that is included.

error-msg

The message explaining the error. The size is set when the function is used. PIC X(600) is only an example of a possible value.

error_num

A code indicating whether the call was successful or not.

max-length

The maximum length allowed for an error message.

msg-truncated

Indicates whether the error message has been truncated.