Question
· Jan 19

Is there a meaningful difference between zwrite and $SYSTEM.Status.DisplayError() for handling %Status values?

I'm wondering what the best practice is for handling %Status values within the terminal.
1. set tSC=...
    do $SYSTEM.Status.DisplayError(tSC)
 
2. set tSC=...
   zwrite tSC

3. An alternative?

Is there a meaningful difference between the two? Should one be used over the other for any reason? Should something else be used?

Discussion (2)2
Log in or sign up to continue

@Joseph Griffen 
ZWrite is going to output the internal format of the %Status value, which isn't that easy to parse visually. $SYSTEM.Status.DisplayError() will output the status text to the current device in a more readable format.

USER>Write ##class(%Atelier.v1.Utils.General).ValidateDocName("project.prj",.sc)
0
USER>ZWrite sc
sc="0 "_$lb($lb(16006,"project.prj",,,,,,,,$lb(,"USER",$lb("e^ValidateDocName+33^%apiSRC^2","e^ValidateDocName+1^%Atelier.v1.Utils.General.1^1","e^^^0"))))/* ERROR #16006: Document 'project.prj' name is invalid [ValidateDocName+33^%apiSRC:USER] */

USER>Do $SYSTEM.Status.DisplayError(sc)

ERROR #16006: Document 'project.prj' name is invalid [ValidateDocName+33^%apiSRC:USER]

If you need to store the status text in a variable you can use $SYSTEM.Status.GetErrorText().