# OPEN (BPAM)

## Syntax:

    OPEN('BPAM',ddname[,option])

## Arguments:

'BPAM'
  indicates that the BPAM access method is to be used to open the file. This argument must be coded as shown.
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. If you try to open a ddname that is already open, the request is ignored and no error indication is given.

  Note: The names 'VSAM', 'QSAM', and 'BPAM' are reserved. Do not use these strings for ddnames.

option
  the following values may be used:
  'INPUT'
    indicates that records will be read, only. This the default.
  'OUTPUT'
    indicates that records will be written, only.
  'UPDATE'
    indicates that records will be read, and that some or all records may be re-written.

## Module Name:

SWXOPEN

## Service Description:

OPEN is used to "connect" your program to a data set. You must open a data set before you can perform any other operations (FINDM, GET, PUT, STOWM). All data sets should be closed (using the CLOSE function) when you are finished using them.

Note: The Shadow REXXTOOLS BPAM interface is in no way connected with the REXX EXECIO command.

## Returned Information:

The OPEN function returns the BPAM OPEN macro return code. If you CALL the OPEN function, the returned value is contained in the RESULT special variable. After completion of an OPEN function call, the RC and REASON variables will contain return code information. Several other variables are also produced. You should treat these variables as "read only" and make no attempt to modify any of them. The variables are:

RC
  Contains the BPAM OPEN return code. An RC of zero means the operation was completed successfully.
REASON
  Contains the BPAM OPEN reason code.
$SWXRECFM
  Indicates the record format of the data set.
$SWXLRECL
  Indicates the maximum record length of records in the opened data set.
$SWXBLKSI
  Indicates the maximum length of a block for the data set.
$SWXBUFNO
  Indicates the number of BLKSIZE-sized buffers that will be used in performing input/output operations.

## Examples:

1. Allocate and open a PDS for read access:

       "alloc fi(indd) da(mypds.data) shr reu"
       if open('bpam','indd') <> 0 then say 'Open failed.'

   Note the following:
   1. No option is specified because 'INPUT' is the default.
   2. A member name is not specified on the ALLOC. Prior to reading a member, the FINDM function must be used.

© Copyright 1998 by Open Software Technologies, Inc.