# ENDREQ (VSAM)

## Syntax:

    ENDREQ(ddname)

## Arguments:

ddname
  is the 1 to 8 character name that identifies the data set you want to process. This name needs to have been previously associated with the data set, either via the ALLOCATE command or JCL DD statement, and opened via the OPEN function.

## Module Name:

SWXENDRQ

## Service Description:

The ENDREQ function is used to force VSAM to write buffers, release exclusive control of control intervals (for certain share options), and to "forget" positioning. Before you can use the ENDREQ function you must first allocate and open (using the OPEN function) the data set associated with the ddname argument. If you do not, an error will occur.

## Returned Information:

The ENDREQ function returns the VSAM ENDREQ macro return code. If you CALL the ENDREQ function, the returned value is contained in the RESULT special variable.

After completion of a ENDREQ function call, several special REXX variables are populated with useful information. You should treat these variables as "read only" and make no attempt to modify any of them. The variables are:

RC
  Contains the VSAM ENDREQ return code. Zero means the operation was completed successfully.
REASON
  Contains the VSAM ENDREQ reason code.

## Examples:

1. After directly retrieving a record for update, either update the record using the PUT function, or release control of the record using the ENDREQ function:

       parse value get('iodd','CAT','(dir,upd)'),
             with . +10 type .
       if (rc = 0) & (type = 'SIAMESE') then do
         /* Build new record here */
         call put 'iodd', newrec
       end
       else
         call endreq 'iodd'

© Copyright 1998 by Open Software Technologies, Inc.