about us: strongback consulting ibm advanced business partner – rational, websphere, lotus,...
TRANSCRIPT
THE CAFFEINATEDMAINFRAMER
www.strongback.us
About Us: Strongback Consulting• IBM Advanced Business Partner
– Rational, WebSphere, Lotus, Information Management SVP certified
– Strongly focused on Enterprise Modernization, Agile Transformations, and DevOps
– Key Industries Served: Finance, Insurance, Healthcare, Manufacturing, Government
– Rational Design Partner for HATS and other Rational enterprise modernization technologies
Discover us at:http://www.strongback.us
Subscribe to us athttp://blog.strongbackconsulting.com
Socialize with us on Facebook & LinkedIn http://www.facebook.com/StrongbackConsulting
http://www.linkedin.com/company/290754
www.strongback.us
3
Your Instructor
• Kenny Smith
– Principal Consultant @ Strongback Consulting
– Developed courses for multiple Rational IDE’s
– Past speaker at IBM’s RSDC, Innovate, and InterConnect, and N. FL Rational User Group
– Major projects: Multiple RDz rollouts, several large systems modernizations, many custom development gigs
– Languages: Java, COBOL, VB, HTML, XML, SQL, JavaScript, Perl, Python, JACL
– http://about.me/smithkenny
www.strongback.us
4
What is Java?
• Platform neutral programming language
• Concurrent, class-based, and object oriented
• Most similar to C/C++ syntax
• Compiled into bytecode, which is run by a Java Virtual Machine
– Write once, run anywhere
www.strongback.us
5
Why Java on System z?
Abundance of Java and Java skills zAAP Processors - cost effective
workload management Combining of traditional batch with
modern frameworks Access to MVS using the JZOS API
www.strongback.us
6
Abundance of Java
• #1 Programming language – Tiobe– September 2015
– C ranks #2 (frequently trades places with Java)
– COBOL ranks #20
– Assembler ranks #11
• Ubiquity of architectural frameworks
– Unit testing, relational object mapping, security, dependency injection, etc.
www.strongback.us
7
Java Frameworks
Don't reinvent the wheel, just
realign it.Anthony J.
D'Angelo, The College Blue Book
JAX-WS
www.strongback.us
8
zAAP Processors – Cost Effective Solution
• A specialty z processor engine
• Attractively priced execution environment for web apps
• Simplifies and reduces server infrastructures
• Maximizes the value of your mainframe investments
• Lowers the overall cost of computing for WebSphere Application Server and other Java
• JIT on the z has greatly increased performance on the z.
www.strongback.us
9
Where does Java run?
• The JVM runs in Unix System Services (USS)
• Source code can be compiled anywhere
• Class and jar files written to USS directories for running in the JVM
• Workloads on Java are qualified to run on zAAP processor
www.strongback.us
10
z/OS
z/OS UNIX with Open Systems Interfaces
HFS
UNIXSystemServices
zFS
zFS
WLM
SMF
Language Environm
ent(LE
)
API(C Functions)
Interactive Shell(commands)
www.strongback.us
z/OS Unix Files
• Found in Remote Systems View
• z/OS Unix Files section
– Home = your home folder in OMVS
• Typically /u/username
– Root = / (zFS system root folder)
– Filters = everything else
• You specify the settings for the filter
• z/OS Unix shells
– Open one or more Unix shells
– Each shell separate from each other
www.strongback.us
13
RAD And Java
• Like RDz, built on Eclipse
• Can “shell share” with RDz, providing more features than either alone
– CICS Web Service Development
– Can also shell share with Data Studio
• Highly effective editors, wizards, and visualization tools
• Includes Java code review tools (Software Analyzer)
• Designed to handle Java EE development
– Wizards for web development (JSF, JSP, Struts, etc.)
– Database development (SQL editors, JPA wizards)
– WebSphere Application Server environment
www.strongback.us
RDz Enterprise Tools: Unit Testing
JUnit: A unit test framework for Java
• Built into RAD / Eclipse
• Tests either pass or fail
www.strongback.us
15
RDz Enterprise Tools: Software Analysis
• Allows you to run a static analysis of the resources with which you are working to detect violations of rules and rule categories.
• Detects violations of specific programming rules and rule categories and generates a report in the Software Analyzer Results view
• Code can be viewed in a single interface to analyze each component in a multi-language application…. Java, Cobol and others.
www.strongback.us
Rational Developer for the Enterprise 9.5
Rational Developer for the Enterprise
Rational Application
Developer for WebSphere Software 9.0
Rational Application Developer
Rational Developer for System z 9.5
Rational Developer for
System z
Rational Developer for AIX and Linux
9.5
C/C++ Edition
AIX COBOL Edition
Rational Developer for i 9.5
RPG and COBOL Tools
RPG and COBOL + Modernization Tools, Java
Edition
RPG and COBOL + Modernization Tools, EGL
Edition
Rational Business Developer
Rational Business
Developer 9.5
Rational Business Developer
www.strongback.us
Comparing Language Features
Java
• Portable – write once run anywhere
• Object Oriented
• Connect to CICS via web services
• No binding of DB2 required
• Not column sensitive (> 80 chars)
• Case Sensitive
• Strongly typed
• Can be multi-threaded
COBOL
• Syntax specific to compiler (IBM vs Microfocus, etc.)
• Procedural
• Call CICS directly
• Must bind DB2
• Column sensitive
• Not case sensitive
• Considered non-typed
• Single threaded
www.strongback.us
18
Unique Java Language Features
• Object oriented: Polymorphism, Inheritance, Composition, Encapsulation
• Garbage Collection: automated memory management
• Secure
• Interpreted: compiled to bytecode, and bytecode executed by JVM
• Objects and Classes
• Case Sensitive!
– i.e. Customer != customer
www.strongback.us
20
Organizing Code: Packages vs PDS
Java: Packages COBOL: PDS’s
www.strongback.us
21
Instantiating Variables
Javapublic class YieldInfo(){
BigDecimal startBalance;
BigDecimal yield;
BigDecimal interest;
int days;
int years;
}
COBOL01 yield-info.
03 start-balance pic 9(9)v9(2) comp.
03 yield pic 9(9)v9(2) comp.
03 interest pic v9(7) comp.
03 days pic 9(9) comp.
03 years pic 9(2) comp.
www.strongback.us
Example Conversion
• COBOL Copybook • Java Class
www.strongback.us
Java Primitive Data Types
23
Data Type Size (in bits for numeric)
Default Value (for fields)
byte 8 0
short 16 0
int 32 0
long 64 0L
float 32 floating point 0.0f
double 64 floating point 0.0d
char 16 (Unicode) '\u0000'
boolean 1 false
Anything else is considered an Object!
www.strongback.us
24
Other Common Data Types
• Integer – object wrapper for int
• Long – object wrapper for long
• Short – object wrapper for short
• String – object wrapper for char
• BigDecimal - complex object that handles currency
– NEVER EVER EVER use floating point arithmetic for currency!!!
www.strongback.us
25
Typical Java Class Structure
• Package (1)
• Import statements (3)
• Class declaration (5)
• Class variables (6-8)
• Constructors (10, 13)
• Methods (20, 28)
www.strongback.us
26
General Syntax
calls the Team default
constructor
class name
instance variable name
class variable
Statements end in
semicolon
Code blocks are surrounded by braces
www.strongback.us
28
Windows
z/OS
Accessing Data, and Systems
DB2
MSSQLCICS
AIX
Java (Batch)
MQ
JMS
JDBC
JDBC
Web Service
www.strongback.us
29
Accessing DB2 Data
• Accessing z/OS DB2 Data is no different than Java on distributed
• JPA Wizards – Java Persistence Architecture
– Makes CRUD operations a breeze!
– Hardly any SQL has to be written
• JDBC – Java Database Connectivity
– Old school SQL method
• Other open source frameworks
– iBatis, Hibernate, Spring JDBC Templates, etc.
www.strongback.us
30
JZOS Java API for developers
• API = Application Programming Interface
• A framework acquired by IBM & now part of the IBM JVM
• Preferred method for MVS file access, data type conversion, MVS Console, etc.
• Includes a batch launcher
• Uses JNI / C to access MVS datasets, VSAM files, QSAM files, etc.
www.strongback.us
Unix System Services
JZOS API
MVS
Calling JZOS Batch
JVMLDMxx
JZOS PROC
JZOS JCL
Java Runtime
Java class
PDS
JES
MC
Programmer writes and
submits the JCL
www.strongback.us
JZOS JCL Skeleton
Job Card
Location of the JVM Proc
Execute the generic proc with vars
Location of the output
Java shell environment setup
www.strongback.us
Java Generic PROC
• A parameterized procedure makes it easier to standardize the environment
• A sample is included in the JDK for z/OS
• Found under /usr/lpp/java/J7.0_64/mvstools/samples/jcl
– Good for most usage, customize for a given specific instance
www.strongback.us
34
Robust
Approaches to Java Batch
• JCL launches batch program
• Programmer may still need to code functions not provided by Launcher
• Example is z/OS Batch Container
• Batch Container provides useful functions
• Programmer may still need to code functions not provided by Container
• Example is IBM WebSphere Compute Grid
• Provides batch programming function as services of the platform
• Allows programmer to focus on the business logic and not develop "custom middleware" function
JZOS JVM Launcher
z/OS Batch Container
WebSphere Batch
www.strongback.us
35
Tools for Modern Java Batch(aka ComputeGrid)• Brings compute and data intensive batch processing to WAS,
sharing the same business logic used by online systems.
• Framework and tools make writing, running and managing batch applications a snap.
• Java EE based packaging and deployment.
• Projects, wizards and editors streamline the development of xJCL and batch classes.
• Deploy and submit to WAS, with job progress integrated into the IDE’s console.
Batch workspace project
xJCL App
WAS
Container
WAS
Scheduler
Workbench: RAD WDT Eclipse
Has Capability? (Y, N, Partial)
Y N N
www.strongback.us
36
Where Can I Learn More?
• Strongback Consulting’s Course Offerings:
– RDz COBOL, RDz Java (JZOS), RAD, HATS
• Our blog http://blog.strongbackconsulting.com
• All our JZOS specific links: https://delicious.com/strongback/search/jzos
• Rational software links: https://delicious.com/strongback/search/rational
• Java generic links: https://delicious.com/strongback/search/java
*** Delicious.com is a bookmark sharing site. It may be blocked by your IT department, but allows us to share more links than we have room to list here
www.strongback.us
Socialize with us on Facebook & LinkedIn http://www.facebook.com/StrongbackConsulting
http://www.linkedin.com/company/290754
Subscribe to us athttp://feeds.feedburner.com/StrongbackConsulting
Discover us at:http://www.strongback.us
Watch Us at Youtube http://www.youtube.com/user/strongbackconsultinghttps://vimeo.com/user7519232
Call us at: 386-232-8746
www.strongback.us
Class API Overview:
• Access MVS Datasets
– com.ibm.jzos.Zfile – thin wrapper for JNI calls to C I/O library
– com.ibm.jzos.FileFactory - platform-portable file access
• Access HFS/zFS files
– java.io, java.nio – standard Java API
– com.ibm.jzos.FileFactory
• Access the MVS Console
– com.ibm.jzos.MvsConsole – interface to MVS console and job log
• Various z/OS native functions
– com.ibm.jzos.ZUtil
www.strongback.us
Calling Java in batch
• BPXBATCH
– The “original” batch java caller.
– Best to run non-Java shell commands on Unix System Services
– The STDOUT and STDERR DD names are not allocated as MVS data sets
• JZOS
– The modern batch caller
– Uses a specific JVM load module
www.strongback.us
JZOS Batch
• Jobs are zAAP eligible
• IDE Integration with RDz, RAD
• Can run Java based servers as started tasks
• Full integration into the Job Entry System
• Jobs run in the same address space
• Support for DD statements
• Move stdin, stdout, and stderr to an MVS Dataset
• Gives a valid return code (other than just 1)