Admin Alert: Starting Multiple PC5250 Sessions in a Batch File
September 7, 2011 Timothy Prickett Morgan
In a recent column, I demonstrated how to configure a PC5250 session so that you can run multiple sessions on the same PC to a single iSeries/System i/Power i partition. The problem with that technique was that it only worked using sessions that connected to the same partition. This issue, I’ll demonstrate how to automatically start multiple PC5250 sessions on the same PC that connect to different partitions.
Today’s column was inspired by reader Bill Swann, who reminded me that the iSeries Access for Windows package includes a very simple procedure for launching multiple PC5250 sessions at the same time on the same PC. All you have to do is create a PC5250 batch file (.bch) and you’ll easily be able to launch as many PC5250 sessions to as many partitions as you want on your PC, all with the click of only one key.
Here’s how it’s done.
PC5250 batch files work the same way as any other Windows PC batch file. They execute commands in sequence. In this case, each executed command is a call to start a PC5250 session file (.ws) that connects your PC to a different iSeries, System i, or Power i partition.
To illustrate how a PC5250 batch file works, let’s look at an example. Let’s assume that I have three i OS partitions (PARTA, PARTB, and PARTC), each of which has its own PC5250 session file on my PC that is already configured to run multiple sessions to its respective partitions. However, I don’t want to go through the hassle of clicking on each respective PC5250 session icon each time I want to open a session. I’d rather click on one icon that opens one or more sessions to each of my partitions. The PC5250 batch file is the mechanism I can use to make this happen.
A PC5250 batch file is a simple batch file that allows me to start several PC5250 sessions at the same time, simply by clicking on the batch file icon. It’s easy to create and use. Once I create my batch file, I can easily move it to my desktop, my Windows startup folder, or any other location that allows me to easily and quickly start my sessions. This technique works great in i OS shops that have multiple partitions, such that you only have to click on the one batch file icon to start desktop sessions to each of many different systems.
Creating the Multi-Session PC5250 Batch File
To create a PC5250 batch file from your Windows desktop, start up the Multiple Sessions application from your PC5250 emulation folder. In Windows XP, I can access Multiple Sessions by clicking on the Windows Start button and then selecting All Programs→iSeries Access for Windows→Emulator→Multiple Sessions from the Start menu. This will bring me to the Create/Modify Batch File screen show here.
From here, I can populate my batch file with PC5250 session calls by highlighting each session name I want to add to my .bch file and then clicking on the Add button. Every time I click on Add, the program will add another session call entry to my .bch file.
So if I wanted to add one session startup for each of three partitions to my batch file, I would first highlight the parta.ws session file and then click Add. This adds a PC5250 parta.ws session call command (pcsws.exe) into my batch file, which I can see in the Batch-File Entries section of this screen. If I wanted to add session startups for my partb.ws and partc.ws PC5250 session files, I would highlight each of these sessions and again click on the Add button. This would add two new session calls to the Batch File Entries section. Using this technique, I can add as many PARTA, PARTB, and PARTC session startups as I want to my batch file.
Modifying How Each Session Starts
If I then want to modify how my .bch sessions start up, I can add parameters to each session call by moving my mouse pointer over to the Batch-File Entries part of the Create/Modify Batch File screen and then modifying my PC5250 calls with one of the following parameters.
1. To minimize one or more of my sessions as an icon on the Windows taskbar (not as an open window), I would add /i to the end of that session’s PC5250 call statement in my batch file. I would then be able to use ALT-TAB to go to that session or click on its icon on the Windows taskbar to use the session.
2. To start one or more of my sessions as a hidden session, I would add the /H parameter to the end of each session call that I want to hide. After each hidden session starts, the PC5250 session will remain active but it will no longer show up on my Windows taskbar and it will not display in an open window. I won’t be able to click on the session on my Windows taskbar or to use the Windows ALT-TAB keystroke combination to move to the hidden session. I would only be able to get to a hidden session by going to an active PC5250 session that is not hidden and selecting Window→Show Session from the PC5250 menu bar. This screen shows all the active and hidden PC5250 sessions on my PC, as displayed here.
From this list, I would then select the hidden session that I want to reveal, press Enter, and that session will become available on the Windows taskbar. One of the better scenarios for using hidden PC5250 sessions is when you’re starting a PC5250 printer session on the user’s desktop and you don’t want the user messing around with or changing the printer session settings. In that case, you may want to make the printer session’s PCSWS.EXE call into a hidden session.
There is one thing to be careful of when using hidden PC5250 sessions. Never designate all of your .bch PC5250 session calls as hidden sessions. You will always need to have one non-hidden session active in order to reach your other hidden sessions. If all your sessions are hidden, you won’t be able to reach them through the Window→Show session option on the PC5250 toolbar.
When I’m finished with configuring my .bch file, I can save it to my PC5250 emulator folder by clicking on File→Save or File→Save As from the Create/Modify Batch File screen toolbar. If I want to later change the PC5250 activation commands inside my .bch file, I can find and right-click on the file and select Modify from the pop-up menu that appears to once again reach the Create/Modify Batch File screen.
Once my PC5250 batch file is ready, I can click on my .bch file to start all my i OS sessions at the same time. If I want these sessions to start whenever I sign on to the computer, I can move or copy the .bch file into my Windows Startup folder. I can also copy this file to my desktop if I want to easily start my sessions whenever I want.