IBM eServer iSeries 8 CopyrightIB M Corporation, 2005. A llRightsReserved. Thispublication m ay referto productsthatare notcurrently available in yourcountry. IBM m akesno com m itm entto m ake available any productsreferred to herein. theast Michigan iSeries User Group – January 26, 2006 Introducing... The IBM Toolbox for Java Kim Button – [email protected]
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
IBM eServer iSeries
8 Copyright IBM Corporation, 2005. All Rights Reserved.
This publication may refer to products that are not currently available in your country. IBM makes no commitment to make available any products referred to herein.
Southeast Michigan iSeries User Group – January 26, 2006
Trademarks and Disclaimers8 IBM Corporation 1994-2005. All rights reserved.References in this document to IBM products or services do not imply that IBM intends to make them available in every country.
The following terms are trademarks of International Business Machines Corporation in the United States, other countries, or both:
Rational is a trademark of International Business Machines Corporation and Rational Software Corporation in the United States, other countries, or both.Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the United States, other countries, or both. Intel, Intel Inside (logos), MMX and Pentium are trademarks of Intel Corporation in the United States, other countries, or both.UNIX is a registered trademark of The Open Group in the United States and other countries.SET and the SET Logo are trademarks owned by SET Secure Electronic Transaction LLC. Other company, product or service names may be trademarks or service marks of others.
Information is provided "AS IS" without warranty of any kind.
All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and performance characteristics may vary by customer.
Information concerning non-IBM products was obtained from a supplier of these products, published announcement material, or other publicly available sources and does not constitute an endorsement of such products by IBM. Sources for non-IBM list prices and performance numbers are taken from publicly available information, including vendor announcements and vendor worldwide homepages. IBM has not tested these products and cannot confirm the accuracy of performance, capability, or any other claims related to non-IBM products. Questions on the capability of non-IBM products should be addressed to the supplier of those products.
All statements regarding IBM future direction and intent are subject to change or withdrawal without notice, and represent goals and objectives only. Contact your local IBM office or IBM authorized reseller for the full text of the specific Statement of Direction.
Some information addresses anticipated future capabilities. Such information is not intended as a definitive statement of a commitment to specific levels of performance, function or delivery schedules with respect to any future products. Such commitments are only made in IBM product announcements. The information is presented here to communicate IBM's current investment and development activities as a good faith effort to help with our customers' future planning.
Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance 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 or performance improvements equivalent to the ratios stated here.
Photographs shown are of engineering prototypes. Changes may be incorporated in production models.
All of the primary Toolbox packages are open source! http://jt400.sourceforge.net
Part of IBM's open source development communityUse source as a debug toolSubmit new function under the IBM Public License (IPL)Modify source for your useSubmit problem reports and bug fixes
Two versions of the Toolbox:Licensed program
Supported by IBMOnly IBM developed code
Open source versionSupported by open source communityNow officially supported by IBM Service!Includes source from non-IBM contributorsNew functions and fixes available here first!
Popular Toolbox Functions Database access via JDBCDatabase access via a record-level I/O and DDS interfaceCommand CallProgram Call via both Java code and XMLData Queues / User Spaces / Data AreasAccess files in iSeries Integrated File SystemAccess Print object (spooled files, printers, queues, ...)Access iSeries objects (Jobs, Users, System Values, etc.)Built-in automatic data conversionHTML / Servlet wrappersWireless APIsXML-based GUI Builder Components are Java Beans
Each new connection to the server can be an expensive operationPooling means reusing AS400 objects - i.e. keeping the connection open for laterSaves frequent disconnects and reconnectsCommon scenario: servlets
ƒ Without pooling: Create a new AS400 object for each invocation of the servletƒ With pooling: Grab a preconnected AS400 object from the pool for each invocation of the
servlet, return it when done!Connections will be added as needed
pool.returnConnectionToPool(connection); Connection pool
AS400ConnectionPool pool = new AS400ConnectionPool(); pool.setMaxConnections(128); // Preconnect 5 connections to the AS400.COMMAND service. pool.fill("myAS400", "myUserID", "myPassword", AS400.COMMAND, 5);
Access records sequentially, by record number, or by key
Physical and logical file members are described by a RecordFormat
Support for locking
Support for transactions
Familiar paradigm for RPG programmers
Limited System/36 SSP file capability, too!
AS400 system = new AS400("mySystem"); SequentialFile file = new SequentialFile(system, "/QSYS.LIB/MYLIB.LIB/MYFILE.FILE"); file.setRecordFormat(...); file.open(...); Record r = file.readNext();
Record-level database access Fast access to i5/OS database files
AS400 system = new AS400(); CommandCall cc = new CommandCall(system); cc.run("CRTLIB NEWLIB");
AS400 system = new AS400(); ProgramParameter[ ] parmList = new ProgramParameter[n]; parmList[0] = new ProgramParameter(data); ... ProgramCall pc = new ProgramCall(system, "/QSYS.LIB/MYLIB.LIB/MYPGM.PGM", parmList); pc.run();
Command call and program call Make use of legacy code and system APIs
// Create a DataQueue object to represent a specific data queue.AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");DataQueue dq = new DataQueue(system, "/QSYS.LIB/MYLIB.LIB/MYQUEUE.DTAQ");
// If it doesn't exist, create it.if (!dq.exists()){ dq.create(1024); // Entry length is 1KB}
while (someCondition == true){ // Wait forever until an entry appears on the queue, then read it. DataQueueEntry entry = dq.read();
// Process the entry's data. String information = entry.getString();
}
// Create a DataQueue object to represent a specific data queue.AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD");DataQueue dq = new DataQueue(system, "/QSYS.LIB/MYLIB.LIB/MYQUEUE.DTAQ");
// If it doesn't exist, create it.if (!dq.exists()){ dq.create(1024); // Entry length is 1KB}
// Write something to the queue.// The other process will read it.dq.write("Some useful information.");
// When all done with the queue, delete it.dq.delete();
BinaryFieldDescription customerNumber = new BinaryFieldDescription(new AS400Bin4(), "CUSTOMER_NUMBER"); CharacterFieldDescription customerName = new CharacterFieldDescription (new AS400Text(20, system), "CUSTOMER_NAME"); RecordFormat recordFormat = new RecordFormat(); recordFormat.addFieldDescription(customerNumber); recordFormat.addFieldDescription(customerName); Record data = recordFormat.getNewRecord(dataQueue.read().getData()); Integer I = (INTEGER) data.getField("CUSTOMER_NUMBER"); String name = (String) data.getField("CUSTOMER_NAME");
Data description and conversion Record formats
Access data in the record by field name
Convert data automatically for:Program callsData queuesRecord-level database access
HTMLTableConverter converter = new HTMLTableConverter();
ResultSet resultSet = statement.getResultSet(); SQLResultSetRowData rowdata = new SQLResultSetRowData(resultSet);
String[ ] html = converter.convert(rowdata); out.println(html[0]);
HTML and Servlet classes Web components create tables and forms
Provides access to database files:Access database file with Record Level Access or SQL via JDBCIncludes Meta Data
Provides classes to display data:Display data in tables or formsToolbox provides converters that will produce HTML tables or forms based on the row data
IFSJavaFile root = new IFSJavaFile(systemObject, "/QIBM");
DirFilter filter = new DirFilter();
File[] dirList = root.listFiles(filter);
for (int i=0; i<dirList.length; i++) { FileTreeElement node = new FileTreeElement(dirList[i]); tree.addElement(node); }
HTML and Servlet classes Web components create tree hierarchy
Provides classes to display the Integrated File System:Display contents of the Integrated File SystemToolbox provides classes to create and display a customized and traversable tree
Supports all ILE languages: C, C++, RPG, Java, Cobol, CLPoint and click breakpoint manipulation in source codeAutomatic variable evaluation with mouse and local variable displayProgram call stack and thread display
Available via PTF for V5R1 (5722-SS1 SI02871 and 5722-JC1 SI02849) Requires JDK1.3 and tes.jar, jt400.jar, and jhall.jar
Invoke with following: java utilities.DebugMgr or java utilities.Debug -s system -u user
Now available at http://www.ibm.com/servers/eserver/iseries/toolbox/Other new classes
JDBC 3.0 enhancementsJDBC performance improvementsExtended Program Call Markup Language (XPCML)System distribution directory entriesSave FileIFSFileSystemViewAdditional classes have been open-sourced
PlusCL command documentation generatorKerberos authentication is now supported through the use of JGSSPerformance improvements in list processing (users, jobs, etc.)Additional code pages (e.g. GB18030)
http://www.ibm.com/servers/eserver/iseries/toolbox/News, downloads, FAQs, service packs, articles, COMMON labs
http://jt400.sourceforge.net/JTOpen - open source, bug reporting, feature requests
http://www.ibm.com/servers/eserver/support/iseries/index.htmliSeries Technical Forums - including IBM Toolbox for Java/JTOpen Forum
IBM Toolbox for Java Programmers Guide Shipped with the IBM Toolbox for JavaContains overview, full API documentation (javadoc), and code examplesAvailable in the iSeries Information CenterLink off of the Toolbox home page
Building AS/400 Client/Server Applications with JavaRedbook SG24-2152-02