Skip to main content

Software  >  Tivoli  >  CCR2  > 

CCR2

A publication for the IBM Tivoli and zSeries community

Tivoli software

Using the AF/OPERATOR Programmerless Open VTAM Interface (POVI) to code/convert a script used during a TSO logon
from CCR2, Issue 4 - 2005

By Doug Palatas
Senior Automation Specialist
Mutual of Omaha Insurance Company

IBM Tivoli AF/OPERATOR® and IBM Tivoli OMEGACENTER® Gateway provide extensive interfaces to acquire and act on MVS resources. You can automate control of the few MVS applications that do not provide either an API or a console interface, and are accessible only through VTAM logons. AF/OPERATOR provides a Programmerless Open VTAM Interface (POVI) to access and manipulate these applications. Applications falling into this category include: NDM, some problem ticket applications, CICS transaction management, batch jog schedulers and others.

Automation application developers using the POVI environment for the first time have asked if it is possible to save time - with POVI scripts using provided REXX functions - when developing new task automation or processing ongoing maintenance. I have found that for any extended maintenance, the REXX functions are very user friendly. To highlight some of the benefits of automation using POVI REXX functions, code examples that automate a TSO logon process using different coding techniques are included in this tech tip:

  • AF/OPERATOR CLIST with POVI environment commands
  • REXX execs utilizing the POVI environment commands
  • REXX execs utilizing the POVI REXX functions

The scripts listed assume that you are working in a POVI script environment with OMEGACENTER Gateway.

Creating a POVI script
Some discussion should be made regarding ease of maintenance, standardization, reliability, development time and machine resources. The three scripts shown in this tech tip all perform the same operation. They log on to a TSO screen (utilizing OMEGACENTER Gateway) and then perform a Network Data Mover (NDM) process.

Development of a simple logon would be accomplished via the POVI Keystroke Recorder. This process is described in the AF/OPERATOR User's Guide. A brief overview of this development includes the following steps:

  • Develop script
  • Select session from OMEGACENTER Gateway
  • Enter \RC
  • Enter new script name
  • Enter description & Break Key
  • Type keystrokes to 'break'
  • Enter 'S' to save, then logoff to return to OMEGACENTER Gateway menu
  • Test
  • Select session
  • Enter \RC when logon screen appears
  • Select script to run from the POVI Keystroke Recorder Menu

Coding the logon process manually—The native AF/OPERATOR Command Language
One way to automate the TSO logon process is to create an AF/OPERATOR Command Language script to: logon to TSO; access the NDM screen; screen scrape for a data search; and then logoff. The following example illustrates these steps.

We're here to help
Easy ways to get the answers you need.
Request a quote
E-mail IBM

Or call us at:
877-426-3774
Priority code:
104CBW62



eNewsletter
Free eNewsletters!
Publications for the IBM Tivoli and System z communities
Learn more

Tivoli Beat
Hot off IBM Press: Implementing ITIL Change and Release Management. Tivoli Beat: Jan, 13
Click here for weekly insight on IT Service Management solutions

More offers

 


PROC 0

 AFLOGON: +
 LOGON AFGATE APPLID(OVIAO) NAME(GTWYTSO)
  AFADDR GTWYTSO
  LET SESSION = 'TSO'
  LET USERID = 'MYLOGON'
  LET AFOPWRD = '&AFOPWRD'
  \SET USERID
  '&USERID'
  \SET AFOPWRD
  '&AFOPWRD'
  'S &SESSION'
  \WAIT 5
  \RC TSOLOGN
  \WAIT 5
 EX OVIDISP
\WAIT 2
 \SET NDMFLD
 'NDM'
 \#TYPE (1)NDMFLD
 \K ENTER
  \WAIT 3
 \K ENTER
 EX OVIDISP
  \WAIT 2
 \SET DISFLD
 'SP'
 \#TYPE (1)DISFLD
 \K ENTER
 EX OVIDISP
  \WAIT 2
 \SET STAFLD
 'H'
 \#TYPE (2)STAFLD
 \K ENTER
 EX OVIDISP
PARSE VAR LINE7 V1 V2 V3 V4 V5 V6 THEREST
   IF (V5 = 'HO') && (V6 = 'WC') THEN GOTO NOTIFY
  ELSE GOTO LOGOFF
 END

NOTIFY: +
   WTO 'PROCESS HELD IN NDM, PLEASE INVESTIGATE' +
   DESC(2) ROUT(2) WTON(NUM1)
   WAIT SECONDS(5)
   DOM &NUM1
 GOTO LOGOFF

LOGOFF: +
 \K PF3
 \WAIT 5
 \K PF3
 \WAIT 4
 \K PF3
 \WAIT 4
 \K PF3
\WAIT 5
 \K ENTER
 EX OVIDISP
 \WAIT 5
 \SET LOGFLD
 'LOGOFF'
 \#TYPE (4)LOGFLD
 \K ENTER
RETURN

Although the AF/OPERATOR Command Language gets the job done, it is quite a bit of code to manage and maintain. There are more effective ways to complete the task. Converting the Command Language above to a REXX exec, as depicted in the next example, will allow you to prepare for the conversion to POVI REXX functions.

Coding the logon process with greater power—An AF/OPERATOR REXX exec
The AF/OPERATOR REXX exec below is a direct conversion from the Command Language script, above, into REXX code. This conversion consists of basic changes from Command Language to REXX coding only. For example, REXX requires different syntax for quotations, line continuations and error management in order to execute properly.

There is no technical requirement to convert the AF/OPERATOR Command Language script line-by-line into REXX before adding the POVI REXX functions. The following is a line-by-line conversion to give an example to those who are new to REXX and to provide an easy comparison between the Command Language code and the REXX exec.

/* REXX */
TRACE I

 AFLOGON:
 "LOGON AFGATE APPLID(OVIAO) NAME(GTWYTSO)"
  "AFADDR GTWYTSO"
  SESSION = 'TSO'
  USERID = 'MYLOGON'
  AFOPWRD = 'MYPASWRD'
  "\SET USERID"
  "'"USERID"'"
  "\SET AFOPWRD"
  "'"AFOPWRD"'"
  "'S "SESSION"'"
  "\WAIT 5"
  "\RC TSOLOGN"
  "\WAIT 5"
EX OVIDISP
  "\WAIT 2"
 "\SET NDMFLD"
 "'NDM'"
 "\#TYPE (1)NDMFLD"
 "\K ENTER"
  "\WAIT 3"
 "\K ENTER"
 EX OVIDISP
  "\WAIT 2"
 "\SET DISFLD"
 "'SP'"
 "\#TYPE (1)DISFLD"
 "\K ENTER"
 EX OVIDISP
 "\WAIT 2"
 "\SET STAFLD"
 "'H'"
 "\#TYPE (2)STAFLD"
 "\K ENTER"
MSG7 = GLBVGET('LINE7')
   PARSE VAR LINE7 V1 V2 V3 V4 V5 V6 THEREST
   IF (V5 = 'HO') & (V6 = 'WC') THEN CALL NOTIFY
   ELSE DO
    CALL LGOFF
 END

NOTIFY:
   "WTO 'PROCESS HELD IN NDM, PLEASE INVESTIGATE'",
   "DESC(2) ROUT(2) WTON(NUM1)"
   "WAIT SECONDS(5)"
   "DOM &NUM1"
 CALL LGOFF

LGOFF:
 "\K PF3"
 "\WAIT 4"
 "\K PF3"
 "\WAIT 4"
 "\K PF3"
"\WAIT 4"
 "\K PF3"
 "\WAIT 4"
 "\K ENTER"
 "\WAIT 5"
 "\SET LOGFLD"
 "'LOGOFF'"
 "\#TYPE (4)LOGFLD"
 "\K ENTER"
EXIT

Now that we've covered the improvements after converting the original Command Language script to REXX, the following section shows how to build on the improved REXX version by taking advantage of a variety of AF/OPERATOR provided REXX functions for use when developing POVI applications.

Automating logon coding—POVI REXX functions
The final conversion step takes the REXX code above and adds the use of POVI REXX functions in the code to allow for even more flexibility and ease of use. This is a great benefit because less coding and maintenance is required by the programmer; the functions are provided and maintained by the vendor.

Once an exec is written you can easily copy it and use it to create similar logon scripts for other applications. By using the POVI REXX functions in the exec, the process becomes easier. After creating a new copy of the script, you simply change the appropriate POVIDATA values to accommodate screen differences (from one application to another).

POVI REXX functions (shown here in a completed script, used daily):

/* REXX REXX REXX REXX REXX REXX REXX REXX   */
/*                                           */
/* Gateway TSO Logon via POVI REXX Functions */
/*                                           */
/* REXX REXX REXX REXX REXX REXX REXX REXX   */

SYS1 = SYSVGET('AOSMFID')
SYS = SUBSTR(AOSMFID,1,4)

/* IF (SYS = 'A0xx') THEN EXIT */

AFOP = SYSVGET('AFOPWRD')
USERID = 'ABCDEFG'

PWRD = 'AFOPWRD'
LOGONID = 'USERID'

SELECT
 WHEN (SYS = 'A011') THEN APPLIC ='TSO11'
 WHEN (SYS = 'A022') THEN APPLIC ='TSO22'
 WHEN (SYS = 'A033') THEN APPLIC ='TSO33'
otherwise nop
end

SELECT
 WHEN (SYS = 'A011') THEN ENVIRO ='GWYTSO11'
 WHEN (SYS = 'A022') THEN ENVIRO ='GWYTSO22'
 WHEN (SYS = 'A033') THEN ENVIRO ='GWYTSO33'
otherwise nop
end

ADDRESS AFHOST

toolsrc = POVILGON(OVIAO, APPLIC, ENVIRO)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVIVSET(PWRD, AFOPWRD)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVIVSET(LOGONID, USERID)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVIPBS(TSOLOGN)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVISEND(NDM, ENTER)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVIDLAY(3)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVISEND(,ENTER)
  IF (toolsrc <> 0) THEN CALL ERROR

 toolsrc = POVIDATA(4, 2, 17)
  IF (toolsrc <> 0) THEN CALL ERROR
  PULL proscreen
  IF (proscreen <> "SELECT ONE OF THE") THEN CALL ERROR

toolsrc = POVISEND(SP,ENTER)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVIDLAY(2)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVISEND(,TAB)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVISEND(H,ENTER)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVIDATA(8, 74, 6)
  IF (toolsrc <> 0) THEN CALL ERROR
  PULL screen1
toolsrc = POVIDATA(8, 57, 12)
  IF (toolsrc <> 0) THEN CALL ERROR

  PULL screen2
IF (screen1 = "HO  WC") & (screen2 = 'TSTMISC') &,
     (screen2 = 'FXXXA') & (screen2 = 'FXXPROD') &,
     (screen2 = 'HDMNDM')
  THEN CALL NOTIFY
  IF (screen1 = "HO  WC") & (screen2 = 'FXXXA') |,
     (screen1 = "HO  WC") & (screen2 = 'FXXPROD')
  THEN CALL NOTIFY2

MORE PULL Screen data here

ELSE DO
  CALL LOGOFF
 end

 NOTIFY:
   "WTO 'PROCESS ON HOLD IN NDM, RESTART VIA NDM, SYSTEM = "SYS"'",
   "DESC(2) ROUT(2)"
  CALL LOGOFF

 NOTIFY2:
    "WTO 'PROCESS ON HOLD IN NDM, PLEASE INVESTIGATE, SYSTEM = "SYS"'",
    "DESC(2) ROUT(2)"

"WTOR 'ALARM 1234 MSG &AOSMFID,APPLICATION,APPNAME,",
      "NDM PROCESS HELD-CALL 555-1212'",
      "REPLY(ANSWER) ROUT(20) MSGID(!AOPROX)"

LOGOFF:

toolsrc = POVISEND('=X',ENTER)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVISEND(,PF3)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVISEND(2,ENTER)
  IF (toolsrc <> 0) THEN CALL ERROR

toolsrc = POVISEND(LOGOFF,ENTER)
exit

ERROR:
 "OPER 'C U="USER"'"

toolsrc = POVILGOF()
exit

For your reference, the table below lists some of the POVI REXX functions used in the examples in this tech tip. This list is not all-inclusive. It is meant as a quick reference for building a basic script utilizing POVI REXX functions.

POVI REXX functions
POVI Function Description
POVIDATA Returns screen data. The location on the screen, and length are defined (as used in the code above: POVIDATA(8, 74, 6) - row, column, and length respectively).
POVIDLAY A wait (in seconds).
POVIFIND String locator (row and column).
POVILOC Positions cursor.
POVIPBS Initiates a Keystroke Recorder script (i.e., TSOLOGON).
POVISEND Writes data being sent (i.e., ENTER or TAB) to the current cursor position.
POVIVSET Sets variable (i.e., password, in the examples in this tech tip) to the current value.
POVILGON This function performs all of the necessary logon process.
POVILGOF Performs the logoff process.

The POVI processes and commands are documented in the following publications:

  • AF/OPERATOR Command Reference Manual—AO53-6533-3
  • AF/OPERATOR User's Guide—AO54-6532-2
  • AF/OPERATOR Configuration & Customization Guide—AO51-6530-2


Related links
The Mainstream
Business journal for the System z community
Tivoli Beat
Weekly updates on the IBM service management perspective
IBM software for System z
The power to drive an enterprise
IBM Tivoli software
Intelligent management software for the on demand world
Tivoli Software Global User Group Community
Join your peers in our information and community hub
Open Process Automation Library
OPAL is Tivoli's worldwide online catalog with hundreds of technically validated, production ready IT Service Management integrated extensions provided by IBM and IBM Tivoli Business Partners.