2.22 CI commands 102

This is an edited collection of postings from HP's Jeff Vance that were prompted by the following questions:

Q1: From the documentation for the CI ESCAPE command: ":ESCAPE allows you to propagate error codes up to the next :CONTINUE 'marker'". What does this mean?

Q2: Our group uses some command files peppered with :CONTINUEs. I searched the LaserROM in vain for information on how to use HPAUTOCONT and HPCONTINUE instead. What is the difference between the two?

Q3: Is there a way to suppress the display of "the road not taken" messages in IF ... THEN ... ELSE ... ENDIF dialogues? They make interpreting STDLISTs very difficult. I've gotten all sorts of calls (usually on weekends and especially on holidays) from people who misread the $STDLIST and assume something disastrous has occurred.

 

The ESCAPE command causes the CI to execute its error handling code as if a real error occurred. This means that the CI will execute the command following the command protected by an active :CONTINUE. If no :CONTINUE is active, the CI will terminate the job and prompt a session. An "active" :CONTINUE means that a :CONTINUE was just executed or a :CONTINUE command is protecting a script; e.g.,

:CONTINUE

:xeq script

ESCAPE is probably most interesting when used in a script, although it is also useful for terminating jobs in an error state:

"REMAINDER OF JOB FLUSHED".

ESCAPE differs from the RETURN command in two ways:

- RETURN only exits back one level, whereas ESCAPE can exit out of nested scripts; and,

- RETURN (currently) does not return a value, but ESCAPE can set the CIERROR and HPCIERR CI variables.

file1:

------

cmd1

continue

cmd2 ---> cmd2:

-----

cmd2a

cmd2b

escape 999

cmd3

In this example, file1 executes script "cmd2". If any command in "cmd2" fails, execution resumes back in "file1" at "cmd3". This is also true if "cmd2" invokes the ESCAPE command, as shown. If "file1" did not have the CONTINUE active then the ESCAPE in "cmd2" acts just like any other error: it terminates the job or re-issues the prompt for a session. This example also sets HPCIERR and CIERROR to 999, which "cmd3" could test.

HPCONTINUE is a read-only Boolean variable that indicates if a CONTINUE is "active" for the next CI command. HPCONTINUE is a pretty useless variable and I probably should have deleted it long ago. Useless because it is only TRUE if the previously executed command was :CONTINUE or if HPAUTOCONT is true. In a script, HPCONTINUE cannot detect that the entire script may be "protected" by a :CONTINUE, it only knows if :CONTINUE was last command executed.

HPAUTOCONT is a read/write Boolean variable initially set to false. When set to true, HPAUTOCONT causes the CI to act as if every command executed in a job or script is preceded by a :CONTINUE command. Since HPAUTOCONT is a job/session variable, its value is persistent across all processes and scripts in your job or session. If you set it to true and forget to reset it then all of your subsequent scripts will have auto-continue set. I personally prefer to not use HPAUTOCONT. I use explicit :CONTINUEs only on the commands that I expect may return errors.

I have made an enhancement to the HPMSGFENCE variable that is in release 6.0 of MPE/iX. I've split up HPMSGFENCE into 3 bit fields where each field acts like a message "fence". Here are the bits:

bits 29..31 - controls CI error/warn msgs, like today:

0 = show all CI error and warn messages

1 = show only CI error messages (suppress warnings)

2 = suppress CI error and warn messages.

bits 26..28 - (new) controls echoing of "skipped" commands and

the "*** RESUME EXECUTION..." or "*** COMMANDS SKIPPED

UNTIL..." messages:

0 = show all skipped commands and show the above "***" msgs

1 = don't echo skipped commands, but show the "***" msgs

2 = don't echo skipped commands nor the "***" msgs

bits 0..25 - reserved (enforced).

This gives the following HPMSGFENCE values:

0 - show "***" msgs, skipped cmds, CI warns, CI error msgs

1 - show "***" msgs, skipped cmds, CI error msgs, no warns

2 - show "***" msgs, skipped cmds, no errors/warns

8 - show "***" msgs, no skipped cmds. show CI warns/errors

9 - show "***" msgs, no skipped cmds, show CI errors, no warns

10 - show "***" msgs, no skipped cmds, no errors/warns

16 - no "***" msgs, no skipped cmds, show CI errors/warns

17 - no "***" msgs, no skipped cmds, no warns, show errors

18 - no "***" msgs, no skipped cmds, no warns, no errors

Any other values for HPMSGFENCE are an error.

It is backward compatible. HPCMDTRACE overrides HPMSGFENCE command echo suppression.

HPMSGFENCE overrides OPTION LIST. OPTION NOLIST works as always.