block Command

Manipulates a block of text.

Scope: File

Syntax

Parameters

If no parameters are supplied, a block mark is done. Only one block at a time can be marked.

copy
Copies the current block. The block definition moves to the copied block, and the current position is moved to be the start of the new (copied) block.

If a character string is being copied, the characters are copied before the current position. If a list of lines is being copied, the list is copied after the current line. If a rectangular block is being copied, the remainder of each line at and following the current position is moved to the right to make room for the block.

move
Deletes the block from its original position and places it into its new position.
before
The block is placed immediately before the current position.
after
The block is placed immediately after the current position.
clear 
Clears any currently set block. Use the clear parameter to cancel a block after the copy, fill, lower, move, shift, and upper parameters have been used.
mark
Marks using the selection types set by the blockdefaulttype parameter.
mark character 
Sets the beginning or end of a character block. On the first call, a single character is marked. On a second call, the block is extended to all characters between the initial and the current positions. On further calls, the block is extended if the current position is before or after the block; or, if the current position is inside the block, reduced to include characters between the original start and current position.
mark stream 
Sets the beginning or end of a stream block. It is similar to a character block except for the following differences:
  • It has a scope of view.
  • The selection is coupled with the cursor. If the cursor is moved the block selection will disappear.
  • The delete and backspace keys will cause a selection to be deleted.
  • A stream block can be replaced by text entered from the keyboard, played-back by the keystroke recorder, or pasted from the clipboard.
mark element 
Sets the beginning or end of a line block. On the first call, the current line is marked. On a second call, the block is extended to include the new current line. On further calls, the block is extended if the current line is outside the block; or, if the current line is inside the block, is reduced to include lines between the original start and current position.
mark group 
Marks the current subgroup of lines. The block is set up as for mark element, except that if the first mark is on a structure line, that mark sets a block that extends from the beginning of that line to the end of the next structure line at the same or lower level.
mark rectangle 
Sets the beginning or end of a rectangular block. On the first call, the current character is marked. On a second call, the block is extended to all characters in a On further calls, the block is extended or reduced. The presence of Tab characters will distort a rectangular block. Using this style of block with text containing tabs may produce unexpected results.
set character

set element
set group
set rectangle

set stream 
Performs the same operations as their respective mark functions with this exception: if the cursor is on the first or last character in the block on the third or subsequent calls, the whole block is cleared (unmarked).
mark word
set word 
Marks the current word. If a block is already set it is cleared first, then the whole word under the cursor is selected. If the cursor is not located at an alphanumeric character, a forward scan is done. If a word is not found before the end of the current element, a backward scan is carried out. If a word is still not found by the time start of the current element is reached an error code is returned. For all block operations, a word block is treated the same as either a character block or a stream block, depending on the setting of the blockdefaulttype parameter.
fill Character 
Fills the current block with the Character. Character can be a blank or any other single keyboard character, specified in any of the following forms:
nnn 
A decimal-based ASCII character code, where n is a digit of value 0 to 9, inclusive. For example, character code 065 = A.
xnn
xnnn 
A hexadecimal-based ASCII character code, where n is a digit of value 0 to 9, inclusive, or an alphabetic character of value A to F or a to f, inclusive. For example, character code x41 = A.
single character 
Any single keyboard character.

The fill character also fills a line block up to the end of the text line.

find 
Moves the current position to the start of the current block, which may be in another file.
find end 
Moves the current position to the end of the current block, which may be in another file.
lower 
Converts the block to lowercase.
upper 
Converts the block to uppercase.
overlay 
The current rectangular block is placed over the text at the current position. If you clear the block, the contents of the rectangle block are pasted at the current position.
shift left Number 

shift right Number 
Moves the current block a specified number of characters to the left or right. When the block is shifted to the right, it is padded with the pad character and no data is lost. When shifted to the left, the block's initial characters are removed. The shift parameter cannot be used with the character or word parameters. When applied to a rectangular block, shift moves the characters within the rectangle to the left or right, but does not move the block itself.
delete 
Deletes the block. If the current position is within the block, it is set to the first character after the block.

Examples

  1. To clear a marked block, type:
    block clear 
  2. To mark a rectangle, place the cursor at one corner of the rectangle and type:
    block mark rectangle 

    Then move the cursor to the opposite corner of the rectangle and type the same command again.

  3. To copy the current block to a specific position, mark the block, place the cursor where you want a copy of the block to be placed, and type:
    block copy 
  4. To place a copy of the current block below the existing one and then clear the block, type:
    block copy after clear 
  5. To move the current line block two characters to the right, type :
    block shift right 2 
  6. To overwrite the current block with plus ( + ) signs, type:
    block fill + 
  7. To find the start of the current block, type:
    block find 

    Use block find end to find the end of the current block.

  8. To move the current block to a specific position, mark the block, place the cursor where you want the block to be moved, and type:
    block move 

    The block is deleted from its original position and placed in the new position.

API Return Codes

-1
The parameter issued with the command was not valid. Check the command 's syntax requirements and then issue the command again using a valid parameter.
-2
A block was not set or marked before you tried a block move, block copy, block shift, block upper, block lower, block overlay, or block find command. Mark or set a block before performing one of these block operations.
-3 
You cannot move a line, character, or rectangular block into itself. Move the cursor outside the block and try again.
-5 
You cannot make changes to the file because the readonly parameter is set to on.
-6
Copying, moving, shifting the block, or converting the block to overlay would make the line too long. The block operation was canceled. See if there is a way to decrease the size of the block or the line that is being appended.

blockdoc Parameter
blockend Parameter
blocklength Parameter
blockstart Parameter
blocktype Parameter
blockdefaulttype Parameter
blockview Parameter