$Dsn

From m204wiki
Revision as of 22:18, 5 June 2015 by Tbullock (talk | contribs) (44 bytes in z/OS anyway, I don't know about CMS or VSE...)
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.

The output string is right-filled with SPACEs 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)