$Dsn: Difference between revisions
m ($DSNNUM only takes one parameter, not two.) |
m (44 bytes in z/OS anyway, I don't know about CMS or VSE...) |
||
Line 11: | Line 11: | ||
</ul> | </ul> | ||
<p>If no file or DD name is specified, if the data set number is too large, and if <var class="product">Model 204</var> cannot find the data set name, the system returns a counting error message.</p> | <p>If no file or DD name is specified, if the data set number is too large, and if <var class="product">Model 204</var> cannot find the data set name, the system returns a counting error message.</p> | ||
<p>The output string is right-filled with SPACEs to 44 bytes.</p> | |||
<b>Examples</b> | <b>Examples</b> | ||
<p>An example using $DSN follows:</p> | <p>An example using $DSN follows:</p> | ||
<p class="code">FOR %I FROM 1 TO $DSNNUM('FU') BY 1 | <p class="code">FOR %I FROM 1 TO $DSNNUM('FU') BY 1 | ||
PRINT $DSN('FU',%I) | PRINT %I AND $DSN('FU',%I) | ||
END FOR | END FOR | ||
</p> | </p> |
Revision as of 22:18, 5 June 2015
$DSN is useful with Model 204 files that are comprised of multiple data sets. You specify the Model 204 file's DD name and the ordinal number (first, second, third, and so on) of one of the file's data sets, and $DSN returns the data set's name.
The $DSN syntax is:
$DSN('ddname',dsnnum)
where:
- ddname is a Model 204 file's DD or file name. The file that you specify must be OPEN by you while you are using $DSN. This ensures reliable output.
- dsnnum is a positive integer that represents the ordinal number of a data set. For example, specify 3 for dsnnum if you want the name of the third of the multiple data sets that comprise the Model 204 file.
If no file or DD name is specified, if the data set number is too large, and if Model 204 cannot find the data set name, the system returns a counting error message.
The output string is right-filled with SPACEs to 44 bytes.
Examples
An example using $DSN follows:
FOR %I FROM 1 TO $DSNNUM('FU') BY 1 PRINT %I AND $DSN('FU',%I) END FOR
The next example does a straight $DSN call for a file mapped to one data set.
%FILENAME IS STRING LEN 8 %FILENAME = 'VEHICLES' PRINT 'FILE ' WITH %FILENAME WITH ' IS CONTAINED IN - DATASET ' WITH $DSN(%FILENAME,1)