Starting an agent on z/OS

On z/OS® in addition to running the fteStartAgent command from a UNIX System Services session, you can start an agent as a started task from JCL without the need for an interactive session. A started task is used because it runs under a specific user ID and is not affected by end users logging off.

As a Java™ application, an agent is a UNIX System Services application that you can run from JCL by using the the JZOS Batch Launcher or the BPXBATCH program. Using the JZOS Batch Launcher is more complex to set up than using BPXBATCH but does allow Java programs like the fteStartAgent and fteStopAgent much better integration with standard z/OS batch facilities. These batch facilities provide the correct return code as the step completion code, making error handling easier, and is the preferred way to run the agent as a started task.
Using BPXBATCH gives you the option of running either with or without a command shell, but is not the preferred way to run the agent as a started task. If you use BPXBATCH without a logon shell, this provides some isolation from your user environment profile but is slightly more complex. If you use BPXBATCH with a logon shell, this is a more straightforward solution, but it is largely dependent on your user environment. BPXBATCH with a logon shell also provides the facility to start an agent running as a background process, which continues running after the job step ends.

Sample JCL

The following sample JCL is provided. These samples are installed in the samples/JCL subdirectory when you install WebSphere® MQ File Transfer Edition on z/OS.
Table 1.
Sample name Function
BFGXSAG Runs an agent as a job step by using BPXBATCH without a logon shell.
BFGYSAG Starts an agent as a background process by using BPXBATCH. The agent continues running after the job step completes.
BFGYSAGF Runs an agent as a job step by using BPXBATCH with a logon shell. This is typically the most straightforward to configure.
BFGZSAG Runs an agent as a job step by using the JZOS Batch Launcher. This is the preferred option if you want to run the agent as a started task, rather than a normal batch job step.

Example

This is an example of a started task procedure, called AGENT1, used to start a WebSphere MQ File Transfer Edition 7.0.3 agent:
//AGENT1 PROC                                                           
//*                                                                     
//******************************************************************    
//* Start the agent AGENT1 using JzOS batch launcher                    
//******************************************************************    
//*                                                                     
//WMQFTE   EXEC PGM=JVMLDM60,REGION=0M,PARM='+T'                        
//STEPLIB  DD DSN=SYS1.SIEALNKE,DISP=SHR                                
//         DD DSN=MQM.V701.SCSQAUTH,DISP=SHR                            
//         DD DSN=MQM.V701.SCSQANLE,DISP=SHR                            
//         DD DSN=MQM.V701.SCSQLOAD,DISP=SHR                            
//SYSOUT   DD SYSOUT=*                                                  
//SYSPRINT DD SYSOUT=*                                                  
//STDOUT   DD SYSOUT=*                                                  
//STDERR   DD SYSOUT=*                                                  
//STDENV   DD DISP=SHR,DSN=FTEUSER.FTE.JCL(STDENV)                      
//MAINARGS DD DISP=SHR,DSN=FTEUSER.FTE.JCL(MAINARGS)                    
//*                                                                     
//*-----------------------------------------------------------------    
//         PEND                                                         
//*-----------------------------------------------------------------    
//*                                                                     
//              

The STEPLIB in the JCL adds SYS1.IEALNKE, the JZOS batch launcher load module dataset, to the LINKLIB concatenation. When this procedure is added to a library in the PROCLIB concatenation the agent can be started by using the command s agent1

The STDENV DD executes a shell script that sets a number of environment variables needed by the JVM, WebSphere MQ, and WebSphere MQ File Transfer Edition. An example of the STDENV used is as follows:

# This is a shell script which configures                               
# any environment variables for the Java JVM.                           
# Variables must be exported to be seen by the launcher.                
# Use PARM='+T' and set -x to debug environment script problems         
set -x                                                                  
. /etc/profile                                                          
#                                                                                                                               
# Java configuration (including MQ Java interface)                      
#                                                                     
export FTE_JAVA_HOME="/java/java60_bit31_sr6/J6.0/"                
export PATH="/bin:£{FTE_JAVA_HOME}/bin"                                 
LIBPATH="/lib:/usr/lib:£{FTE_JAVA_HOME}/bin:£{FTE_JAVA_HOME}/bin/classic
LIBPATH="£{LIBPATH}:/mqm/V7R0M01/java/lib"                               
export LIBPATH                                                          
#                                                                       
# FTE configuration                                                     
#                                                                       
export FTE_PROD="/wmqi/mqfte703/V7R0M3"                                 
export FTE_CONFIG="/u/FTEUSER/mqfte"                                    
export _BPXK_AUTOCVT="ON"                                               
#                                                                       
# Select function to be executed (script names without fte prefix)       
#                                                                       
. £{FTE_PROD}/bin/fteBatch StartAgent                                   
#                                             
# Set JZOS parameters to FTE values           
#                                             
export IBM_JAVA_OPTIONS="£{FTE_JAVA_OPTIONS}" 
export JZOS_MAIN_ARGS="£{FTE_MAIN_ARGS}"   

The MAINARGS DD contains the arguments passed to the command StartAgent named in STDENV. Using the -F parameter makes the agent run in the foreground. If you omit this parameter, the started task terminates and the agent is not started.

-F AGENT1    

Reference Reference

Feedback

Timestamp icon Last updated: Tuesday, 30 January 2018
http://www.ibm.com/support/knowledgecenter/SSEP7X_7.0.4/com.ibm.wmqfte.doc/zos_start_agent_cmd.htm