11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

System and Other FunctionsDescriptionYou can use $ZUTIL(62,1) to check the syntax of a line of <strong>Caché</strong> <strong>ObjectScript</strong> code, specifiedas a quoted string. If code contains a syntax error, $ZUTIL(62,1) returns a string with thefollowing format:nn,,textornn,,textWhere nn is the character position number (counting from 0) that evoked the error, is a literal (returned in a terminal session, otherwise omitted), and text is an errormessage, such as “Invalid command”, “Invalid function name”, “Invalid expression”, “Invalidspecial variable”, or “Expected space”. $ZUTIL(62,1) returns the first syntax error detected;the line of code may contain additional syntax errors.If no syntax error exists, $ZUTIL(62,1) returns the null string.ExamplesIn following example, $ZUTIL(62,1) checks the syntax of a line of code and, finding nosyntax error, returns the null string:SET err=$ZUTIL(62,1," SET x=1 HANG 5")IF err="" { WRITE "syntax correct" }ELSE { WRITE err }QUITNote that leading blanks are ignored when checking syntax; you may include or omit leadingblanks.In following example, $ZUTIL(62,1) checks the syntax of a line of code and finds a syntaxerror (SET cannot use the '= operator).SET err=$ZUTIL(62,1," SET x'=1")IF err="" { WRITE "syntax correct" }ELSE { WRITE err }QUITIt returns: 9,,Error in SET command. Note that the apostrophe character is at position 9,counting from 0 (and including the four leading blanks).The following example tests several lines of program code, and returns a syntax error foreach:594 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!