| Front Page | News Headlines | Technical Headlines | Planning Features | Advanced Search |

March 2004

Get the most out of your Robelle Tools

More Improvements to Qedit

By Bob Green and François Desrochers

We have made many exciting enhancements to host-based Qedit in the last few months. Here are three:

• Variable substitution on both HP-UX and MPE/iX
• Preservation of trailing spaces on both systems
• Merging lines horizontally on both systems

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.

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 point at face value, put 2 exclamation points as in !!HPACCOUNT.

Variable Substitution and Redo

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, and Before cannot 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 {view my command history}
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 {view my command history}

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.

Merging Lines Horizontally

Qedit’s Merge command brings two versions of the same file together. It tries to match lines in the current workfile with lines from the merged file based on the line numbers.

By default, if a line number exists in both files, the line from the merged file is copied into the current workfile, replacing the existing line. Extra lines in the merged file (line number does not exist in the current workfile) are inserted at appropriate locations.

In Qedit version 5.4.12, the new Justified option appends the corresponding line from the merged file instead of replacing it. Text is appended immediately after the last non-blank character if Set Work Trailingspaces is disabled. If Trailingspaces is enabled, text is appended immediately after the last significant trailing space.
Let’s say the current workfile contains:

abc
def
ghj

and the external file contains:

1111
2222
3333

A MergeJ would result in:

abc1111
def2222
ghj3333

If the resulting merged line is too long for the current length, the merged line is truncated. To make sure you get everything from the merged file, you may have to change the Language (Set Language) and the line length (Set Length).

If we use the two files above and set the maximum length to 5, the resulting file would be:

/mergej mynum
1 11111
Warning: Result line will be too long. Truncating merged text.
2 22222
Warning: Result line will be too long. Truncating merged text.
3 33333
Warning: Result line will be too long. Truncating merged text.
3 lines merged
/l all
1 abc11
2 def22
3 ghj33


Copyright The 3000 NewsWire. All rights reserved.