intersystems-cacheintersystems-ensemble

COS ZF Command return Service


In COS I would like to return all the service with a specific name. In command running the command sc queryex type= service state= all | find /i "BFE" and it will display the service name. In COS there is $ZF that can take in a command but it return 0 not sure what i am doing incorrect.

USER>s cmd = "sc queryex type= service state= all | find /i ""BFE"""

USER>W cmd
sc queryex type= service state= all | find /i "BFE"
USER>set rc=$zf(-2,cmd)

USER>W rc
0

Solution

  • I would also add that the $ZF(-1) and $ZF(-2) function is deprecated in the latest version. In the meantime, you can simply append >> resultfile.txt to arg and then review the file. I would however use $ZF(-1) rather than $ZF(-2), which runs the command as a child-process, asynchronously.