info on qedit

Variable Substitution

When the new Varsub option is enabled (Set Varsub On), Qedit parses entered commands looking for variable names. If a variable name is found and currently exists, its value is substituted before the command is executed. If the variable does not exist, the variable name is left unchanged.

Qedit commands are added to the Redo stack before the substitution occurs i.e. with the variable name. So, if the variable value changes between the time the command is entered and the time it is retrieved from the stack, the results may be different. It's also important to note that commands related to Redo stack operations such as Listredo, Do, Before can not have trailing comments enclosed in curly braces anymore. The comments are not removed and likely cause a syntax error.

Warning: The trailing comments limitation is an incompatibility with older versions.

    /listredo  { see which commands I have entered so far }
    Bad option, expecting ;UNN ;ABS ;REL or ;OUT
    /listredo
         1) t testisql
         2) l "$myvar"
         3) s varsub on
         4) l "$myvar"
         5) setvar myvar "qed"
         6) l "$myvar"
         7) LISTREDO  { SEE WHICH COMMANDS I HAVE ENTERED SO FAR }

Substitution on HP-UX

Variable names are identified by a leading dollar sign "$". For example, $HOME is replaced with the current value of the HOME environment variable. Some Qedit commands such as List have an extensive series of $-options which, as their name implies, also start with a dollar sign. These options have precedence over environment variables. In other words, if a variable has the same name as a $-option, the substitution does not occur. The only workaround is to change the name of the variable to something that does not conflict.

If you wish to prevent variable substitution and have Qedit interpret the dollar sign at face value, insert a backslash immediately in front of it as in \$HOME.

The tilde is a special character with different meanings in Qedit. Among other things, it can be a string delimiter or a shortcut pointing to the most recent current line in full-screen mode. In HP-UX shells, it's also commonly used to designate the user's home directory.

Here's how Qedit handles the tilde character. If it's still part of the string delimiter list (Verify Stringdelimiter), it is used as such. If it's not part of the list and is entered by itself on a line, it's interpreted as the most recent current line of full-screen mode. If it's not part of the list, Set Varsub is enabled and is used anywhere else in a command, it's replaced with $HOME. The Varsub feature would then substitute the appropriate value. Set Varsub On automatically removes the tilde from the string delimiter list.

Substitution on MPE

Variable names are identified by a leading exclamation point "!". For example, !HPACCOUNT is replaced with the current value of the HPACCOUNT system variable. Since the exclamation point is normally a valid Qedit string delimiter (Verify Stringdelimiter), Set Varsub On automatically removes it from the string delimiter list.

If you wish to prevent variable substitution and have Qedit interpret the exclamation oint at face value, put 2 exclamation points as in !!HPACCOUNT.


Old Technique:

The old way to use variables on MPE/iX, was to prefix the Qedit command with a colon and a slash (:/). The colon tells Qedit to send the command to MPE, which knows how to dereference variables, then the slash tells Qedit that it is really a Qedit command, not a MPE command.

For example, to change the string {insert date here} to the value of the "mydate" variable in all lines,

run qedit.pub.robelle
text myfile
:/change "{insert date here}" "!mydate" all

....Back to the Qedit Q&A Page