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 FunctionsExamplesThe following example returns the canonical form pathname of the system manager's currentdirectory, the current namespace, and the current device. Note that on Windows systems,canonical forms are all lowercase:WRITE !,$ZUTIL(12) ; current mgr directoryWRITE !,$ZUTIL(12,"") ; current namespaceWRITE !,$ZUTIL(12,$IO) ; current deviceThe following example returns the canonical form of the pathname of the non-existent file“Fred”, and the invalid filename “Fr@d”:WRITE !,"flag O: ",$ZUTIL(12,"Fred",0),!,$ZUTIL(12,"Fr@d",0)WRITE !,"flag 1: ",$ZUTIL(12,"Fred",1),!,$ZUTIL(12,"Fr@d",1)WRITE !,"flag 2: ",$ZUTIL(12,"Fred",2),!,$ZUTIL(12,"Fr@d",2)WRITE !,"flag 3: ",$ZUTIL(12,"Fred",3),!,$ZUTIL(12,"Fr@d",3)Flag 0 returns a canonical form for “Fred” and “Fr@d” as file names. Flag 1 returns thecanonical form for “Fred” and “Fr@d” as directory names. Note that file name validation isnot performed. Flag 2 and Flag 3 return the null string because “Fred” does not exist.You can use indirection, as in this example:SET NEWNAM=$ZUTIL(12,@IDNAME)For more information, refer to Indirection in Using <strong>Caché</strong> <strong>ObjectScript</strong>.In the following UNIX example, if /us/bill/ is a valid name, then:WRITE $ZUTIL(12,"^^/us/bill//",2)returns and canonizes the reference, treating it the same as /us/bill/.If ttyp0 is a valid terminal device, but ttyp00 is not, the following statement returns a canonizedname:WRITE $ZUTIL(12,"/dev/ttyp0",3)returns: /dev/ttyp0However, the following statement does not:WRITE $ZUTIL(12,"/dev/ttyp00",3)This statement returns the null string.See Also• $ZSEARCH function574 <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!