$Dsn: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Mlarocca moved page $DSN to $Dsn: Lower case change)
m ($DSNNUM only takes one parameter, not two.)
Line 13: Line 13:
<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',%I) BY 1
<p class="code">FOR %I FROM 1 TO $DSNNUM('FU') BY 1
   PRINT $DSN('FU',%I)
   PRINT $DSN('FU',%I)
END FOR
END FOR

Revision as of 18:24, 4 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.

Examples

An example using $DSN follows:

FOR %I FROM 1 TO $DSNNUM('FU') BY 1 PRINT $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)