$Dsn

From m204wiki
(Redirected from $DSN)
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 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)