0% found this document useful (0 votes)
157 views22 pages

Getting What You Want With REXX Execs

This document provides information on how to summarize documents in 3 sentences or less. It discusses various ways to get information from z/OS systems using REXX including using external functions like LISTDSI, SYSDSN, MVSVAR and SYSVAR. It also discusses using commands, APIs and system interfaces to retrieve data from the catalog, tape management systems, control blocks, SDSF, USS and more. REXX provides extensive capabilities for extracting and parsing system information for further processing or reporting.

Uploaded by

Jackson Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
157 views22 pages

Getting What You Want With REXX Execs

This document provides information on how to summarize documents in 3 sentences or less. It discusses various ways to get information from z/OS systems using REXX including using external functions like LISTDSI, SYSDSN, MVSVAR and SYSVAR. It also discusses using commands, APIs and system interfaces to retrieve data from the catalog, tape management systems, control blocks, SDSF, USS and more. REXX provides extensive capabilities for extracting and parsing system information for further processing or reporting.

Uploaded by

Jackson Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Getting What You Want – With REXX Execs

Steve Pryor
DTS Software, LLC
[email protected]
1.919.833.8426
Many Sources of Information

Catlg
storage
TMS

REXX
Console
USS

File DB2

2
REXX Language Strengths


Extensive PARSE facilities

String manipulation

Output formatting

Array processing (stem variables)


Ease of Use

Availability / Cost
3
Getting Dataset Info – LISTDSI and SYSDSN


LISTDSI – TSO/E External Function – return dataset info
x = LISTDSI(“’MY.DATA.SET’”)
dsn or ddname
VOLUME(volser)/PREALLOC
(NO) DIRECTORY MULTIVOL RACF RECALL SMSINFO
– For DSN, quotes needed unless NOPREFIX
– Info returned in REXX variables (37)

sysdsname, sysvolume, sysunit,… sysused, sysextents,syscreate,…, sysencrypt...

4
Getting Dataset Info – LISTDSI and SYSDSN


LISTDSI limitations
– VSAM datasets only return dsn, volume, unit, dsorg
– GDG requires absolute generation, HFS not supported
– RECALL, DIRECTORY and SMSINFO are performance-sensitive
– DIRECTORY may update last-ref date

SYSDSN – does the dataset exist? Can it be used?
x = SYSDSN(dsname)
– Message returned to TSO
– GDG requires absolute generation
5
Getting Dataset Info – Reading from the Catalog


Catalog Search Interface (CSI)
– Call from assembler, HLL, or REXX to IGGCSI00

ADDRESS LINKPGM 'IGGCSI00 MODRSNRC CSIFIELD DWORK'
– SVC 26 Generic Filter Key, catalog entry types (A-X), options, field names
● SJP.*.QUAL?.**

– Requested information specified by catalog field names



Info returned in work area for each field name
– ‘resume’ flag set if work area not large enough

REXX can parse the work area to extract info
6
Getting Dataset Info – Reading from the Catalog


Parameter list ●
Work area (returned info)
WA actual len, required, used

Catalog Info x’F0’


Catname, RC, RSN, length

Field Info for Field 1


Field type, entry name
RC, RSN, length
Field Data

Field Info for Field 2


Field type, entry name
RC, RSN, length
FIELD NAMES Field Data

Field Info for Field n...


7
Getting Dataset Info – Reading from the Catalog


Catalog Field Names
VOLSER KEYLABEL XHARBA XHARBADS XHURBADS XHURBA EXTENT
NOEXTNT XACIFLAG COMPIND AMDCIREC AMDKEY NVSMATTR
LCBCONID LCBDESCR LCBDEVTP LCBLIBID VCBCHKPT VCBCRDT
...many more

Examples
– SYS1.SAMPLIB(IGGCSIRX)
– ftp://ftp.software.ibm.com/servers/storage/support/software/dfsms/cattools

II41316.CATSRCHI.TR – REXX exec

II41316.CATSRCHI.JCL.TR - JCL

8
Getting System Information – MVSVAR and SYSVAR


MVSVAR – system information for specified argument
variable = MVSVAR(argument) SYSDFP SYSMVS SYSNAME
SYSOPSYS SYSSECLAB SYSSMFID
SYSSMS SYSCLONE SYSPLEX
SYMDEF,symbol


SYSVAR – TSO/E External Function for session info, EXEC execution
info, terminal info, system software level info
variable = SYSVAR(argument)

9
Getting System Information – SYSCPUS, STORAGE


SYSCPUS – return online CPU id and model in REXX stem variable

PSA-→PCCA—PCCACPID

STORAGE - return (or write) data at specified address and length
data = STORAGE(addr,<len>,<data>)

Use to address data in z/OS control blocks

Convert data to displayable via REXX C2X function (and D2X, X2D functions)
CVT = C2D(STORAGE(10,4)) /* Get CVT addr as a decimal number */
cvtaddr = C2X(STORAGE(10,4)) /* Get CVT addr as a hex char value */
say 'CVT address is 'cvtaddr /* Display hex CVT addr */

MVSVERS = Storage(D2X(CVT - 40),7) /* Get MVS version data from CVT pfx */
say 'MVS Version is 'MVSVERS

10
Getting System Information – Control Blocks, IWMQVS


IWMQVS – Query Virtual Server to get capacity info
– Info from SYSEVENT QVS
address linkpgm 'IWMQVS QVSPLIST'
– returns LPAR name, capacity, VM status, et al

– Example use of STORAGE, IWMQVS



DTS.R71.Slxxxxx.SAMPLIB(REXXQVS)

Full IPL info - http://mzelden.com/mvsutil.html

CBT tape – http://www.cbttape.org
11
Getting Tape Management Information


DFSMSrmm TSO Subcommand

DFSMSrmm REXX API

EDGXCI and related macros

ADDRESS TSO RMM command-text
– Issue DFSMSrmm commands, returns info in REXX stem variables
– LISTVOLUME, LISTDATASET, SEARCHVOLUME, SEARCHDATASET, other commands

Set sysauth.edgdate to a REXX date format (E, U, J, Standard…) to use edg@xxx vars

12
Getting Tape Management Information


Get RMM Volser Date Info
/* rexx */
/* RMMVINFO – get volume date information */
arg volser
sysauth.edgdate = "NORMAL" /* return info in REXX variables */

address tso "RMM LV " volser "ALL"


if rc <> 0 then do
say "LISTVOL FOR "volser" FAILED, TSO RC="rc "RMM RC="edg@rc
drop sysauth.edgdate
address tso "RMM LV " volser "ALL"
exit
end

say 'VOLSER ='edg@vol /* volume serial */


say 'EXPIRATION='edg@xdt /* expire date */
say 'CREATION ='edg@cdt /* create date */
say 'ASSIGN ='edg@adt /* assign date */
say 'LAST CHG ='edg@lcdt /* last chg date */

13
Reading from a File – EXECIO


EXECIO
– TSO command for record-based input/output/copy
– Read using REXX stack or variables
– EXECIO nnnn DISKR ddname (readparms

nnnn = no. of lines or ‘*’

Readparms: FIFO/LIFO STEM variable OPEN/FINIS/SKIP

CA1 TLMS Database
– Can be read as a file and parsed (as can any other file)
"EXECIO 9999 DISKR INFILE (STEM inprec."
14
Reading from a File - EXECIO


DCOLLECT
– SYS1.SAMPLIB(ARCTOOLS) –> HSM.SAMPLE.TOOL

Member DCOLREXX – an EXEC to process IDCAMS DCOLLECT records

IDCAMS LISTCAT
– OUTFILE parameter directs SYSPRINT to dataset
– Use EXECIO to read; PARSE to process output

See OAMSCAN example

15
Getting Info from the Console – CONSOLE and GETMSG


CONSOLE Environment returns info from console
– TSO “console activate” command
– address console “CART xxx” – activates console environment
– Use GETMSG to retrieve messages

GETMSG msgstem msgtype, cart, mask, waittime

address console "F "hsmid",Q SETSYS"


msghsm = getmsg('resp.','SOL','HSM',,10)

do I = 1 to resp.0
...

16
Getting Info from the Console – SDSF ISFEXEC


Enable the SDSF environment and select panel command
– if rc = ISFCALLS(‘ON’) <> 0 then exit 99
– address SDSF “ISFEXEC pnl-cmd (options)”

Creates stem variables for each row/column
address SDSF “ISFEXEC ST” - status panel
– Address SDSF “ISFACT pnl-cmd TOKEN.n PARM(column action-char)”

Take an action on a selected row
address SDSF "ISFACT ST TOKEN('"TOKEN.ix"') PARM(NP P)" - purge job

Many different types of information / possible actions
– Issue SDSF commands, browse output, syslog, etc.
– RGEN command – generate REXX exec for current panel

17
Getting Info from USS


SYSCALL commands

Allow REXX to invoke USS callable services (access, chmod, chown, etc)

Use in TSO/E, batch, USS shell, programs
– Return code in RC variable, data in stem variable(s)

Reason codes in RETVAL, ERRNO
– Many callable services
call syscalls 'ON' /* enable syscalls */
address syscall /* default environment */
"getpwent pw." /* retrieve userid info */
say pw.pw_name pw.pw_dir /* userid, default directory */

18
Getting Info from DB2


DSNREXX environment
'SUBCOM DSNREXX' /* Host CMD Env AVAILABLE? */
IF RC THEN /* If not, make it available */
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')

SubSys = 'DBCG'
Address DSNREXX "CONNECT" SubSys /* connect to DB2 */
Owner = 'IBMUSER'
RecordKey = 'ROW2DEL'

SQL_stmt = "DELETE * FROM" owner".MYTABLE" ,


"WHERE TBLKEY = '"RecordKey"'"

Address DSNREXX "EXECSQL EXECUTE IMMEDIATE" SQL_stmt


Address DSNREXX "DISCONNECT

19
Other Topics / Other REXX


ISPF
– Panel REXX
– Skeleton File Tailoring REXX

System REXX

Other REXXs

20
Documentation and Further Info


TSO/E REXX Reference, SA32-0972

TSO/E REXX User’s Guide, SA32-0982

DFSMS Managing Catalogs, SC23-6853, Chapter 11

VSAM Demystified Redbook

Managing and Using Removable Media, SC23-6873

SDSF User’s Guide, SC27-9028

Using REXX and z/OS Unix Systems Service SA23-2283
21
Summary / Q and A

Next webinar June 21, 2022
– How to Read a z/OS Assembler Listing

[email protected]

Questions??? [email protected]
1-919-833-8426

Reminders

Current version 7.1 now available at www.dtssoftware.com

Companion DTS product use available n/c for a year – just ask!

Send your ACS routines or DTS product rules for complimentary analysis

You might also like