ISPF COMMANDS – FIND, COPY, CUT, PASTE, MOVE, CREATE, HILITE
FIND is usually used with the operands NEXT (the default), PREVIOUS, ALL, FIRST, or LAST. Special characters (e. g. the “*” or quotes) must be surrounded by quotes. Sometimes the string may be a keyword to the FIND command, in which case it needs to be quoted (for example, FIND ‘NEXT’ or FIND ‘FIRST’ ALL).
One FIND option many people are not familiar with is the picture string. Here is a list of the types of picture strings and their explanation:
= any character . invalid characters
@ alphabetic characters – non-numeric characters
# numeric characters < lower case alphabetics
$ special characters > upper case alphabetics
¬ non-blank characters
Picture strings are called using the letter P followed by the quoted character. For example, FIND P’.’.
Strings are located regardless of case. The following are the same:
- F TEXT
- FIND Text
- f teXt
If you need to find the exact match, including case, use the letter C as a prefix or suffix to the quoted string, e. g. F c’Text’.
Finds are restricted by columns or labels. For example, F JUNK .HERE .THERE finds the first occurrence of JUNK beginning at the label .HERE. If there is no such text between the labels, the message JUNK NOT FOUND is displayed, even if that text exists outside the labels. See the example on the next page.
If you get the “But I can see it, it’s right there!” feeling when doing a FIND, check the bounds to make sure Edit is actually looking everywhere.
In this example a left boundary is set at column 12 and a right boundary is set at column 60. The F DBD command with the default bounds would find the DBD in DBDLIB on line 3. Since FIND observes boundaries, the first one found is the DBD on line 4 (highlighted on the screen, in bold here).
Command ===> f DBD Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 /* REXX IMS Database DDname retriever */
=BNDS> < >
000003 Arg DBDLIB
000004 If DBDLIB = “” Then Do /* Assume DBD is gotten from IMS table */
000005 Address ISPEXEC “VGET (BDBDLIB) SHARED”
Other parameters FIND can use are CHARS, PREFIX, SUFFIX, and WORD. Using those, and assuming this line:
DO DONT ADO ADOPT ‘DO’ $ADO (DONT) ADO-
FIND DO CHARS finds all these words;
FIND DO PREFIX finds only DONT and (DONT);
FIND DO SUFFIX finds only ADO, $ADO, and ADO-;
FIND DO WORD finds only DO and ‘DO’.
FIND operands may be entered in any order; for example, FIND ALL X DOG and F DOG X ALL are the same.
Some examples of COPY/MOVE commands are below.
- COPY opens a screen to enter a member name or dataset to copy in;
- COPY JUNK copies in the member JUNK from the current PDS;
- MOVE JUNK copies the data from the member JUNK and deletes it;
- COPY MYJCL.EXTRACT AFTER .HERE locates the label .HERE and copies the entire contents of MYJCL.EXTRACT following that line;
- MOVE MYJCL.EXTRACT 1 6 BEFORE .ZF copies lines 1 through 6 of MYJCL.EXTRACT into the current edit session as the first six lines of the file, then deletes MYJCL.EXTRACT.
CUT AND PASTE:
Edit provides CUT and PASTE commands similar to the PC cut and paste commands. ISPF provides a default clipboard to hold data items cut. The syntax for CUT is essentially the same as that for CREATE; the syntax for PASTE is essentially the same as that for COPY.
The following operands apply to CUT:
- REPLACE replaces the contents of the clipboard;
- APPEND adds the cut text to the bottom of whatever is on the clipboard;
- DISPLAY shows what’s on the clipboard. Other operands are ignored.
The following operands apply to PASTE:
- DELETE clears the clipboard contents;
- KEEP keeps the clipboard as-is.
Use the EDITSET command to set up cut and paste.
CREATE: To create a member in the current PDS, type the member name. To create a new dataset, type the DSN after the CREATE command. Some examples:
- CREATE opens a screen to enter a member name or dataset to create;
- CREATE JUNK creates a member in the current PDS called JUNK;
- CREATE JUNK .ZF .ZL copies all lines into the member JUNK;
- CREATE MYJCL.EXTRACT creates a sequential file called <yourid>.MYJCL.EXTRACT;
- CREATE JUNK .HERE .THERE creates the member JUNK using only the data delimited by the two labels. The lines are not deleted.
- HILITE PAREN toggles the highlighting of mismatched parentheses;
- HILITE FIND toggles the highlighting of the FIND command;
- HILITE CURSOR toggles the highlighting of the current cursor word;
- HILITE SEARCH highlights the first unmatched END, ELSE, }, or ) between the first line of the dataset and the line the cursor is on. This is most useful when you’re on the last line of the dataset.