Question Josep Balagué · Jul 10, 2025

Using $ZF(-100) on Caché

Until now i used $ZF(-1), in older Caché versión, now I try to use $ZF(-100),  i do:  

REST>w $ZV
Cache for Windows (x86-64) 2018.1.4 (Build 505_1) Thu May 28 2020 10:12:49 EDT
REST>s a=$zf(-100,"/SHELL","dir")
 
S a=$ZF(-100,"/SHELL","dir")
^
<NOTOPEN>

What is wrong?

Thanks in advance

Product version: Caché 2018.1

Comments

DC AI Bot · Jul 10, 2025 Bot

The issue you're encountering with $ZF(-100) and the <NOTOPEN> error likely stems from the use of the "/SHELL" flag. For $ZF(-100) to execute commands with this flag, it may encounter file access issues or problems with setup for standard input/output redirection. Specifically, the <NOTOPEN> error can occur if:

  1. A file specified for input/output redirection cannot be created or opened.
  2. The command cannot be started as requested.

Ensure the following:

  • Verify that there are no issues with permissions or availability for any file or resource specified with /STDIN, /STDOUT, or /STDERR flags. These flags control input/output redirection [1].
  • When invoking the shell with /SHELL, ensure that the OS command's path is accessible, and there are no syntax errors in the options [1][2].
  • Avoid mixing syntax such as redirection operators >> with /STDOUT flags as they might create conflicts [3].

You can resolve this error by ensuring:

  1. Necessary permissions are granted to create or open files for redirection.
  2. The command and its arguments are validated properly without conflicting flags or operators.
  3. Avoid redundant configurations like using /STDOUT flags along with output redirection operators in the command.

For example, to execute a common Windows directory listing command with redirection, use:

set status = $ZF(-100, "/SHELL", "dir", "")
w !,"Status: ", status

Ensure you do not accidentally specify both /STDOUT redirection and shell redirection (>> inside the command). Adjust based on the exact use case and configuration [1][3].

Sources:

0
Colin Brough · Jul 10, 2025

Same command works fine for me, similar vintage of Ensemble. Must be something specific to your environment/machine, and what drives are available. You could try

set sc = $ZF(-100, "/SHELL","dir","C:\")

or some other drive you know to be present, and see whether that makes a difference.

0
Oliver Thompson · Jul 10, 2025

If this is just for a quick/dirty directory listing from terminal, you can also use !, exclamaiton mark, this runs the host OS terminal, you can then run any OS commands that you need to.
Once you are done, just type EXIT (On Windows) and you will be back to your IRIS terminal session.

0
Josep Balagué · Jul 19, 2025

Thanks a lot, it was a issue with privileges

0