SHARE Anaheim2012 RexxJava
SHARE Anaheim2012 RexxJava
Java
Chip Wood
SDSF Design/Development
IBM Poughkeepsie
[email protected]
* All other products may be trademarks or registered trademarks of their respective companies.
Notes:
Performance is in Internal Throughput Rate (ITR) ratio based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput that any user will experience will
vary depending upon considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can
be given that an individual user will achieve throughput improvements equivalent to the performance ratios stated here.
IBM hardware products are manufactured from new parts, or new and serviceable used parts. Regardless, our warranty terms apply.
All customer examples cited or described in this presentation are presented as illustrations of the manner in which some customers have used IBM products and the results they may have achieved. Actual
environmental costs and performance characteristics will vary depending on individual customer configurations and conditions.
This publication was produced in the United States. IBM may not offer the products, services or features discussed in this document in other countries, and the information may be subject to change without notice.
Consult your local IBM business contact for information on the product or services available in your area.
All statements regarding IBM's future direction and intent are subject to change or withdrawal without notice, and represent goals and objectives only.
Information about non-IBM products is obtained from the manufacturers of those products or their published announcements. IBM has not tested those products and cannot confirm the performance, compatibility,
or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products.
Prices subject to change without notice. Contact your IBM representative or Business Partner for the most current pricing in your geography.
2
Overview
• With SDSF’s REXX and Java support, you can perform most of the
tasks that you can perform interactively, such as:
• Display and modify jobs
• Display and modify resources and devices
• Browse SYSOUT data sets
• Print SYSOUT data sets
• REXX (added in z/OS 1.9) uses the same panel commands, action
characters and column overtypes as with interactive SDSF
• Java (added in z/OS 1.12) ultimately uses a similar interface into
SDSF but the programming interface is a collection of objects and
methods which are more Java-friendly.
• This presentation will discuss the REXX techniques first, since they
more closely resemble the interactive commands, then discuss the
equivalent function in Java
3
Getting Started with REXX
4
Rexx Example – Cancel a Job
rc=isfcalls(”ON”) Add
Addhost
hostcommand
commandenvironment
environment
isfowner = “D96CLW1”
Address SDSF “ISFEXEC ST” Access
Accessthe
theST
STpanel
panel
do ix=1 to JNAME.0 /* variable names same as FLD names */
if pos(“CHIP”,JNAME.ix) = 1 then Find
Findthe
thejob
job
Address SDSF “ISFACT ST TOKEN(‘”TOKEN.ix”’) PARM(NP P)”
[…lines omitted…] Take
Takean
anaction
actionon
onthe
thejob
job
end
rc=isfcalls(“OFF”)
Remove
Removethe
thehost
hostcommand
commandenvironment
environment(after
(afterclosing
closingthe
theloop)
loop)
5
Getting Started with Java
6
Getting Started with Java …
7
Example Java Application
// Create optional settings object
ISFRequestSettings settings = new ISFRequestSettings();
settings.addISFOwner(“D96CLW1"); // Set owner
// Get a runner used to access SDSF ST panel
ISFStatusRunner runner = new ISFStatusRunner(settings);
List<ISFStatus> statObjList = null;
statObjList = runner.exec();
Access
Accessthe
theST
STpanel
panel
// Missing exception handling – more on that later
// Cancel job
if (statObjList != null) {
for (ISFStatus statObj : statObjList) {
String jobname=statObj.getValue(“jname”)
if (jobname.startsWith(“CHIP”)) Find
statObj.cancel(); Findthe
thejob
job
}
Take
Takean
anaction
actionon
onthe
thejob
job
8
Accessing an SDSF Panel with REXX
• Syntax:
Address SDSF "ISFEXEC sdsf-command ( options )"
• sdsf-command is the same SDSF command as you use
interactively, including parameters, for example:
DA
DAcommand
command
• Address SDSF “ISFEXEC DA”
• Address SDSF “ISFEXEC CK ALL”
CK
CKcommand
commandwith
withthe
theALL
ALL
parameter
parameter
9
Java Runners and Settings
10
Accessing an SDSF Panel with Java
statObjList = runner.exec();
ST
STcommand
commandexample
example
11
Accessing an SDSF Panel – Options (REXX)
13
Special Variables to Control SDSF
14
Special Variables – Input
• settings.addISFPrefix("**");
settings.addISFOwner("ibmuser");
settings.addISFCols(“jname jobid”);
16
Java Runners and Settings …
// Create optional settings object
ISFRequestSettings settings = new ISFRequestSettings();
Corresponds
CorrespondstotoPREFIX
PREFIX****
settings.addISFPrefix("**"); command
command
settings.addISFOwner("ibmuser"); Corresponds
CorrespondstotoOWNER
OWNERIBMUSER
IBMUSER
command
command
settings.addISFCols(“jname jobid”);
Requests
Requestsjust
justthe
theJOBNAME
JOBNAMEand
and
JobID columns
JobID columns
// Get a runner used to access SDSF ST panel using settings
ISFStatusRunner runner = new ISFStatusRunner(settings);
Note that both Rexx and Java use column names rather than
column titles for sorting and filtering. See COLSHELP to see the
relationship between names and titles.
17
Special variables and settings (input)
Interactive Rexx Java
SET PREFIX * isfprefix = ‘*’ settings.addISFPrefix(“*”)
settings.removeISFPrefix()
SET OWNER D96CLW1 isfowner = ‘D96CLW1’ settings.addISFOwner(“D96CLW1”)
settings.removeISFOwner()
FILTER JPRIO GT 5 isffilter = ‘jprio gt 5’ settings.addISFFilter(“jprio gt 5”)
settings.removeISFFilter()
SORT TGNUM D isfsort = ‘tgnum d’ settings.addISFSort(“tgnum d”)
settings.removeISFSort()
n/a (limit number of data isflinelim = 1000 settings.setResponseLimit(1000)
rows returned) settings.removeResponseLimit()
n/a (limit columns returned) isfcols = ‘jname jobid’ settings.addISFCols(“jname jobid”)
settings.removeISFCols()
s.server(SDSF) isfserver = ‘SDSF’ settings.addISFServer(“SDSF”)
settings.removeISFServer()
… and lots more
18
Accessing an SDSF Panel – Data (Rexx)
19
Stem Variables for Panel Data - Example
20
Working with Row Objects in Java
21
Working with Objects …
…
statObjList = runner.exec();
…
for (ISFStatus statObj : statObjList) { Get
Getjob
jobname
name
Print
Printshort
shortform
formofofrow
row
System.out.println(statObj); properties
properties
System.out.println(statObj.toVerboseString());
} Print
Printall
allproperties
propertiesfor
for
row
row
22
Special Variables – Output
23
Request Results (Java)
24
Rexx error handling
25
Rexx Message Variables
26
Java error handling
27
Message Variables Example with Slash
Check
Checkthe
theULOG
ULOG
do ix=1 to isfulog.0
Say "isfulog."ix "is" isfulog.ix
end
28
ISFSLASH Command
• Syntax:
• Address SDSF “ISFSLASH (stemname) | command-list
(options”
29
ISFSLASH Command Syntax
30
Using ISFSLASH to Issue Multiple
Commands
rc=isfcalls(”ON”) Add
Addthe
thehost
hostcommand
commandenvironment
environment
cmd.0=2 Add
Addcommands
commandsto
tothe
thestem
stemvariable
variable
cmd.1=“$da”
cmd.2=“$dq” Issue
Issuethe
thecommands
commands
Remove
Removethe
thehost
hostcommand
commandenvironment
environment
rc=isfcalls(“OFF”)
31
ULOG Variables Example - Results
isfulog.1 is: SY1 2009061 12:47:58.49 ISF031I CONSOLE KJONAS
isfulog.2 is: SY1 2009061 12:47:58.49 -$da
isfulog.3 is: SY1 2009061 12:47:58.49 J0000032 $HASP890 JOB(KJONASR)
isfulog.4 is: $HASP890 JOB(KJONASR)
isfulog.5 is: $HASP890
isfulog.6 is: SY1 2009061 12:47:58.50 -$dq
isfulog.7 is: SY1 2009061 12:47:58.50 $HASP643 10 PPU LO
isfulog.8 is: SY1 2009061 12:47:58.54 $HASP646 24.0000 PERCE
32
MVS Commands from Java
33
Actions and Overtypes (Rexx)
• Syntax:
Address SDSF “ISFACT SDSF-command
TOKEN((stemname) | token.1, token.2, … ,
token.n) PARM(parms) (options”
34
Actions and Overtypes - continued
PARM(parms)
• Describes the action or modification Change
Changeboth
both
• PARM(OCLASS A FORMS 1234) class
class&&forms
forms
• PARM(NP C)
Use
UseNP
NPfor
foraction
actioncharacters
characters
35
Example - Change Output Forms
isfprefix=“**” Set
Setfilters
filters
isfowner=“RJONES”
Access
AccessOOpanel
panelto
toset
setvariables
variables
Address SDSF “ISFEXEC O”
do ix=1 to JNAME.0 Find
Findaarow
rowwith
withjob
jobname
nameBOBBOB
if pos(“BOB”,JNAME.ix) = 1 then
do
Address SDSF “ISFACT O TOKEN(‘”TOKEN.ix“’)
PARM(FORMS 1234)”
end Use
Usethe
thetoken
tokenfor forthat
that
row
rowto
toidentify
identifyit,it,
end Change
Change enclosing
enclosingititininsingle
single
forms
forms quotes
quotes
36
Actions (Java)
37
Overtypes (Java)
38
Overtypes (Java) …
// Change job class to class A
// Build column name array
String[ ] propName = { "jclass" };
// Build column value array
String[ ] propValue = { "a" };
// Change the job class
statObj.requestPropertyChange(propName, propValue);
39
Browse Job Data Sets (Rexx)
40
Example: Browse Job Data Sets
41
Browse Job Data Sets (Java)
42
IBM Presentation Template Full Version
SDSF/Rexx SYSLOG/OPERLOG
43
IBM Presentation Template Full Version
Java SYSLOG/OPERLOG
OR
44
ISFLOG Allocate Example
rc=isfcalls(“on”)
Allocate
Allocatethe
thelogical
logicalSYSLOG
Address SDSF “ISFLOG ALLOCATE” SYSLOG
do ix=1 to isfddname.0
Loop
Loopthrough
throughDD
DDnames
names
"EXECIO 10 DISKR" isfddname.ix "(FINIS STEM log."
do jx=1 to log.0
Read
Readcontents
contentsinto
intolog.
log.stem
stemvariable
variable
Say mid "log."jx "is:" log.jx
end
end Report
Reportthe
thelog
logdata
data
rc=isfcalls(“off”)
45
ISFLOG Read Example
rc=isfcalls(“on”)
Read
Readthe thelogical
logicalSYSLOG
SYSLOGinto
into the
the
Address SDSF “ISFLOG READ” isfline.
isfline.stem
stem
do ix=1 to isfline.0
Report
Reportthe
thelog
logdata
data
Say mid "isfline."left(ix,5)":" isfline.ix
end
rc=isfcalls(“off”)
46
ISFLOG Special Variables
• isflinelim / settings.addISFLinelim
• Specifies the maximum number of variables to be created
• Default is no limit
• isflinelim=10000 / settings.addISFLineLim(10000)
• Create a maximum of 10,000 variables
48
ISFLOG Read Example By Time/Date
rc=isfcalls(“on”)
Set time and date parameters
Set time and date parameters
isfdate="mmddyyyy /"
currday=date("C")
currday=currday-1 /* yesterday */
isflogstartdate=date("U",currday,"C") /* yesterday in mm/dd/yy */
isflogstarttime=time("N") /* current time */
isflogstopdate=date("U") /* current date in mm/dd/yy */
isflogstoptime=time("N") /* current time */
Set
Setmaximum
maximumnumber
numberofofvariables
variablestotocreate
create
isflinelim=1000
do ix=1 to isfmsg2.0
Report
Reportany
anymessages
messages
Say isfmsg2.ix
end
rc=isfcalls(“off”)
50
Java LOG Read Example By Time/Date
// Get date formatters for the time and date
•final Calendar calendar = Calendar.getInstance();
•final DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
•final DateFormat timeFormat = new SimpleDateFormat("hh:mm:ss");
•// Set the start and stop times to limit records obtained
•ISFRequestSettings settings = new ISFRequestSettings();
•settings.addISFLogStartTime(timeFormat.format(today));
•settings.addISFLogStartDate(dateFormat.format(yesterday));
•settings.addISFLogStopTime(timeFormat.format(today));
•settings.addISFLogStopDate(dateFormat.format(today));
•settings.addISFDate(“mmddyyyy /”);
•settings.addISFLineLim(1000);
Set
Setmaximum
maximumnumber
numberofoflines
linestotocreate
create
51
Java LOG Read Example By Time/Date
•ISFLogRunner runner = new ISFLogRunner(settings);
Read
Readthe
theSYSLOG
SYSLOG
•// Read the system log This
•runner.readSyslog(); This example alsoworks
example also worksifif
you
youspecify
specifyreadOperlog()
readOperlog()
•ISFRequestResults results = runner.getRequestResults();
•results.printMessageList(System.err);
Report
Reportany
anymessages
messages
results.printResponseList(System.out);
Report
Reportthe
thelog
logdata
data
52
Avoiding Duplicate Variable Names (Rexx)
Needed when accessing the job data set panel, so that column
variables don’t conflict
53
Example: Using the PREFIX Option
Address SDSF “ISFACT ST TOKEN(‘”TOKEN.ix”’) PARM(NP ‘?’)
(PREFIX jds_)”
Access
AccessJDSJDSusing
usingNP
NP??and
anddefine
defineaa
prefix
prefixfor
forall
allJDS
JDSvariables.
variables.
do jx=1 to jds_DDNAME.0
say “DSName is” jds_DSNAME.jx
Say “Stepname is” jds_STEPN.jx References
Referencesto tovariables
variables
Say “Procstep is” jds_PROCS.jx all
allinclude
includethe
theprefix
prefix
end
54
isfreset() Function
• Not as interesting in Java as each runner can have its own unique
ISFRequestSettings and ISFRequestResults objects
• settings.reset() and results.reset() to clear them
55
Using SDSF with SYSREXX
56
Security
57
Security – Assigning a User to a Group
58
Diagnosing Problems
59
Diagnosing Problems (cont.)
60
COLSHELP
• Context sensitive
• Lists only columns for the panel
• COLSH on DA lists only DA columns
• Option to display all values
62
Java samples
63
Installing Javadoc
64
Javadoc example (web browser)
65
Javadoc example (RSA)
66
References
• Issue the REXXHELP command while using SDSF under ISPF
• Issue the SEARCH command while using SDSF under ISPF
• SDSF Web page, which will include examples for use with ISPF’s
MODEL command:
http://www.ibm.com/servers/eserver/zseries/zos/sdsf/
• Redbook!
• Loaded with interesting examples and experiences
67
SDSF REXX Redbook
http://www.redbooks.ibm.com/abstracts/sg247419.html
Abstract:
This IBM Redbooks publication describes the new
support and provides sample REXX execs that exploit
the new function and that perform real-world tasks
related to operations, systems programming, system
administration, and automation.
68
SDSF REXX Redbook - Topics
69
SDSF REXX Redbook - Examples
70
SDSF REXX Redbook - Examples
71
Summary
• Rexx • Java
• Use ISFCALLS to enable • Point CLASSPATH and
“Address SDSF” LIBPATH to SDSF libraries
• Use ISFEXEC to access • Use runners and exec()
SDSF data method to access SDSF data
• Use isfxxxx special variables • Use ISFRequestSettings
to set up parameters object to set up parameters
• Use isfxxxx special variables • Use ISFRequestResults
to check results object to check results
• Use stem variables to access • Use list of row objects to
row and column data access row and column data
• Use ISFACT TOKEN(token) • Use methods on row objects
PARM(xx) for actions and for actions and overtypes
overtypes
72