Previous Topic: $DSCALL OPT=VOLSPACE

Next Topic: MVS System Symbols Interface


$DSCALL OPT=WRITE

Writes one or more records to an open data set.

&CONTROL SHRVARS=($DS)
EXEC $DSCALL OPT=WRITE 
             DATA= { * | variable_name [ , variable_name,... ] | prefix*} 
           { DD=DD_name | ID=path_name } 
           [ COUNT= number ] 
           [ TRUNCATE= number ]

This call is used to write data contained in variables to a data set or member of a PDS. The procedure must have an open path to the data set or PDS member to write to it (use $DSCALL OPT=OPEN to open a path).

Operands:

OPT=WRITE

Specifies that a write action be performed.

DATA={ * | variable_name [ , variable_name,... ]| | prefix* }

Specifies the records to be written to the data set.

DD=DD_name

Specifies the ddname of the file to write to. This operand is used as the path ID if the ID operand is not specified.

ID=path_name

Specifies the Path ID of the file to write to.

Any combination of OPEN, FOPEN, CLOSE, FCLOSE, READ, and WRITE requests must be done in a single procedure.

COUNT=number

Specifies the number of records to be written to the data set. This is a required operand if DATA=* or DATA=prefix* is specified.

TRUNCATE=number

Specifies the length the written records will be truncated to. The maximum value of the TRUNCATE operand is 250.

Return Codes:

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

Example: OPT=WRITE

&$DSDATA1 = REC1 
&$DSDATA2 = REC2 
&$DSDATA3 = REC3 
&$DSDATA4 = REC4 
EXEC $DSCALL OPT=WRITE ID=SYSPATH COUNT=4 DATA=*