FINDMEM: Finding a Member of a Partitioned Data Set

How to:

Available Operating Systems: z/OS

Available Languages: reporting, Maintain

The FINDMEM function, available only on z/OS, determines if a specific member of a partitioned data set (PDS) exists. This function is used primarily in Dialogue Manager procedures.

To use this function, allocate the PDS to a ddname because the ddname is required in the function call. You can search multiple PDSs with one function call if they are concatenated to one ddname.


Top of page

x
Syntax: How to Find a Member of a Partitioned Data Set
FINDMEM(ddname, member, output)

where:

ddname

A8

Is the ddname to which the PDS is allocated. This value must be an eight-character literal enclosed in single quotation marks, or a variable that contains the ddname. If you supply a literal less than eight characters long, pad it with trailing spaces.

member

A8

Is the member for which you are searching. This value must be eight characters long. If you supply a literal that has less than eight characters, pad it with trailing spaces.

output

A1

Is the name of the field that contains the result, or the format of the output value enclosed in single quotation marks. The result is one of the following:

Y indicates the member exists in the PDS.

N indicates the member does not exist in the PDS.

E indicates an error occurred. Either the data set is not allocated to the ddname, or the data set allocated to the ddname is not a PDS (and may be a sequential file).



Example: Finding a Member of a Partitioned Data Set

FINDMEM searches for the EMPLOYEE Master File in the PDS allocated to ddname MASTER, and returns the result to the variable &FINDCODE. The result has the format A1:

-SET &FINDCODE = FINDMEM('MASTER  ', 'EMPLOYEE', 'A1');-IF &FINDCODE EQ 'N' GOTO NOMEM;
-IF &FINDCODE EQ 'E' GOTO NOPDS;
-TYPE MEMBER EXISTS, RETURN CODE = &FINDCODE
TABLE FILE EMPLOYEE
PRINT CURR_SAL BY LAST_NAME BY FIRST_NAME
WHERE RECORDLIMIT EQ 4;
END
-EXIT
-NOMEM
-TYPE EMPLOYEE NOT FOUND IN MASTER FILE PDS
-EXIT
-NOPDS
-TYPE ERROR OCCURRED IN SEARCH
-TYPE CHECK IF FILE IS A PDS ALLOCATED TO DDNAME MASTER
-EXIT

The output is:

LAST_NAME  
FIRST_NAME  
CURR_SAL
--------  
----------
--------
JONES
SMITH
STEVENS  
DIANE
MARY
RICHARD
ALFRED  
$18,480.00
$13,200.00
 $9,500.00
$11,000.00

WebFOCUS