info on qedit

Variable Substitution and Trailing Spaces

Qedit prerelease 5.4.11 has a number of enhancements and bug fixes. Probably the 2 most important enhancements are variable substitution and trailing spaces preservation.

Preserving Trailing Spaces

Up until now, Qedit was padding lines with spaces in fixed-length files (Set Keep Var Off) or removing trailing spaces in variable-length files (Set Keep Var On). However, users-specified trailing spaces in some HP-UX and POSIX files are significant and are not supposed to vary during the edit session. In order to fix this, Qedit 5.4.11 offers the TrailingSpaces feature. The new option is disabled by default on MPE and enabled (by default) on HP-UX.

Set Work Trailingspaces ON requests that Qedit preserves trailing spaces and makes them significant characters. The option also allows creation of odd-length lines. Once enabled, all workfiles created or opened from that point will have trailing spaces preserved. To check the current status, do:

    /Verify Work		{ Checks global setting }
    Set WOrk Jumbo ON Block 8 Labels OFF Temp ON Size 3200 Random ON
    Set WOrk TRailingspaces ON
    /Verify Keep		{ Checks current workfile }
    Set Keep Ascii OFF Cctl OFF COde 0 Lab 0 Num OFF Var ON Checktimestamp ON
    Set Keep COBfree ON NAme /home/user1/afile.txt
    Set Keep LF ON Saved modification timestamp 2003/04/30  13:23:17
    Trailing spaces preserved
The last line shows that trailing spaces are preserved in this workfile. If the option is disabled, that line reads Trailing spaces trimmed. Disabling the global setting with Set Work Trailing Off does not disable the option in the workfile. You have to clear the workfile after disabling it. The Trailingspaces setting is stored in the workfile so it's recognized when the file is opened in the future. These workfiles may contain data specific to Trailingspaces. This may cause unexpected behavior if opened with versions prior to 5.4.11. Because trailing spaces are now treated as significant characters, Keep files created from these workfiles may be different from Keep files created with an older version.

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.


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