CLOSE (QSAM)

Syntax:

CLOSE(ddname)

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.

Module Name:

SWXCLOSE

Service Description:

CLOSE completes I/O operations, updates VTOC information, and disconnects your program from the data set.

Returned Information:

The CLOSE function returns the QSAM 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 QSAM CLOSE return code. An RC of zero means the operation was completed successfully.
REASON
Contains the QSAM 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. Close a data set using CALL:
    call close 'outdd'
    if rc <> 0 then do
      say 'CLOSE failed with RC='rc 'REASON='reason
      exit 8
    end
    


© Copyright 1998 by Open Software Technologies, Inc.