$Dsn: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m ($DSNNUM only takes one parameter, not two.)
m (misc cleanup)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<p>$DSN is useful with <var class="product">Model&nbsp;204</var> files that are comprised of multiple data sets. You specify the <var class="product">Model&nbsp;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 $DSN returns the data set's name. </p>
<p>
<p>The $DSN syntax is:</p>
<var>$Dsn</var> is useful with <var class="product">Model&nbsp;204</var> files that are comprised of multiple data sets. You specify the <var class="product">Model&nbsp;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>where:</p>
<p>
Where:</p>
<ul>
<ul>
<li><var class="term">ddname</var> is a <var class="product">Model&nbsp;204</var> 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.</li>
<li><var class="term">ddname</var> is a <var class="product">Model&nbsp;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>
 
<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&nbsp;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&nbsp;204</var> file.</li>
</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&nbsp;204</var> cannot find the data set name, the system returns a counting error message.</p>
<p>
<b>Examples</b>
If no file or DD name is specified, if the data set number is too large, and if <var class="product">Model&nbsp;204</var> cannot find the data set name, the system returns a counting error message.</p>
<p>An example using $DSN follows:</p>
<p>
<p class="code">FOR %I FROM 1 TO $DSNNUM('FU') BY 1
The output string is padded on the right with blanks to 44 bytes.</p>
   PRINT $DSN('FU',%I)
 
END FOR
==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 $DSN call for a file mapped to one data set.</p>
<p>
<p class="code">%FILENAME IS STRING LEN 8
The next example does a straight <var>$Dsn</var> call for a file mapped to one data set:</p>
%FILENAME = 'VEHICLES'
<p class="code">%filename is string len 8
PRINT 'FILE ' WITH %FILENAME WITH ' IS CONTAINED IN -
%filename= 'VEHICLES'
DATASET ' WITH $DSN(%FILENAME,1)
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)