REXX member selection

For PDS or PDSE data sets, you can determine whether a member should be copied or not copied, depending upon a condition being true within the member records. This conditional test is supplied to File Manager via a REXX procedure that includes at least one of the following RETURN strings:

RETURN PROCESS MEMBER
Indicates that the entire member is to be included in the copy. No more records in this member are passed to the REXX proc. The member is copied intact, subject to any specified template processing, which is performed before the user REXX proc is invoked.
RETURN DROP MEMBER
Indicates that the member is to be excluded from the copy. No more records in this member are processed. Processing continues with the next member.

When REXX member selection is in effect, records are read from an input member and then cached in memory until the decision is made whether the member is to be copied. Once the decision has been made, the entire member is either copied or dropped, depending upon the return string specified.

If the entire member is processed without encountering a DROP MEMBER or PROCESS MEMBER return string, the member is processed according to the specified default action.

If either of these strings is returned by the REXX processing when REXX member selection HAS NOT been specified, it is treated as if it was a RETURN with no argument strings, except that a warning message is issued. Subsequent records continue to be passed to the REXX proc. Similarly, if a DROP, STOP or STOP IMMEDIATE string is returned by the REXX processing when REXX member selection HAS been specified, it is treated as if it was a RETURN with no argument strings, except that a warning message is issued. Subsequent records continue to be passed to the REXX proc until a decision has been made on whether to DROP or PROCESS the member.

Other REXX statements that control the dropping or updating of records are not performed when REXX member selection is used. Any changes to the special File Manager-defined REXX variable OUTREC are ignored. However, REXX statements that do not involve updating or dropping records are performed. This may lead to some unexpected results. In general, if you need to copy members of a PDS conditionally based on the contents of the member, and also want to manipulate the contents of the member, try to execute this task as a two-step process using separate REXX procedures.

To specify conditional member processing:

  1. On the Copy Utility - Copy From panel, specify your data set name and other copy options.
  2. Select the REXX member selection option and specify the default action (P or D) in the adjacent field. If this field is left blank, P is assumed. P denotes process or copy the member, D specifies drop or do not copy the member.
  3. Select the Use proc option and specify an existing REXX procedure or enter an * in the field to create a new REXX procedure. This procedure must contain a conditional test and at least one of the relevant RETURN strings.
  4. Complete the copying process as required.