logo
Powered by QM on a Rpi server

KnowledgeBase 00102: Simplifying Process Type Tests in LOGIN

Last updated: 22 Jul 2016
Applies to: All versions
Search  
Top level index       Full Index Search Tips
Previous article     Next article

This article was originally published as a Tip of the Week.

The Problem

The LOGIN paragraph, and perhaps other places, frequently needs to test the process type of the QM session. For example, a LOGIN paragraph may normally start the application but this would not be wanted in a session that was a QM phantom.

The simplest way to terminate the LOGIN paragraph for a phantom process is to include a line

   IF @TTY = 'phantom' THEN STOP 
before actions that are not required for this process. This can get very messy when several process types are to be included,


The IF IN Command

The IF IN command tests whether an item appears in a list of alternatives

   IF @TTY IN 'phantom', 'startup', 'vbsrvr' THEN STOP 
There is a corresponding IF NOT.IN to test whether an item is not in a list of alternatives.


Use of @-variables in Commands

The above examples show use of @TTY in the IF command. This is the only QM command in which @-variables are automatically expanded. All other commands treat the @-variable name as literal text.

A more generalised way to use @-variables that works in all commands is to use the inline prompt expansion. The example of using IF IN becomes

   IF <<@TTY>> IN 'phantom', 'startup', 'vbsrvr' THEN STOP 


Related Articles

00036: Inline Prompts

00058: Command Scripts



Please tell us if this article was helpful
Very     Slightly     Not at all
Comments
Email (optional)