 |
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 powerAn 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 codingPOVI 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 ManualAO53-6533-3
- AF/OPERATOR User's GuideAO54-6532-2
- AF/OPERATOR Configuration & Customization GuideAO51-6530-2
|
|