-The SYSVIEW REXX API normally returns data via the stack. You issue a command to CA SYSVIEW using the REXX ADDRESS statement and then process the data that was returned on the stack. The data returned on the stack would then be parsed into REXX variables. There is an alternative to have the data returned from SYSVIEW in REXX variables.
-The XVEXTRAC command makes getting the data you want easier. The XVEXTRAC command extracts data from CA SYSVIEW directly into REXX variables. This
command is valid only when CA SYSVIEW is executing under the SYSVIEW REXX API.
The XVEXTRAC command has four basic forms and we will take a brief look at them here. For more detailed information, please see the online help for the XVEXTRAC command. The four forms are:
XVEXTRAC DATA fieldname stemname <options>
The "XVEXTRAC TITLE" command creates a series of REXX variables named SYSV_TITLE_name where name is any one of the data fields that can appear on the title line.
The "XVEXTRAC MESSAGE" command creates a REXX variable named SYSV_MESSAGE, which contains the current message, if any.
The "XVEXTRAC INFOLINE" command creates a REXX stem variable named SYSV_INFOLINE. The SYSV_INFOLINE.0 variable contains the number of SYSV_INFOLINE.n variables that follow. Each SYSV_INFOLINE.n variable contains the data from the nth information line displayed.
The "XVEXTRAC DATA" command creates a REXX stem variable named stemname. The stemname.0 variable contains the number of stemname.n variables that follow. The values of the stemname.n variables are extracted from the display field named fieldname. The field from each row of data is extracted to the corresponding stemname.n variable. The options parameter on the XVEXTRAC command controls additional information that can be returned about each field, including items such as status and field type. For more information see the XVEXTRAC online help.
The use of the XVEXTRAC command can coexist with the use of the REXX stack. However, if you are using XVEXTRAC exclusively, you should tell the REXX API to quit stacking its output data so that you don't have to write the REXX code to do it yourself. This is accomplished by adding a STACK(NO) parameter to the first ADDRESS SYSVIEWE statement you issue in your EXEC:
ADDRESS 'SYSVIEWE' 'COMMAND( whatever ) STACK(NO)'
The STACK(NO) parameter tells the REXX API that it is no longer to stack any command output. You can specify STACK(YES) on a subsequent ADDRESS SYSVIEWE statement to turn stacking back on. Note that the stack setting is not saved in the profile. STACK(YES) is the default so STACK(NO) must be repeated in every EXEC where it is needed.
When the REXX API is not stacking output, it will automatically issue the following XVEXTRAC commands after every SYSVIEW command. You do not need to issue them in your EXEC. The REXX variables extracted by these commands will always be available and current:
It was stated above that the XVEXTRAC command is only valid when executed under the REXX API. This is not entirely true. XVEXTRAC will work when executed under any REXX EXEC. If you want to see how XVEXTRAC works in an interactive testing mode, create the following REXX EXEC, naming it whatever you like, and put it in an EXEC library accessible to TSO. Then execute it from TSO or ISPF.
/* REXX */
This EXEC just executes the SYSVIEW TSO interface program. Since CA SYSVIEW will be running under a REXX EXEC the XVEXTRAC command will work. To see the variables that XVEXTRAC creates, use the XVLIST command. The XVLIST command displays external variables; any that the calling EXEC creates, and any that XVEXTRAC creates.
The following sample REXX EXEC shows how you might use the XVEXTRAC command:
/* REXX */
ADDRESS LINK 'GSVXRXAA'
'CMD(ACTIVITY; SORT CPU% D LIMIT 10) STACK(NO)'
'CMD(XVEXTRAC DATA JOBNAME JOBN)'
'CMD(XVEXTRAC DATA CPU% CPUP)'
PARSE SOURCE . . execname.
SAY 'Output from REXX EXEC' execname
SAY 'Date' sysv_title_date 'Time' sysv_title_time
SAY ' '
SAY 'Top 10 CPU users on system' sysv_title_system
SAY ' '
SAY 'JobName Cpu%'
SAY '-------- ------'
DO i=1 BY 1 TO jobn.0
SAY LEFT(jobn.i,8) RIGHT(cpup.i,6)