$Dsn

From m204wiki
Revision as of 19:12, 13 August 2013 by ELowell (talk | contribs)
Jump to navigation Jump to search

$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',%I) 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)