How can threads be terminated with Batch JCL?

Document ID : KB000028313
Last Modified Date : 14/02/2018
Show Technical Document Details

Introduction: 

Batch termination requires a JCL procedure to be created. The Thread Terminator JCL can be executed using an in-stream procedure or the procedure can be cataloged.

One of the following must be completed in order to create the JCL needed for batch termination:

  • Have Thread Terminator create the batch JCL for you based on parameters you enter on a display.
  • Enter the batch JCL manually.

Instructions: 

 

 

I-Creating the JCL Using Thread Terminator
Thread Terminator can automatically create the JCL for batch termination of threads. The display can be accessed to create the batch JCL using one of the following methods:

  • Select an option on the Thread Terminator Main Menu, then fill in the thread termination and JCL dataset parameters on a batch JCL creation display.
  • Use thread filtering to select the threads to terminate, and then access the display to create the batch JCL. The termination parameters are automatically filled in based on the thread filtering criteria. Using thread and data set information you enter, Thread Terminator creates the JCL for the batch termination and a control card or cards that specify which threads are to be terminated.

II-Create the Batch JCL through ISPF panels.
To access the display to create the batch JCL, do one of the following:

  • From the Thread Terminator Main Menu, enter 3 in the Option field. When you press Enter, the Thread Terminator Batch Select display appears.
  • From the Active Threads Display, you can access the Batch Select display when you use thread filtering. Filtering criteria is used to construct the control cards for the batch termination. This lets you view the threads you want to terminate and automatically build the control cards with the proper termination parameters.

To access the Batch Select display using thread filtering, follow these steps:

  1. On the Active Threads Display, enter S in the Set Filters field, and press Enter. The Filter Selection Display appears.
  2. Enter the filtering criteria on the Filter Selection Display, and press Enter, then PF3 (End) to return to the Active Threads Display.
  3. Enter YES in the Filter field on the Active Threads Display, and press Enter. The display now lists only threads that meet your filtering criteria.
  4. Enter B for Batch Setup or T for Terminate All, and press Enter. The Thread Terminator Batch Select display appears. The thread termination parameter fields are filled in based on the thread filtering criteria.

The Thread Terminator Batch Select display lets you specify the selection criteria for thread termination and the data set information for the JCL and control cards. This display appears whenever you invoke the create batch JCL option from the Thread Terminator Main Menu or from the Active Threads Display. Here is a sample of the Thread Terminator Batch Select display:

------------ Thread Terminator Batch Select ----  
COMMAND ===>                                                             
-----------------------------------------------------------------------
DB2 SSID ==> ssid                                                        
                                                                         
SELECTION CRITERIA: You MUST specify at least one.                       
Planname ==> ________     Connid ==> ________      Jobname => ________   
Authid ====> ________     Corrid ==> ____________                        
                                                                         
OPTIONS: Asid ====> ____ (You may not specify a mask.)                   
                                                                         
         Term ====> SOFT ("SOFT" or "KILL". SOFT terminates a thread in  
                         DB2, KILL terminates a thread in MVS.)          
                                                                         
         Dump ====> N    ("N" produces no dump. "Y" produces output      
                      depending on the termination option: SOFT       
                      produces an SVC dump, KILL produces a SYSUDUMP.)
                                                                         
DATASET/MEMBER SELECTION:                                                
Contents       Member     Data Set Name                                  
JCL           ________    ________________________________________       
Control Card  ________    ________________________________________

Specify the parameters for thread termination in these fields. You must enter a name or mask in at least one of the following fields. For masks, you can use the underscore (_) as the single character wild card and the percent sign (%) for trailing values. If you specify more than one of these fields, the threads selected for termination are the logical 'AND' of the fields. If you accessed this display by using thread filtering, the fields are already filled in based on the thread filtering criteria. However, you can still edit the fields if necessary.

When you finish entering information in these fields, press Enter. The JCL appears in an ISPF edit session. To submit the batch termination immediately, enter SUBMIT in the command line. To exit without executing, press PF3 (End). When the JCL is executed, Thread Terminator issues an OS/390 termination request for the selected threads. This is equivalent to the KILL termination option.

III-Creating the JCL Manually
You can also enter the JCL into a data set for execution. The complete JCL procedure is described in this section.
The first part of the Thread Terminator JCL is shown in the following illustration:

[1] //jobname JOB (acct. info),'PTT',CLASS=x,MSGCLASS=y,
// MSGLEVEL=(1,1),REGION=5M,NOTIFY=&SYSUID
//*
[2] //JOBLIB DD DSN=CA load library, DISP=SHR
//*
//PTTBATCH PROC
//PTTBATCH EXEC PGM=PTLDRIVM,PARM='EP=PTTBTCCC',REGION=4096K
[3] //PTILIB DD DISP=SHR,DSN=CA load library
[4] //PTIPARM DD DSN=CA PARMLIB,DISP=SHR
[5] //SYSUDUMP DD SYSOUT=*
[6] //TTREPORT DD SYSOUT=*
//SYSIN DD DUMMY
// PEND
The second part of the Thread Terminator JCL contains the parameters for thread
termination.Enter the JCL as shown in the following illustration:
[7] //PTTBATCH EXEC PTTBATCH,PARM='TEST'
[8] //PTTBATCH.SYSIN DD *
[9] * TERM SSID ASID AUTHID.. CONNID.. PLANNAME CORRID...... JOBNAME. XMAN
KILL D41A PDREN% 0303
//

If more than one of these parameters is specified, the threads selected for termination are the result of a logical AND of the parameters. The more information you specify on the control card, the more precise the termination. Use as many parameters as possible to ensure that you are terminating the appropriate threads. The parameters and control card layout are described in the table in the following section. [9] card template-(Display only) This is a template card showing the parameters in the proper card column positions to help you correctly input the parameters for the PTTBATCH.SYSIN card.

Additional Information:

 

Before submitting the JCL, ensure that Xmanager is active, or your thread termination request will abend. Submit the Thread Terminator JCL as you would any other batch job.