ISPF is a panel-driven interface that is commonly used by z/OS programmers and operators. Included in ISPF is an editor that has many features, but can be difficult for a novice to use.
Since editing text is so important, we have set up several challenges for you in the ISPF editor. There are many times you will need the ability to edit text effectively: editing source code, altering data, generating documentation, etc. and we wanted to show you some nifty tricks in the ISPF editor.
You can type in multiple commands at once, and then press Enter. Pressing Enter results in the execution of all typed primary and line commands simultaneously.
Successful completion of the challenge will create member #02 in P2.OUTPUT
Enter E to edit the CC#####.SEQ data set and follow the instructions below to complete this challenge.
See the "EDIT" in the top-left corner? This indicates that the data set is opened in edit mode. Any changes that are made to the data set will be saved upon normal exit. Observe the line numbers to the left under 'Command ===>'. A combination of primary and line commands can be typed on the screen, and pressing enter will execute the typed commands.
- First, tell the editor to delete the first seven lines of text. To do this, we'll
use the line command "D", followed by the number of lines we want to delete.
Type D7 in the first line command area.
- Next, let's select a block of lines to move with the line command "MM". MM is a
block command, so you have to type it twice: once on the first line to move, and again
on the last line. We want to move the lines 8 through 29 to the bottom.
Type MM in both line 8 and line 29 command areas.
- Finally, tell the editor that you'd like to jump to the bottom of the data set with
the primary command "BOTTOM".
Enter BOTTOM in the primary command field.
You'll notice that the editor informs you that a "MOVE/COPY is pending" in the top-right corner. This is because you have not indicated yet where to move the block. Additionally, delete command is still pending as well, because all commands that are entered at once must complete together.
- Indicate to the editor where to move the block with the "A" command. "A" is used
in a line command area to mean "After this line".
Type A in the line 83 command area.
- Jump back to the top with the primary command "TOP".
Enter TOP in the primary command line area.
As a result of the above, 7 lines were deleted, a block of lines were moved to the bottom, and the top of the data set is now displayed.
Next, you'll investigate the ISPF editor profile.
- Use the primary command "RESET" to renumber the lines and remove any informational
messages from the editor.
Enter RESET in the primary command line area.
- Next, display the ISPF editor profile with the "PROFILE" primary command.
Enter PROFILE in the primary command line area.
The ISPF editor has several profile options that can be changed as desired. Pressing F1 will display the editor tutorial with additional information on the various profile settings. F3 will exit the tutorial and return to the editor.
- Remove the =PROF> informational messages with the "RESET" command.
Enter RESET in the primary command line area.
Take a moment to observe the following:
- line 4 is lower case alphabetic
- line 9 is UPPER case alphabetic
- line 14 contains the decimal numbers 1234567890
- line 19 contains the hexadecimal numbers 0 to F
- line 24 contains special characters
Extended Binary Coded Decimal Interchange Code "EBCDIC" is an eight-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. Similar to ASCII, EBCDIC has been in use for many decades.
Notice anything weird starting on line 27? While the IBM mainframe stores data by default in EBCDIC, often times data will get stored in ASCII format. ASCII stands for American Standard Code for Information Interchange.
Everything inside a computer is eventually stored as bits (1 or 0), so an ASCII and EBCDIC are codes that map a numerical 8 bit value to a character such as 'a' or '@' or an action of some sort.
- The ISPF editor is happy to display ASCII characters for you, you just need to tell it
to do so! Use the primary command "SOURCE ASCII" to switch from EBCDIC view to ASCII
Enter the primary command SOURCE ASCII.
Now the EBCDIC characters look weird and the ASCII characters are readable. Neat!
Let's take a closer look at exactly what is going on here. The editor has the ability to display the hexadecimal representation of each byte. Not to bore any of you with the math, but hexadecimal is often used to display raw data as it only takes 2 characters between 0 and F to represent any unique 8-bit value.
- Turn on the hexadecimal display with the primary command "HEX ON".
Enter HEX ON in the primary line command area.
Now each line in the data set takes up 3 lines. The first line, with the line number is the visible representation of the data, and the next two lines show the hexadecimal values for each byte of data. Using F8 and F7 in conjuction with SOURCE ASCII and SOURCE EBCDIC, you should be able to investigate the data in detail.
After investigating the data, enter a few commands to change the editor back to it's inital state:
- Enter the primary command HEX OFF.
- Enter the primary command RESET.
Finally, type in a few more commands:
- Enter the primary line command BOTTOM.
- Type the line command CC on lines 57 and 65.
The CC command is used in pairs and designates multiple lines to copy.
- Type the line command OO on lines 67 and 75.
The OO command is used in pairs and designates the area of text to overlay the copied block into.
- Press Enter.
It's entirely possible that you'll make a mistake at some point during this challenge. Use the primary line command CANCEL to exit the editor without saving any changes, and you can try again. If you accidentially save your data set and it contains errors, you can reset the contents by performing the following steps:
- Edit the data set.
- Type D999 in the line command area for line 1.
- Enter COPY 'ZOS.PUBLIC.P2.SEQ'.
After successfully performing the required edits, press F3 to exit and save your work. Then enter the primary line command:
This job will execute, copying the contents of CC#####.SEQ into P2.OUTPUT(#02).
If you mess up your data set you can restart using the guidance given in Resetting a Data Set Reference Page.
In addition to ISPF Editor help tutorial via the F1 key, you may also want to check out the ISPF Editor Command Summary Page.
Congratulations! You are done with this challenge and may move on to the next one.