$Dsn: Difference between revisions
m (44 bytes in z/OS anyway, I don't know about CMS or VSE...) |
m (misc cleanup) |
||
Line 1: | Line 1: | ||
<p>$ | <p> | ||
<p>The $ | <var>$Dsn</var> is useful with <var class="product">Model 204</var> files that are comprised of multiple data sets. You specify the <var class="product">Model 204</var> file's DD name and the ordinal number (first, second, third, and so on) of one of the file's data sets, and <var>$Dsn</var> returns the data set's name. </p> | ||
<p> | |||
The <var>$Dsn</var> syntax is:</p> | |||
<p class="syntax">$DSN('<span class="term">ddname</span>',<span class="term">dsnnum</span>) | <p class="syntax">$DSN('<span class="term">ddname</span>',<span class="term">dsnnum</span>) | ||
</p> | </p> | ||
<p> | <p> | ||
Where:</p> | |||
<ul> | <ul> | ||
<li><var class="term">ddname</var> is a <var class="product">Model 204</var> file's DD or file name. The file that you specify must be | <li><var class="term">ddname</var> is a <var class="product">Model 204</var> file's DD or file name. The file that you specify must be opened by you while you are using <var>$Dsn</var>. This ensures reliable output.</li> | ||
<li><var class="term">dsnnum</var> is a positive integer that represents the ordinal number of a data set. For example, specify 3 for <var class="term">dsnnum</var> if you want the name of the third of the multiple data sets that comprise the <var class="product">Model 204</var> file.</li> | <li><var class="term">dsnnum</var> is a positive integer that represents the ordinal number of a data set. For example, specify 3 for <var class="term">dsnnum</var> if you want the name of the third of the multiple data sets that comprise the <var class="product">Model 204</var> file.</li> | ||
</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> | ||
<p>The output string is right | 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> | |||
<p>An example using $ | The output string is padded on the right with blanks to 44 bytes.</p> | ||
<p class="code"> | |||
==Examples== | |||
<p> | |||
An example using <var>$Dsn</var> follows:</p> | |||
<p class="code">for %i from 1 to $dsnnum('FU') by 1 | |||
print %i and $dsn('FU', %i) | |||
end for | |||
</p> | </p> | ||
<p>The next example does a straight $ | <p> | ||
<p class="code">% | The next example does a straight <var>$Dsn</var> call for a file mapped to one data set:</p> | ||
% | <p class="code">%filename is string len 8 | ||
%filename= 'VEHICLES' | |||
print 'FILE ' with %filename with ' is contained in - | |||
dataset' with $dsn(%filename,1) | |||
</p> | </p> | ||
[[Category:SOUL $functions]] | [[Category:SOUL $functions]] |
Latest revision as of 15:40, 8 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 opened 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 padded on the right with blanks 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)