PDS GET

Gets data from the member specified in a PDS FIND call.

Type

PDS function

Format

PDS(GET handle)
handle
The handle established by FIND for the member to be read.

Usage Notes®

  1. PDS FIND returns a string that contains the next line from the member pointed to by handle. It returns a null string when at end-of-file or if an error occurs.
  2. The Dialog Manager can misinterpret a line of blanks as a null value and incorrectly indicate end-of-file. When testing for a null string, be sure to enclose the variable name in single quotes to prevent the Dialog Manager from stripping all the blanks:
    set Data (pds(get &Handle))
    if '&Data' = '' ...do end of file processing...
  3. When PDS GET reaches end-of-file, it issues an implicit PDS 'END'. If your dialog stops issuing GET requests before end-of-file, it must explicitly issue PDS 'END' to release the PDS resources.
  4. Data is retrieved from the PDS member as-is.

Example

This example locates member ABC in the PDS MY.TEST.PDS and logs its contents to TLVLOG:

set MHand (pds(find 'ABC' '*MY.TEST.PDS'))
if &MHand > 0
  while (set Data (pds(get &MHand))) log('&Data' 0 1 1)
else if &MHand = 0 log('Member ABC is not in MY.TEST.PDS' 0 1 1)
else if &MHand = (neg 4) log('Could not allocate MY.TEST.PDS' 0 1 1)
else if &MHand < (neg 256) do
  set RC (&MHand / (neg 256))
  if &RC > 4096 do
    set RC (&RC - 4096)
    set RC (rjust('0000&RC' 4))
    set RC 'U&RC'
  end
  else do
    set RC (d2x(&RC 3))
    set RC 'S&RC'
  end
  log('PDS FIND abended &RC' 0 1 1)
end
else log('PDS FIND failed, RC=&MHand' 0 1 1)

See Also

PDS 'END'

PDS FIND

PDS WRITE