Table lock errors might occur with the hash package in PROC DS2


Error messages like the following can be generated when a PROC DS2 program contains the hash package inside a threaded program:

ERROR: BASE driver, Table TMP_LOOKUP is already in use and cannot be locked.  
If you opened the file with LOCKTABLE=EXCLUSIVE, try the LOCKTABLE=SHARE option
ERROR: BASE driver, Table LIB.HASH does not exist or cannot be accessed or created
ERROR: Table "LIB.HASH" does not exist or cannot be accessed
ERROR: Unable to prepare statement for hash data source lib.hash.
ERROR: Error reported by DS2 package d2hash:
ERROR: Hash data source load failed.
ERROR: Fatal run-time error.


There is not a way in the hash "dataset" parameter to specify the LOCKTABLE=SHARE option. You need to use a connection string to explicitly set the option, and then all table access for that schema will be shared. Here is an example:

proc ds2 conn='DRIVER=BASE;CATALOG=BASE;schema=(name=BASE;primarypath="c:");locktable=share;' nolibs;