Possible ODS "File in use" Error when writing to non-SMS managed PDSE


When using SAS Output Delivery System (ODS) and writing to a non-SMS managed PDSE, it is possible to receive error messages similar to the following:

ERROR: File is in use, MYODS.HTML(PAGE)
ERROR: File is in use, MYODS.HTML(FRAME)

This is caused when allocating the PDSE as DISP=OLD or DISP=SHR and not specifying DSNTYPE=LIBRARY.

The solution is to either use SMS Managed PDSE's or specify DSNTYPE=LIBRARY on the Filename statement.

Following is sample code which illustrates the problem:

Filename HTMLOUT '.MYODS.HTML'
   DSNTYPE=LIBRARY DISP=(NEW)DSORG=PO
   SPACE=(TRK,(10,1)) STORCLAS=nonsms;
/* use appropriate Non-SMS STORCLAS= for your site */
Filename HTMLOUT clear;
Filename HTMLOUT '.MYODS.HTML' DISP=OLD;
ODS HTML Path=HTMLOUT (URL=NONE)
   Body='BODY' (URL='BODY.HTML')
   Contents='CONTENTS' (URL='CONTENTS.HTML')
   Frame='FRAME' (URL='FRAME.HTML')
   Page='PAGE' (URL='PAGE.HTML')
   Trantab=ASCII;
Proc PRINT DATA=SASHELP.CLASS;
Run;
ODS HTML Close;
Filename HTMLOUT Clear;