Use of OPEN is discouraged

objectscriptQuality release 
1.0.0
Id 
OS0030
Rule type 
Code Smell
Severity 

Critical

Critical
SQALE characteristic 
  • Security
    • API abuse
Tags 
confusing, deprecation
Remediation function 
Constant/issue
Remediation cost 
1d

The OPEN command has a very complicated syntax which is difficult to get right.

It is preferable to use classes from the %IO package instead which are much easier to use and provide the same functionality.

For instance, for opening a file, instead of using:

    OPEN "myfile"

prefer using:

    #dim f as %IO.FileStream
    #dim status as %Status
    set f = ##class(%IO.FileStream).%New()
    do f.open("myfile",,,,.status)
    // check $$$ISOK(status)