Typing over top and bottom lines of selected text

In an SDSF on z/OS screen you can type line commands in a special area to the left of your data. Typically //p in the first line you want and // in the last line you want to purge each line’s content. (These are batch jobs.)

This is an x (actually x3270) window.

I would like to swipe select a 2 column by n lines and type //p in the top line and // in the bottom line of the selection. I’d do this on a hot key trigger.

Any thoughts on how I might implement this?

The question of detecting line ends is already solved - cutting and pasting into Sublime Text proves the line end characters are preserved.

By the way this arrangement of a range of command areas in successive lines is quite common on the mainframe; It’s a perfectly fine paradigm.

By “swipe”, do you mean select and copy?
If so, please provide us with the following:

  1. Real-world example of the text copied to the clipboard
  2. Example of exactly what you would like the final product (text) to be.

It is likely that this can be done using RegEx.

Actually I mean “select and hot key” with the hot key triggering a KM macro.

So no text to be copied to the clipboard and the contents of the selected area are unimportant.

The first line would have the characters “//p” typed in by the macro and “//” similarly in the last line.




would be a four line example.

(In SDSF the first line for a group action has // before the action character, in this case p. The last line just has // in it. All the lines between these two have the p action (“purge” in this case) applied.)

It saves time when purging multiple jobs from the SPOOL - by not having to type p against all of them.

The idea was to swipe select and invoke a KM macro - which saves even more time.

OK, here's an example Macro that might do what you want.
I used BBEdit for testing it, and it seems to work fine.

###BBEdit Text Before Macro
Note that I selected the lines starting at the start of the first line, then down and to the left of the last line. In this case, "line 1" through "line 4"

###BBEdit Text After Macro

###MACRO:   Replace First and Last LInes of Selected Text

~~~ VER: 1.0    2017-06-25 ~~~

Replace First and Last LInes of Selected Text.kmmacros (3.5 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


This macro uses UI controls to move the cursor. The controls (keystrokes) used are standard macOS controls, but may not work in all apps.

How to Use:

  1. Select the text from beginning of first line to end of last line.
  2. Trigger this macro
  • I do not see any way to both select the text and trigger at the same time.

Another method of achieving this result is to cycle through all lines copied to the clipboard, but using the new text for the first and last lines.