Strovent SystemsSign in
Reference

Paste text into a 3270 screen without breaking the columns

A 3270 paste is typed into input fields, not dropped in as text. Line ends, protected areas, wrap and ISPF sequence columns decide where each character lands.

On a PC, a paste drops text into a file. On a 3270 screen, the emulator types the pasted characters into the screen, one position at a time, from where the cursor is. The screen is made of fields, and only unprotected fields take input. That is why a block of code can come out with its columns shifted, lines joined, or the paste stopped halfway. How fields work: Fields and attributes.

What decides where each character goes

The starting column. The first character lands at the cursor. Put the cursor where the first line of the block should start, for example the first data column of an ISPF Edit line, not the line-command area on the left.

Line ends. A line end in the pasted text moves the cursor down to the next line. Emulators differ in where it goes on that line. In x3270, with marginedPaste on, the cursor goes to the column where the paste started, so a block keeps its left edge. overlayPaste (below) turns this on as well. With both off, the cursor goes to the start of the next line, and every line after the first can land in the wrong column.

Protected areas. Line numbers, labels and other output on the screen are protected. x3270's overlayPaste setting decides what happens when the paste reaches one. When it is on (the default since x3270 4.1alpha7), characters that would land in a read-only area are dropped and the cursor keeps moving right. When it is off, the paste stops with an error. Either way, the text on that row does not arrive in full.

Long lines. A line longer than the input field runs on into the next position on the screen, which may be the next row. After that, everything is out of step.

Insert mode. With insert on, pasted characters push existing text to the right, and the field can overflow and lock the keyboard. Pasting over blank lines with insert off is the predictable case. See ISPF Edit typing overwrites text: Insert key, NULLS ON and full lines.

Pasting a block into ISPF Edit

  1. Make room first. In the line-command area of the line before the place you want, type I and a number, for example I20, and press Enter. ISPF inserts that many empty lines.
  2. Put the cursor in the first data column of the first new line.
  3. Paste. Then press Enter. Inserted lines you left empty are removed when you press Enter, so you do not need to delete the spares.
  4. Check the right-hand edge. In a data set with fixed-length 80-byte records, the standard sequence field is the last 8 columns, 73 to 80. Text that runs past column 72 lands there. With NUMBER ON, ISPF uses that field for line numbers, so keep pasted lines to 72 characters or turn numbering off first.

Replace tab characters with spaces before you copy, so that every column in the block is a real character.

When not to paste

For more than a screen or two, or for anything where every byte matters, transfer the file instead. A paste only covers what fits on the screen, and every line has to land in the right place. A file transfer moves the whole file. See IND$FILE file transfer and SFTP and scp to z/OS: EBCDIC text conversion and data sets.

Sources

Spotted a mistake? Email [email protected].