# CLOSE (VSAM)

## Syntax:

    CLOSE(ddname[,'T'])

## Arguments:

ddname
  is the 1 to 8 character name that identifies the data set you want to process. The data set associated with the ddname needs to have been previously opened (using the OPEN function) by the program that is closing it. If you attempt to close a ddname that has not been opened (or has already been closed) the request is ignored and no error indication is given.

  Note: For compatibility with earlier releases of REXXTOOLS, the first argument can contain the string 'VSAM', and the second argument can contain the ddname. The 'VSAM' argument is no longer required, provided that you use a ddname that is not 'VSAM', 'QSAM', or 'BPAM'.

'T'
  indicates that a TYPE=T close is to be performed. A TYPE=T close causes VSAM to complete pending I/O operations and update catalog information, without disconnecting the program from the data set. Processing can continue after the close without re-opening the data set.

## Module Name:

SWXCLOSE

## Service Description:

CLOSE performs two functions:

- If 'T' is coded, CLOSE completes I/O operations and updates the catalog information, but does not disconnect your program from the data set. You may continue processing without reopening the data set.
- If 'T' is not coded, CLOSE completes I/O operations, updates catalog information, and disconnects your program from the data set.

## Returned Information:

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

After completion of a CLOSE 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 CLOSE return code. Zero means the operation was completed successfully.
REASON
  Contains the VSAM CLOSE reason code. If the file was already closed or has never been opened, a value of 1 is returned in REASON.

## Examples:

1. Close a data set:

       if close('indd') = 0 then say 'Data set closed.'

2. Force I/O operations to complete and update the catalog without disconnecting the program from the data set:

       call close 'outdd', 't'

© Copyright 1998 by Open Software Technologies, Inc.