MVS TOOLS AND TRICKS OF THE TRADE December 1994 Sam Golob MVS Systems Programmer sbgolob@cbttape.org Sam Golob is a Senior Systems Programmer working in New York City. YOUR TSO SESSION - USING THE TSO SESSION MANAGER Nowadays, we're often surprised that "ancient" software can be just as useful today as it once was. We have many examples of this. A few months ago (in the July 1994 issue) I wrote about the IEHMOVE program and how it can be useful in these times, to prepare mainframe sequential files and PDS'es for download to PC disks. Another example concerns the use of a CLIST to invoke batch SMP/E under TSO, which I wrote about some time ago (October 1992). This kind of CLIST had been common during SMP4 days, when there was no ISPF interface for SMP. Now that there is an ISPF interface, the SMP CLIST is still just as useful as it was in times past. Our example for today is the ancient TSO Session Manager, now a part of TSO/E. The Session Manager carries an initial copyright date of 1977, which indicates how old it is. The Session Manager was designed to overcome a serious problem with TSO. TSO, in its native mode, can only show one screen of output at a time. After the output leaves the screen, you can't get it back again. In other words, you can't scroll backwards or forwards, and you can't save the data. That can be very inconvenient sometimes. The Session Manager's main function is to preserve your TSO commands beyond one screen's worth of output. Further, you can scroll back many lines to an old command, and re-enter it by typing over part of it. An entire record of your TSO session can be printed out or copied to a dataset. This is a big improvement. There is also a "string find" capability. These features make the Session Manager far more useful, in most situations, than the normal TSO viewing mode. How do you invoke the Session Manager? All you have to do is to change the program that is executed by your TSO Logon Procedure. Just change the program name from IKJEFT01 to ADFMDF03, and you'll get the Session Manager. It's that simple. Actually, there are some finer points (see Figure 1). Anybody with TSO/E can use the Session Manager. Even shops without TSO/E probably can get to it also. HOW DOES THE SESSION MANAGER WORK? When you invoke the Session Manager main task, ADFMDF03, two parallel subtasks are then attached: the original TMP (IKJEFT01), and the Session Manager subtask. Terminal I/O that is normally handled by the TMP (TGET's and TPUT's) gets automatically intercepted and re-directed into one or more of the Session Manager data areas known as "streams". Meanwhile, the Session Manager has physically divided your terminal display into separate areas known as "windows". Data from the various "streams" is selectively (and intelligently) mapped to the various "windows" for the user to view. See Figure 2 for an approximation of a default Session Manager screen. The Session Manager has input data streams and output data streams, which are mapped to various windows on your terminal display. Usually (in the default screen setup), the input stream corresponding to TSO input, is mapped to a window at the bottom of your display tube. TSO commands typed into this area are sent to the input stream known as the TSOIN stream, from where they are directed to the TSO terminal monitor subtask and executed. At the top of the default display, there is a large window which receives output from the TSO commands. This "Main Window" displays data from the TSOOUT stream, which has received all the TPUT output that the Session Manager intercepted from TSO. Since the TSOOUT stream is a large data area (whose size is controllable by the installation and the user), many lines of output can be stored and viewed. In addition, all the TSO input from the TSOIN stream gets copied to the TSOOUT stream and is displayable there. The TSOOUT stream therefore becomes an effective log of everything done by the TSO session. Of course, there are limits to the amounts of data which can be stored in a Session Manager stream. When a stream becomes full, it wraps around to the beginning. This is true for all of the various kinds of streams that have been initialized for your session. Some of the other streams are: SMIN (which holds Session Manager input commands), SMOUT (which contains the results from Session Manager commands), and MESSAGE (which contains the message outputs). The message outputs are usually also copied into the TSOOUT stream. NAVIGATING THE TSOOUT STREAM. The TSOOUT stream is effectively a session log for your session. As such, you'll often want to look at, or type over, various parts of the TSOOUT stream data. In the default Session Manager screen layout, data from the TSOOUT stream is displayed in the large window, called the "Main Window", that is located at the top of your video screen display. If you look at Figure 2, you'll notice that in the lower right corner there's a display that says, "MAIN ==> UNLOCKED". When the Main Window is in "unlocked mode", every time you press enter, you'll go down half a screen. If you press PF12, you'll go to the bottom of the TSOOUT data and stay in unlocked mode. Any other forcible positioning in the TSOOUT data will put the Main Window into "locked mode". In locked mode, pressing ENTER will not reposition the Main Window. PF7, PF8, PF9, PF10, and PF11 will forcibly reposition the Main Window in different ways. Refer again to Figure 2. PF7 moves the Main Window up by the Scroll Amount. PF8 moves the Main Window down by the Scroll Amount. PF11 moves the Main Window to the right (it is 255 characters wide), and PF12 moves the Main Window to the left. PF9 positions the Main Window to the top of the TSOOUT data. PF12 positions the Main Window to the bottom of the TSOOUT data, and unlocks the Main Window. You have capability of finding a string of data in the TSOOUT stream, so that the Main Window will display the next occurrence of that string, upwards. To do a "find", you must enter a case-sensitive string on the command line at the bottom. Then press PF5. The search will go from the current part of the TSOOUT stream, up toward the top. PF5 functions repeatedly, so that you may press it over and over again to find more occurrences farther up in the TSOOUT stream. FURTHER THOUGHTS. Much of the power of the Session Manager lies in the fact that TSO data can be saved, preserved, and manipulated. In TSO native mode, the data goes onto the screen, precious little at a time. And once it leaves the screen, it's gone forever. Not so in Session Manager mode. The TSO data may be saved, moved, copied, and printed. The IBM program which performs this function is called SMCOPY. SMCOPY is not hard to use. It is a TSO command which is entered from Session Manager mode. There is a lot of flexibility built into SMCOPY, as is shown by Figure 3, which is part of the SMCOPY HELP member. On your system's SYS1.HELP dataset, you can browse the entire SMCOPY HELP member for further information. Next comes the question of switching modes "on the fly". For most TSO commands, Session Manager mode improves usability. However, there are some commands where you'd rather have TSO in native mode. For example, commands which repeatedly clear the screen and then supply a new screen's worth of data after you press ENTER, were usually designed for native mode operation. This type of command does not execute well under the Session Manager. Under the Session Manager, you constantly have to press PF12 to go to the bottom and view the new data. Also, under Session Manager, when you just want to press ENTER, you have to enter a blank first. Repeatedly entering a blank before pressing ENTER is very tedious if you're constantly doing so. Therefore, it would be nice to switch to native mode while using commands designed for native mode, and then toggle back to your existing Session Manager environment for the other commands. There are (at least) two ways in which this can be done. First, IBM provides two different ISRTSO panels in its "ISR" panel library. The alternate one, ISRTSOA, may be renamed to ISRTSO so it will be used whenever you are in ISPF Option 6. This alternate ISRTSO panel has an option to switch your session into and out of Session Manager mode. The other way to do it is with a TSO command from CBT Tape File 119 called "SM". SM is an authorized command which toggles your session from native mode to Session Manager mode and back. Both ways work with limited success. You'll have to experiment to see which way is best for your environment. Finally, we have to tell you how to go further. Session Manager sessions can be altered. Defaults can be changed. If you investigate the Session Manager, there is a lot of power to be taken advantage of. Therefore, I must mention the manuals. In the TSO/E User's Guide, there is a chapter on the Session Manager that used to be in a separate thin manual called "A Guide to Using the TSO Session Manager". The TSO/E Customization manual contains useful information, and if you can get a copy of "TSO Extensions Version 2 - Session Manager Logic", a lot of understanding can be acquired from that. Anyway, good luck. It's very stimulating and exciting when we're constantly trying to expand our horizons. It also helps us get our work done faster in the long run. * * * * * * * * * * * * * * * * * * * * * * Figure 1. How to set up a LOGON PROCEDURE to invoke the TSO Session Manager. A. A simple LOGON PROC where PGM=IKJEFT01 was merely replaced by PGM=ADFMDF03 to invoke the Session Manager. //LOGSAMG EXEC PGM=ADFMDF03,DYNAMNBR=150,TIME=NOLIMIT, // PARM='%LOGPRSG' //* //SYSPROC DD DSN=CLIST.LIB.WITH.LOGCLST,DISP=SHR //SYSPRINT DD TERM=TS,SYSOUT=A //SYSTERM DD TERM=TS,SYSOUT=A //SYSIN DD TERM=TS B. A more complicated LOGON PROC which explicitly turns on Session Manager mode, and which invokes a different set of Session Manager defaults determined by the ADFMDFL1 load module. On your system, see SYS1.SAMPLIB(ADFDFLTX) which contains the source code from which ADFMDFL1 was modeled. //LOGTECH EXEC PGM=ADFMDF03,TIME=1440,DYNAMNBR=100, // PARM='SM(IKJEFT01,Y,ADFMDFL1),%ISPFPROF' // DD statements * * * * * * * * * * * * * * * * * * * * * * Figure 2. An approximation of the default TSO Session Manager display. The wide area at the top is the Main Window, which displays the TSOOUT data stream. Commands are entered next to the arrow at the bottom left. The last 2 lines of latest TSOOUT output are displayed immediately above where the commands are entered. Scroll amount and "LOCKED" or "UNLOCKED" status of the Main Window are at the bottom right. A new TSO command, "lista", has been entered in the command area, but the ENTER key has not yet been pressed. ---------------------------------------------------------------- |READY | |listc lev(sys9.csc) | |IDC3012I ENTRY SYS9.CSC. NOT FOUND+ | |IDC1566I **SYS9.CSC NOT LISTED | |IDC0014I LASTCC=4 | |READY | | | | | | | | | | | | | | | | | |---+---1---+---2---+---3---+---4---+---5---+---6---+---7---+---8| |IDC0014I LASTCC=4 SCROLL ===> HALF | |READY MAIN ==> UNLOCKED | |===> lista status hist sysnames | | | | ---------------------------------------------------------------- * * * * * * * * * * * * * * * * * * * * * * Figure 3. TSO HELP member for the SMCOPY command. Although abridged, these instructions show you a lot of SMCOPY's power. See member SMCOPY on your system's SYS1.HELP dataset for all the details. )F FUNCTION - THIS COMMAND COPIES ALL OR PART OF A STREAM OR DATA SET TO ANOTHER STREAM OR DATA SET. THE RECEIVING DATA SET MAY BE A SYSOUT DATA SET. )X SYNTAX - SMCOPY FROMDATASET('DSNAME') OR FROMSTREAM('STREAM-NAME') TODATASET('DSNAME') OR TOSTREAM('STREAM-NAME') OR PRINT('SYSOUT-CLASS') ASIS/CAPS/NOTRANS FORMAT/NOFORMAT/PREFORMAT LINE('START-LINE' : 'STOP-LINE') REQUIRED - NONE DEFAULT - FROMSTREAM(TSOOUT) PRINT(A) CAPS NOFORMAT