Previous Topic: $DSCALL OPT=MOVEPACK

Next Topic: $DSCALL OPT=PRINT


$DSCALL OPT=OPEN

Opens a sequential data set or member of a PDS for input or output.

&CONTROL SHRVARS=($DS)
EXEC $DSCALL OPT=OPEN
             DD=DD_name
           [ ID=path_name ]
           [ MEMBER=member_name ]
           [ MODE= { INPUT | OUTPUT } ]

This call is used to open a data set or a member of a PDS in preparation for reading (specify MODE=INPUT) or writing (specify MODE=OUTPUT).

Operands:

OPT=OPEN

Specifies that an OPEN action be performed on a data set or member of a PDS.

DD=DD_name

Specifies the ddname of the data set to be opened. If the ddname represents a concatenated DD, the first data set in the concatenation is opened.

ID=path_name

Specifies the ID of a path to be opened for access to the data set. The use of a path ID lets a procedure access more than one file, with the unique path ID used to identify which file is being accessed. The path ID must be specified on subsequent requests such as READ, WRITE, and CLOSE.

If this operand is omitted, the ddname is used as the path ID. If a path with that name already exists, an error is indicated. The path ID is returned in the shared variable &$DSID.

MEMBER=member_name

Specifies the member name. To open a PDS that was not allocated with a member name, specify the member name in the call. If the allocation was to a member name, the member name specified in the MEMBER operand overrides it.

MODE={ INPUT | OUTPUT }

Specifies whether the data set is open for input or output.

Return Codes:

Note: For more information about &SYSMSG, &$DSRC, and &$DSFDBK, see Return Codes and Feedback Codes.

Return Variables:

&$DSID

Path ID

Example: OPT=OPEN

EXEC $DSCALL OPT=OPEN DD=SYSDD MODE=OUTPUT +
   MEMBER=TEST01

Note: If the original allocation was to a PDS or a member of a PDS, the member is opened. If the allocation was for a sequential data set, the data set is opened.