# GET (BPAM)

## Syntax:

    GET(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:

SWXGET

## Service Description:

The GET function is used to retrieve records from PDS/PDSE members. Before you can use the GET function you must first allocate and open (using the OPEN function) the data set associated with the ddname argument. In addition, the FINDM function must be used to position to the member. GET is used to retrieve records sequentially (i.e., you can't skip records - but you can read past them).

GET also is used to update records. If you wish to update records, you must OPEN the ddname using the 'UPDATE' option. After you have read a record using GET, the next PUT will re-write the record to the file.

You may use GET only if the file has been opened for input or update. If the file is open for output, you must close and re-open it for input or update.

## Returned Information:

The GET function, if successful, returns the record requested. If the GET request fails, a null string (zero length) is returned. If the GET function is CALLed, the REXX special variable, RESULT, will contain the returned record.

After completion of a GET function call, the RC and REASON variables will contain return code information. You should treat these variables as "read only" and make no attempt to modify any of them. The variables are:

RC
  Contains the BPAM GET return code. An RC of zero means the operation was completed successfully. A return code of 8 indicates that no more records are available (end-of-file).
REASON
  Contains the BPAM GET reason code.

## Examples:

1. Sequentially retrieve records from a PDS member (EMPLOYEE) starting with the first record:

       "alloc fi(indd) da(user.pds) shr reu"
       call open 'bpam', 'indd', 'input'
       call findm 'indd', 'employee'
       record = get('indd')
       do while rc = 0
         parse var record 22 ssn +11 lname +10 fname +10
         say left(fname,10) left(lname,10) left(ssn,11)
         record = get('indd')
       end
       call close 'indd'

© Copyright 1998 by Open Software Technologies, Inc.