September
2003
Get the most out of
your Robelle Tools
New Column Handling in Qedit
By François
Desrochers
Recently, we
received a number of questions related to column operations in Qedit.
Some people used QUAD (a contributed library editor) on the HP 3000
and were transitioning to an HP 9000. They found themselves without
their favorite editor as QUAD is not available on HP-UX. They turned
to Qedit but quickly discovered that Qedit missed some QUAD features.
More specifically, they were looking for an easy way to copy or move
columns on a single line.
Although this could
be done with Qedit command files, this solution had limitations. We,
at Robelle, decided to provide the functionality as Qedit native
commands. Thats how the Colcopy and Colmove commands came to
be. Since people were already familiar with QUADs operation, we
decided to match its implementation as closely as possible.
Copy Columns
The syntax for the
Colcopy command is COLCOPY source [ /source2 ] destination1 [
/destination2 ] [ rangelist ]
The Colcopy command
copies text in columns specified by source1 and source2 to the
destination columns specified by destination1 and destination2 in the
lines of rangelist. Even though Colcopy can modify multiple lines
using a rangelist, it really operates on one line at a time. The
default rangelist is the current line. You cannot copy columns from
one line to another, although you can accomplish this with Set Left
and Right with the Hold file.
Source and
destination columns always represent the original location. All
changes are based on that assumption.
If you only specify
source1, Qedit copies just that column (length of 1). If you only
specify destination1, Qedit inserts the source columns at that
location. If you wish to replace a single column, enter a destination
range where destination1 and destination2 are the same, e.g., COLCOPY
1 10/10.
/list 1
1
abcdefghijklmnopqrstuvwxyz
/colcopy 1 10
{ insert column 1 at column 10 }
1
abcdefghiajklmnopqrstuvwxyz
1 line changed
/colcopy 1/5 10
{ insert columns 1/5 at column 10 }
1
abcdefghiabcdejklmnopqrstuvwxyz
1 line changed
If you
specify both destination1 and destination2, Qedit replaces the text
in these columns with the source text. If the source text is narrower
or wider, Qedit shortens or expands the line, as needed.
/colcopy 1 10/15
{ copy column 1 to columns 10/15 }
1
abcdefghiapqrstuvwxyz
1 line changed
/colcopy 1/5 10/11
{ copy columns 1/5 to 10/11. Line expands. }
1
abcdefghiabcdelmnopqrstuvwxyz
1 line changed
/colcopy 1/5 10/20
{ copy columns 1/5 to 10/20. Line shortens. }
1
abcdefghiabcdeuvwxyz
1 line changed
Trailing
spaces on the line are not significant. This means that a line can
expand until a non-space character reaches the current right margin
(Set Right). However, trailing spaces from the source text are
significant and are copied in the operation. If the line cannot be
expanded further, Qedit displays a warning message and allows the
user to modify it.
/list 2
2 abcd
efghiabcdeuvwxyz
/colcopy 1/8 20
{ insert columns 1/8 at 20 }
1 abcd
efghiabcdeabcd uvwxyz
1 line changed
/Set right 30
/colcopy 1/5 30
{ insert columns 1/5 at 30 }
Warning: Source columns could not be
inserted.
Please modify. (Warning 2)
1 abcd
efghiabcdeabcd uvwxyz
1 line modified
When source
and destination columns do not overlap, the results are
straightforward. If source and destination columns overlap partially
or completely, the results might not be as you expect. Keep in mind
that:
Source and
destination columns are always based on the original line
The
destination columns are removed
The
source columns are put in their place
Use the COLJ command
to give yourself approval over each change before it is updated.
With COLJ, Qedit displays the line as it would be and asks you for a
Yes, No, or Modify answer.
COBOL tags are short
strings stored in columns 73 to 80 of CobX source files. The COBOL
tag value is defined using the Set X command. Once enabled, Qedit
automatically updates the tag as lines are updated and added. The
tags can also be modified manually with custom tag values.
In its
regular form, the Colcopy command affects only the text area in COBOL
columns 7 to 72. If you wish to make changes to Cobol tags, use the T
suffix. You can think of it as the Tag option. This option operates
only on the tag area itself, columns 73 to 80.
/ColT 73/74 79/80 all
{ copies content of columns 73/74 }
{ into columns 79/80
/ColT 73/74 75 all
{ inserts content of columns 73/74}
{ in column 75. Shifts columns 76/80}
By default,
Colcopy displays the lines as they are modified. If you dont
want to the changes, use the Q suffix.
Move Columns
The syntax for the
Colmove command is COLMOVE source [ /source2 ] destination1 [
/destination2 ] [ rangelist ]
The Colmove command
shares Colcopys syntax. It moves text in columns specified by
source1 and source2 to the destination columns specified by
destination1 and destination2 in the lines of rangelist. But it also
removes the source columns from their original location.
A move means the
original columns are removed and the line is shifted left. Then the
source text is inserted at the destination.
/list 1
1
abcdefghijklmnopqrstuvwxyz
/colmove 1 10
{ move column 1 to column 10 }
1
bcdefghiajklmnopqrstuvwxyz
1 line changed
/colmove 1/5 10
{ move columns 1/5 to column 10 }
1
fghiabcdejklmnopqrstuvwxyz
1 line changed
When source
and destination columns do not overlap, the results are
straightforward. If source and destination columns overlap partially
or completely, the results might not be as you expect. Keep in mind
that:
Source and
destination columns are always based on the original line
The
source columns are removed
The
destination columns are removed
The
source columns are put in their place
Here is an example:
/list 1
1
abcdefghijklmnopqrstuvwxyz
/colm 6/20 15
1
abcdefghijklmnopqrstuvwxyz
1 line changed
Apparently,
nothing has changed but, in fact, something did happen to the line.
Qedit removed the source columns fghijklmnopqrst and
tried to insert the original text where column 15 used to be. Column
15 was part of the area that has been removed, so Qedit inserts the
text where it should have been i.e., between e and
u. So, its putting the original text back where it
was.
The specified destination
columns can exceed the current right margin. In this case, Qedit
assumes the columns should be moved to the end of the line.
Effectively, the source columns are right-justified at the right
margin of the line (see example below). The destination columns do
not have a precise value, as long as they are larger than the current
right margin. If the right margin is currently set at 80, the
following commands yield the same results.
/v right
Set Right 50
/lt2
....+....10...+....20...+....30...+....40...+....5
2
abcdefghijklmnopqrstuvwxyz
/colm 1/5 51
2
fghijklmnopqrstuvwxyz abcde
1 line changed
/colm 1/5 88/90
2
fghijklmnopqrstuvwxyz abcde
1 line changed
This feature
was added to Qedit for MPE and HP-UX in August 2003 (version 5.4.10).
Users on current support can download the new versions (email
support@robelle.com).
Copyright The
3000 NewsWire. All rights reserved.
|