Colmove Command [COLM]

Qedit 5.7 for HP-UX

Home Previous Next


Colmove Command [COLM]

Moves one or more columns to a different location on the same line.

COLMOVE source [ /source2 ] destination1 [ /destination2 ] [ rangelist ]

(Q=no display, J=verify, T=CobX Tag)

(Default: rangelist = *)

Colmove moves text in columns specified by source1 and source2 to the destination columns specified by destination1 and destination2 in the lines of rangelist. The source columns are removed from their original location. Even though Colmove can modify multiple lines using a rangelist, it really operates on one line at a time.

You can not move columns from one line to another. Source and destination columns always represent the original location. All changes are based on that assumption.

If source1 only is specified, Qedit moves just that column (length of 1). If destination1 only is specified, the source columns are inserted 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. 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

If destination1 and destination2 are specified, text in these columns is replaced by the source text. If the source text is narrower or wider, the line is shortened or expanded as needed.

/colmove 1 10/15     { move column 1 to columns 10/15 }
   1     bcdefghiapqrstuvwxyz
1 line changed
/colmove 1/5 10/11   { move columns 1/5 to 10/11 }
   1     fghiabcdelmnopqrstuvwxyz
1 line changed
/colmove 1/5 10/20   { move columns 1/5 to 10/20 }
   1     fghiabcdeuvwxyz
1 line changed

Trailing Spaces

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 moved in the operation.

/list 2
   2     abcd     efghiabcdeuvwxyz
/colmove 1/8 20        { move columns 1/8 to 20 }
   1      efghiabcdeabcd    uvwxyz
1 line changed

Overlapping Columns

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 expected. 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, it's putting the original text back where it was.

Moving Passed the Right Margin

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 inserted in the rightmost columns of the line. The destination columns do not have to be a precise value. They just need to be 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

Approving Each Changed Line

Use COLMJ to give yourself approval over each change before it is updated. With COLMJ, Qedit displays the line as it would be and asks you for a Yes, No, or Modify answer.

CobX Tags

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, updated lines and added lines are automatically updated with the tag. They can also be modified manually with custom tag values.

In its regular form, the Colmove command affects only the text area in 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.

/ColmT 73/74 79/80 all        { copies content of columns 73 and 74 }
                            { into columns 79/80                  }
/ColmT 73/74 75 all        { inserts content of columns 73 and 74     }
                            { in column 75. Columns 76-80 are shifted. }

To to this, the Tag option temporarily changes the margins to (73/80). Qedit displays a warning every time this option is used. Because the margin values have changed, explicit column range in the source and destination columns can only be between 73 and 80.

/ColmoveT 23/24 79/80 all
Warning:  ColcopyT: editing the Cobol tag area only (73-80).
Error:  The Sourcestart column (23) is not between 73 and 80
/ColmoveT 73/74 79/80 10
Warning:  ColcopyT: editing the Cobol tag area only (73-80).
   10      ME0307ME
1  line changed

Because the margins have been changed, Qedit displays text in the tag area only except when the Justify option is used. In this case, Qedit prompts for confirmation before making the change. It would be hard to determine if a line needs to be changed based only on the tag value. So, when the Justify option is used, Qedit displays the complete line. The user has the option to accept the changes, reject the changes or manually modify the line. If the user chooses to modify the line, only the tag is displayed.


Home Previous Next