IBM Rational products
This chapter describes the latest Rational products for IBM Power Systems Software™ and IBM i, and covers the following topics:
16.1 IBM Rational Developer for i
IBM Rational Developer for i is an integrated development environment (IDE) built on the Eclipse platform. It is designed for creating and maintaining applications on IBM i systems. It is on the developer’s desktop, supporting development in both host-connected and disconnected modes. It supports development of RPG, COBOL, C, C++, SQL, and CL applications on IBM i, including the DDS (for instance display and printer files).
The current version of IBM Rational Developer for i product is V9.0. This version is built on Eclipse V4.2.2.
16.1.1 IBM Rational Developer for i 9.0 Editions
IBM Rational Developer for i 9.0 is available in three editions:
RPG and COBOL Tools edition
The RPG and COBOL Tools edition allows development of RPG, COBOL, C, C++, SQL, and CL applications on IBM i, using Remote System Explorer and debugger. IDE is able to connect to IBM i V6.1.x and V7.1.
RPG and COBOL + Modernization Tools, Java edition
The RPG and COBOL + Modernization Tools, Java edition contains all the features of the RPG and COBOL Tools edition, plus it contains a rich subset of IBM Rational Application Developer for WebSphere Software offering, including the following functions:
 – Support of Java development
 – Support of the WebSphere Application Server Liberty profile
 – Enhancements to tools for developing web and mobile web application front ends
This edition also includes IBM Data Studio. There is an IBM Worklight® Studio 6.0 to support development of hybrid mobile applications. This combined set of tools provides capabilities for developing multitier, enterprise mobile applications that integrate with back-end systems deployed on IBM i.
 
Note: This edition of IBM Rational Developer for i is a replacement of the IBM Power Tools feature of the former IBM Rational Developer for Power Software V8.x.
RPG and COBOL + Modernization Tools, EGL edition
The RPG and COBOL + Modernization Tools, EGL edition contains all features of the RPG and COBOL Tools edition, plus it contains the functions of the Rational Business Developer 9.0, which is the EGL development tools.
This edition is a replacement of IBM Developer for i for SOA Construction 8.x.
 
Note: The RPG and COBOL + Modernization Tools, EGL edition does not include the HATS toolkit as the former IBM Developer for i for SOA Construction 8.x product did. However, the HATS toolkit 9.0 can be downloaded at no additional charge from this website:
These three editions of IBM Rational Developer for i represent the evolutions of products that were previously marketed under the following names:
IBM Rational Developer for Power Systems Software RPG and COBOL Tools for i V8.x
IBM Rational Developer for Power Systems Software Power Tools for i v8.x
IBM Rational Developer for i for SOA Construction v8.x
When used in combination with IBM i compilers (which is part of the 16.3, “IBM Rational Development Studio for i” on page 640 and 16.2, “IBM Rational Team Concert” on page 632), IBM Rational Developer for i provides a comprehensive application development environment, including compilers, development tools, and collaborative application lifecycle management.
The following sections focus on Rational Developer for i features for the IBM i platform:
16.1.2 RPG and COBOL development tools
Rational Developer for i offers the following RPG and COBOL development tools:
Remote System Explorer
The Remote System Explorer, which is shown in Figure 16-1 on page 624, is an enhanced and more flexible workstation version of the Programming Development Manager. It is a workbench perspective that provides access to all development resources of your IBM i server. The Remote System Explorer is able to search and manage server-side files and run server scripts.
Remote System Explorer allows effective management and organization of IBM i through these features:
Remote Connection to IBM i server
Manage IBM i objects
Manage library lists
Manage jobs
Manage commands and shells
Manage user actions
Manage objects in “Object Table View”
Editing, compiling, and debugging applications
Figure 16-1 Remote System Explorer
IBM i Projects
IBM i Projects, which is shown in Figure 16-2 on page 625, allows for disconnected development. A network connection is required only when code updates or a build are needed, or when you must view remote resources for a project.
In disconnected mode, you work on files locally, and upload them to the server after you finish. Working in disconnected mode, you can still check source code for syntax and semantic error and connect only to submit a compile when you are ready to create the program object.
Figure 16-2 IBM i Projects
Application Diagram
Application Diagram provides a graphical view of the different resources in an IBM i native application and their relationships to each other.
There are two different diagrams that you can look at in the Application Diagram view:
Source Call Diagram
This diagram takes ILE RPG, ILE COBOL, and CL sources as input and displays a call graph that shows the subroutine and procedure calls.
Program Structure Diagram
This diagram takes program and service program objects as input and displays the binding relationships between them and the modules that are bound to each program and service program.
Screen Designer
Screen Designer is now an official component. It provides the capability to graphically design and modify the content of DDS display files. Screen Designer, shown in Figure 16-3, provides an integrated palette for easy access to design items, and a preview page.
Figure 16-3 Screen Designer
Report Designer
You can use the Report Designer to graphically design and modify the content of DDS printer files. The Report Designer window provides an integrated palette for easy access to design items.
You can use the Report Designer to group individual records and see how this group of records will appear on the printed page. In addition, you can specify default data for each output field, and specify which indicators are on or off.
Integrated i Debugger
You can use Integrated i Debugger to debug an application that is running on an IBM i system. It provides an interactive graphical interface that makes it easy to debug and test your IBM i programs.
Integrated i Debugger provides many program debugging control features, including breakpoints setup, watching variables, step through program instructions, examining variables, and examining the call stack.
16.1.3 Modernization tools
Modernization tools contain the following features (examples):
Complete IDE for IBM i programming languages based on the Eclipse environment that allows integration of plug-ins for other programming languages and development tools.
Support for the latest version of the WebSphere Application Server Liberty profile.
New enhancements to tools for developing web and mobile web application front ends.
Web Services wizards (for RPG/COBOL/HATS) to refactor/wrap IBM i business logic.
IBM i Web Services and Java Tools
You can use IBM i web development tools to create new e-business applications that use a web-based front end to communicate with the business logic in an ILE or non-ILE language program on an IBM i server.
The Web Services wizard works in the context of a web project and allows for creation, deployment, testing, generation of a proxy, and publication to a Universal Description, Discovery, and Integration (UDDI) registry of Web Services.
 
Note: The IBM i Web Services and Java Tools are part of Rational Developer for i 9.0 - RPG and COBOL + Modernization Tools, Java edition. Web Services wizards can be found in Modernization Tools in both Java and EGL editions.
16.1.4 Java tools
Java tools contain the following features (examples):
Complete Eclipse-based IDE for Java/JEE
Servlets
SOA (Web Services, SCA)
Full Java Platform, Enterprise Edition Development
JSF
Web/Web 2.0 SOA (Web Services, SCA)
All Java tools are optimized for WebSphere Application Server runtimes.
16.1.5 EGL tools and IBM Rational Business Developer V9.0
EGL tools contain the following features (examples):
Complete IDE for EGL development (IBM Rational Business Developer 9.0 functionality)
Limited Java and web development
IBM Rational Business Developer is an Eclipse-based integrated development environment (IDE) that simplifies the development of service-oriented architecture (SOA) applications using the Enterprise Generation Language (EGL).
Developers can now deliver web, Web 2.0, and mobile applications and services without having to master Java and SOA programming. This allows them to create, test, and debug EGL applications while generating Java, JavaScript, or COBOL code for deployment. RPG and COBOL developers can change to EGL easily because it allows them to create portable applications with modern architectures and user interfaces, without having to learn concepts of object-oriented languages.
Following are the main features of IBM Rational Business Developer (and also EGL tools):
EGL transformation
 – Transforms EGL source into Java, JavaScript, or COBOL code that is optimized for deployment to application hosting environments that include Java EE servers and traditional transactional systems.
 – Streamlines development by using a single, high-level language for complete development of the business application.
 – Generates different languages for a single application, such as JavaScript for an application user interface and Java or COBOL for the application back end.
 – Increases productivity and reduces the technology learning curve to improve business agility and competitiveness.
Simplified service creation
 – Simplifies service creation, concealing the technical complexity of SOA. Multiplatform deployment deploys applications and services on many platforms either as web services or natively.
 – Provides built-in service constructs and a facility for service generation, allowing business-oriented developers to create SOA applications without extensive training.
 – Creates EGL services and automates generation of web services from EGL services.
 – Supports development and deployment of services to IBM WebSphere Application Server on multiple platforms.
 – Allows developers to work within the familiar Eclipse-based environment using their existing development skills.
UML support
 – Supports Unified Modeling Language (UML) to EGL transformations, allowing complex applications to be modeled graphically.
 – UML supports a model-driven approach that streamlines the creation of Java and Web 2.0 applications and services.
 – UML supports the implementation of EGL services.
 – UML supports full Create, Read, Update, Delete applications without the need for manual coding.
Extensible platform
 – Integrates with several IBM products to extend support for IBM i and expand software lifecycle functionality.
 – Extends existing IT assets and provides the extensibility, scalability, and productivity features of an Eclipse-based platform.
 – Integrates with IBM Rational Developer for i for SOA Construction and IBM Rational Software Architect.
For more information about EGL, see the following websites:
EGL Cafe:
IBM Rational Business Developer Version 9.0 Knowledge Center:
16.1.6 Rational Team Concert client integration for IBM i
Rational Developer for i provides support for integration with the Rational Team Concert™ client for IBM i.
When Rational Developer for i is used in combination with IBM Rational Development Studio for i compilers and Rational Team Concert, it provides a comprehensive application development environment, including compilers, development tools, and collaborative application lifecycle management.
For more information about Rational Team Concert, and integration with Rational Developer i, see 16.2, “IBM Rational Team Concert” on page 632.
 
Requirement: The IBM Rational Team Concert V4.0.3 client product must be installed before you install the client integration.
16.1.7 Version 9.0 fix packs
Information about any required Power Systems server PTFs can be found by completing the following steps in IBM Rational Developer for Power Systems Software:
1. Open the Remote System Explorer perspective by clicking Window  Open Perspective → Other → Remote System Explorer.
2. Create a connection to your IBM i by expanding New Connection and double-clicking IBM i.
3. In Remote System Explorer, expand your connection, right-click Object, and click Verify Connection, as shown in Figure 16-4.
Figure 16-4 Verify connection
4. A window opens that shows which required PTFs are installed on the system and which ones are missing, as shown in Figure 16-5.
Figure 16-5 Verify PTFs
For information about the latest product fix packs, see the Rational Developer for Power Systems Software Support website (Downloads tab):
16.1.8 Migration to Rational Developer for i v9.0
You can upgrade projects to Rational Developer for Power Systems v9.0 from previous versions. The migration process is seamless and transparent; you must use only your existing workspace and continue working with your projects with the new software version.
Upgrade to v9.0 can be done through Rational Developer for Power i. Migration is supported from Version 7.5.x, Version 7.6.x, Version 8.0.x, and Version 8.5.x.
Migration of projects from earlier releases is not supported because of additional features that were added.
16.1.9 Upgrades to Rational Developer for i v9.0
IBM Rational Developer for i Version 9.0 introduces new repackaging of Rational Products that are used for IBM i development, and products that are used for AIX/Linux on Power development.
Upgrades are possible from the following products:
IBM Rational Developer for Power Systems v8.x
IBM Rational Developer for i for SOA Constructions v8.x
Table 16-1 shows the basic upgrade paths.
Table 16-1 Basic upgrade paths
Original V8.x product
Product Feature
Upgrade to
IBM Rational Developer for Power Software
RPG and COBOL Tools
IBM Developer for i v9.0, RPG and COBOL Tools Edition
IBM Rational Developer for Power Software
Power Tools
IBM Developer for i v9.0, RPG and COBOL + Modernization Tools, Java Edition
IBM Rational Developer for i for SOA Construction
N/A
IBM Developer for i v9.0, RPG and COBOL + Modernization Tools, EGL Edition
IBM Rational HATS Toolkit is not included in any of the editions of IBM Rational Developer for i v9.0. It is available at no additional charge to download from the following website:
A full HATS runtime license must be purchased to be able to run applications that are modernized by IBM Rational Host Access Transformation Toolkit v9.0. This has not changed from older versions of Rational Developer tools.
Other features of IBM Rational Developer for Power Software (for example COBOL, C/C++, Power Tools for AIX, or Linux) can be upgraded to IBM Rational Developer for AIX and Linux v9.0.
16.2 IBM Rational Team Concert
The Rational solution for Collaborative Lifecycle Management (CLM) provides integrations across the Change and Configuration Management, Requirements Management, and the IBM Quality Management Jazz™-based applications, to connect the work of analysts with development and test teams.
Rational Team Concert is the core of the Rational CLM solution. Rational Team Concert is a team collaboration tool that supports cross-platform development and features native hosting of the Jazz Team Server. Rational Team Concert includes an integrated set of collaborative software delivery lifecycle tools for development, including source control, change management, and build and process management.
Rational Team Concert is offered for several platforms including IBM i, AIX, z/OS, Red Hat (RHEL) and SUSE (SLES) Linux distributions, and Windows 2003 and 2008 Server. Implementations can have different limitations on different platforms. Such limitations are described in the Rational System Requirements webpage. For example, for latest 4.0.3 and 4.0.4 versions of Rational Team Concert, see the following website:
 
Note: For access to jazz.net webpages, you must register yourself.
Rational Team Concert has an open, extensible architecture that supports a broad range of desktop clients, IDEs, languages, and platforms, as shown in the Rational Team Concert architecture diagram in Figure 16-6.
Figure 16-6 Rational Team Concert architecture
16.2.1 Integration with Rational Developer for i
Rational Team Concert integrates with Rational Developer i to provide IBM i developers an integrated collaborative application development environment. This integrated solution provides the value of the team collaboration capabilities of Rational Team Concert with the individual development environment of Rational Developer for i product.
Using Rational Team Concert and Rational Developer for i together, software development teams can develop IBM i applications using the tools that are provided by Rational Developer for i and the planning, team collaboration, build, source control management, defect tracking, and deployment tools that are provided by Rational Team Concert.
Using the IBM i Projects perspective available with Rational Developer for i, Rational Team Concert and Rational Developer for i work together so that you can share and modify files that are managed by Jazz based source control, in addition to files on the remote IBM i system.
Installing and configuring the integration
Additional Installation and configuration steps are required to integrate Rational Developer for Power Systems Software and Rational Team Concert.
You can install the two products in two different ways by using IBM Installation Manager:
Installing the two products at the same time or in the following order:
a. Install Rational Team Concert.
b. Install Rational Developer for i with Rational Team Concert client integration for IBM i feature.
Installing the products in the following order:
a. Install Rational Developer for i.
 
Remember: You cannot install the Rational Team Concert client integration for IBM i feature because the feature is not available if Rational Team Concert is not yet installed.
b. Install Rational Team Concert.
c. Start IBM Installation Manager and use the Install option to add Rational Team Concert client integration for IBM i feature to Rational Developer for i product, as shown in Figure 16-7.
Figure 16-7 Installing Rational Team Concert Support for RDi v9.0
Sharing i Projects in Rational Team Concert
Sharing IBM i Projects in Rational Team Concert is no different from sharing any other type of Eclipse project. You can manage IBM i source code with the IBM i Projects feature.
To make your IBM i Project available to other team members, complete the following steps:
1. From the menu for your i Project, click Team → Share Project, as shown in Figure 16-8.
Figure 16-8 Share IBM i project
2. Select Jazz Source Control, as shown in Figure 16-9, and click Next.
Figure 16-9 Jazz Source Control Repository
3. Specify the repository workspace to use.
4. Click Finish.
 
Consideration: If your IBM i Project contains any file types or folders that are ignored by Eclipse, the wizard prompts you to review them.
The IBM i Project is now added to a component in a repository workspace. Changes that you make in the i Project are copied to the repository workspace when you check them in.
16.2.2 What is new in the latest releases of Rational Team Concert
Several releases of IBM Rational Team Concert can be used together with other Rational tools to develop applications for IBM i 7.1.
For version 3, there are v3.0.0, 3.0.1 releases, and for version 4 there are v4.0.1, 4.0.2, 4.0.3, and 4.0.4 releases. Each release provides new functions and interoperability to the Rational Team Concert product.
For the latest information, see the following websites:
As shown in Figure 16-10, select the version/release you are interested in (for example 4.0.4).
Figure 16-10 Rational Team Concert webpage showing releases
On the web page shown in Figure 16-11, click New and Noteworthy.
Figure 16-11 Rational Team Concert V4.0.4 News
16.2.3 Rational Team Concert and other Rational products interoperability
Rational Team Concert is a composition of numerous features and functions. It has its versioning scheme, different from other Rational Development Tools such as IBM Rational Developer for i, IBM Rational Business Developer, IBM Rational Developer for Power Software (RDP), or IBM Rational Application Developer for WebSphere Software.
The support is mainly based on the version of the Eclipse environment, Rational Team Concert clients support, and the version of Rational Development Tools. Table 16-2 can be used as initial rough reference of interoperability.
Table 16-2 General interoperability table for Rational Team Concert and RDi/RDP products versions
Rational Team Concert Version
Supported Eclipse Environments
Supported version of Rational Development tools
4.0.3/4.0.4
Eclipse 3.6.2.3+/3.7.2+/4.2+
Version 9.0,
4.0.1/4.0.2
Eclipse 3.7.2/3.6.2
Version 8.5, 8.5.1
3.0.0/3.0.1
Eclipse 3.5.2/ 3.5.1/3.6.2
Version 8.0
 
Attention: Because Rational Team Concert is a rich set of functions and Rational Development products are generally complex, it is necessary to go to the actual requirements for individual Rational Team Concert and Rational Development products. There are many other factors like Eclipse version, JVM used, and server and client requirements. It is usually necessary to verify compatibility of all functions.
Following are some interesting Rational Team Concert requirements websites:
System requirements for Collaborative Lifecycle Management 4.0.3 and 4.0.4
System requirements for the Rational Collaborative Lifecycle Management 4.0.1 and 4.0.2
System requirements for Rational Team Concert 3.0.1.x, Rational Quality Manager 3.0.1.x, and Rational Requirements Composer 3.0.1.x (and Jazz Foundation 3.0.1.x)
IBM Software products installed together that share a common environment
Limitations for sharing a common environment between IBM products based on Eclipse
16.2.4 General links for more information about Rational Team Concert
For more information about Rational Team Concert, see the following websites:
Projects on jazz.net
Wiki that includes tutorials and articles on various topics
End to end tutorial
ALM on IBM developerWorks
16.3 IBM Rational Development Studio for i
IBM Rational continues to have a tight collaboration with IBM Systems Technology Group (STG), IBM Software Group (SWG), and IBM Research Group to provide compilers that use the underlying hardware and operating systems for the Power architecture. The RPG, COBOL, C, and C++ ILE compilers for IBM i are enhanced for IBM i 7.1 with new features and functions. On April 13, 2010, the WebSphere Development Studio for IBM i was rebranded into Rational Development Studio for i (5770-WDS), as illustrated in Figure 16-12.
Figure 16-12 Rebranding the WebSphere Development Studio product
Application Development ToolSet (ADTS) and Original Program Model (OPM) Compilers were previously stabilized. However, Rational Development Studio for i V7.1 does include enhancements for the ILE RPG and ILE COBOL compilers.
16.3.1 Source code protection option
Protecting your code is essential. Unfortunately, there are times when one of your customers encounters a problem. The easiest way to figure out the problem is to put a version of your code onto the system that can be debugged. However, this leaves your code unprotected. You can either expose your code or figure out another way to diagnose the problem.
In Version 7.1, the ILE compilers (RPG, COBOL, CL, C, and C++) and precompilers have a new parameter that you can use to encrypt your debug views. You can send code that can be debugged and know that your code is not exposed.
With the DBGENCKEY compiler option, you can specify the encryption key that is used to encrypt the program source that is embedded in debug views. The debugger requires the user to enter the debug encryption key before the views are decrypted. The length of the key can be 1 - 16 bytes. A key of length of 1 - 15 bytes is padded to 16 bytes with blanks for the encryption. Specifying a key of length zero is the same as specifying *NONE. If the key contains any characters that are not invariant over all code pages, the user must ensure that the target system uses the same code page as the source system. Otherwise, the key might not match and decryption might fail. If the encryption key must be entered on systems with different code pages, the key must be made of characters from the (EBCDIC) invariant character.
To use this capability to protect data source code and at the same time allow the usage of the debug view, complete the following steps:
1. Encrypt the debug view so that the debug view is only visible if the person knows the encryption key by running the following command:
CRTBNDRPG MYPGM DBGENCKEY(‘my secret code’)
2. Then, either run STRDBG MYPGM DBGENCKEY(‘my secret code’) or STRDBG MYPGM and wait to be prompted for the encryption key.
16.3.2 ILE RPG IV compiler and programming language
The following list details the ILE RPG compiler enhancements available with Rational Development Studio for i V7.1:
XML processing support with new ILE RPG options for XML-INTO for improved flexibility
Increased developer productivity with ILE RPG built-in support for searching and sorting data structure arrays
New built-in functions
Support for ALIAS names
Optional prototypes
Implicit parameter conversion between alphanumeric, USC-2, and graphic data types
 
Important: For customers using Source Entry Utility (SEU) to edit the ILE RPG source, the syntax checkers do not recognize any features that were added after V6R1. All new and subsequent updates to the ILE RPG IV language will be made only for Rational Developer for i product. They will not be available in ADTS SEU editor.
ILE RPG IV as a modern programming language
The following changes have been made to the ILE RPG IV language:
ILE RPG IV language now supports more free form RPG specifications. Today all specifications except for I and O (no longer used) are supported as free format.
Embedded SQL statements can be now used in free format.
There is no need for use of /FREE .... /END-FREE in almost every procedure.
Better token-colorization in the RDi editor (RDi - Rational Developer for i v9.0), allowing programmers to have the same look-and-feel for RPG code as for other languages like Java or PHP.
Currently, there are several goals for current and future development of the RPG language:
Interoperability
 – Java
 – XML
 – SQL
Readability
 – Free form
 – Blank lines
 – Comments
Functionality
 – Procedures
 – Data areas
 – Data structures
 – More data types
 – Extended file support
Modern tooling
 – Rational Developer for i
Figure 16-13 shows an example ILE RPG program before the latest enhancements and updates.
Figure 16-13 OPM IBM RPG/400® (RPG III) from OS/400 V2R3
Figure 16-14 shows the example ILE RPG program after the latest V5R3 ILE RPG updates.
Figure 16-14 ILE RPG Program example as it looked after V5R3 ILE RPG updates
Figure 16-15 shows the example ILE RPG program after the latest V7R1 ILE RPG enhancements.
Figure 16-15 ILE RPG program example as it looks after latest V7.1 ILE RPG enhancements
The following article describes the free-form RPG:
Figure 16-16 shows a picture of modern RPG possibilities and tools today.
Figure 16-16 Modern RPG development environment and tools
For more information about RPG, see the following RPG Café website:
New options for XML-INTO
There are two new options for XML-INTO (also available through a PTF for IBM i 6.1):
datasubf You can use this option to name a subfield that receives the text data for an XML element that also has attributes. Here is an example:
<emp type=“regular” ID=“13573”>John Smith</emp>
countprefix This option reduces the need for you to specify the allowmissing=yes option. It specifies the prefix for the names of the additional subfields that receive the number of RPG array elements or non-array subfields that are set by the XML-INTO operation.
New options for XML-INTO are shown in Example 16-1.
Example 16-1 New options for XML-INTO
D* RPG coding to get the information with one XML-INTO operation:
D* xml file content: <emp type=“regular” id=“13573”>John Smith</emp>
 
D emp ds
D id 7p 0
D type 10a
D value 100a
/free
XML-INTO emp %xml(‘emp.xml’ :
: ‘datasubf=value doc=file’);
// emp.id = 13573
// emp.type = ‘regular’
// emp.value = ‘John Smith’
16.3.3 Sorting and searching data structures
You can sort and search data structure arrays using one of the subfields as a key, as shown in Example 16-2.
Example 16-2 Sort and search data structures
#Sort a data structure array using one subfield as a key
// sort by name
SORTA info(*).name;
// sort by due date
SORTA info(*).dueDate;
 
#Search a data structure array using one subfield as a key
// search for a name
pos = %LOOKUP(‘Jack’ : info(*).name);
 
// search for today’s date
pos = %LOOKUP(%date() : info(*).dueDate);
An array can be sorted in ascending order by using SORTA(A) and descending order by using SORTA(D). The array cannot be a sequenced array (ASCEND or DESCEND keyword), as shown in Example 16-3.
Example 16-3 Sort an array in descending order
//Sort the salary in descending order
SORTA(D) salary;
New and updated built-in functions
Several updated built-in functions can help simplify string management tasks:
%SCANRPL Scans and replaces values.
%LEN Gets and sets variable lengths.
%PARMNUM Gets the parameter position.
The %SCANRPL built-in function scans for all occurrences of a value within a string and replaces them with another value, as shown in Example 16-4.
Example 16-4 %SCANRPL
// Replace NAME with 'Tom'
string1 = 'See NAME. See NAME run. Run NAME run.';
string2 = %ScanRpl('NAME' : 'Tom' : string1);
// string2 = 'See Tom. See Tom run. Run Tom run.'
The %LEN function can be used with a new optional second parameter *MAX to obtain the maximum number of characters for a varying-length character, UCS-2, or Graphic field.
The %PARMNUM built-in function returns a parameter’s position in the parameter list, as shown in Example 16-5.
Example 16-5 %PARMNUM
CEEDOD (2 : more parms); // hard to understand
CEEDOD (%PARMNUM(city) : more parms); // better
Soft-coding the parameter’s number makes the code easier to read and maintain.
16.3.4 ALIAS support
The prototypes are supported on D specs for any externally described data structure. There is the following ALIAS support:
As shown in Example 16-6, you can use the ALIAS keyword on a Definition specification to indicate that you want to use the alternative names for the subfields of externally described data structures.
You can use the ALIAS keyword on a File specification to indicate that you want to use the alternative names for LIKEREC data structures that are defined from the records of the file.
Example 16-6 ALIAS keyword
A R CUSTREC
A CUSTNM 25A ALIAS(CUSTOMER_NAME)
A CUSTAD 25A ALIAS(CUSTOMER_ADDRESS)
A ID 10P 0
 
D custDs e ds ALIAS
D QUALIFIED EXTNAME(custFile)
/free
custDs.customer_name = 'John Smith';
custDs.customer_address = '123 Mockingbird Lane';
custDs.id = 12345;
Optional prototypes
If a program or procedure is not called by another RPG module, it is optional to specify the prototype. The prototype can be omitted for the following types of programs and procedures:
A program that is intended to be used only as an exit program or as the command-processing program for a command.
A program that is intended to be called only from another programming language.
A procedure that is not exported from the module.
A procedure that is exported from the module but intended to be called only from another programming language.
Here are some programs and procedures that do not require a prototype:
An exit program, or the command-processing program for a command
A program or procedure that is never intended to be called from RPG
A procedure that is not exported from the module
Example 16-7 shows an example of an optional prototype.
Example 16-7 Optional prototypes
H main(hello)
P hello b
D pi extpgm('HELLO')
D name 10a const
/free
sayHello();
...
 
P sayHello b
/free
dsply ('Hello ' + name);
Implicit Unicode conversion for parameters
Implicit CCSID conversion is now supported for prototyped parameters that are passed by VALUE and by a read-only reference (CONST). This conversion reduces the number of code changes that must be made when a database field is changed from alphanumeric or DBCS to Unicode (UCS-2 or UTF-16).
In Example 16-8, there is only a “makeTitle” procedure with a UCS-2 parameter and a return value. If the passed parameter is alpha or DBCS, it is converted to UCS-2 on the call. The procedure works with the UCS-2 parameter and returns a UCS-2 value. This returned value can then be converted on assignment to alpha or DBCS, if necessary.
Example 16-8 Implicit Unicode conversion for parameters
// makeTitle() upper-cases the parameter
// and centers it within the provided length
 
alphaTitle = makeTitle(alphaValue : 50);
ucs2Title = makeTitle(ucs2Value : 50);
dbcsTitle = makeTitle(dbcsValue : 50);
16.3.5 Performance improvement when returning large values
To obtain faster return values, you can now define a procedure with the RTNPARM keyword (see Example 16-9) to handle the return value as a hidden parameter. The RTNPARM keyword applies both to a prototype definition and to a procedure-interface definition.
Example 16-9 RTNPARM keyword
D getFileData pr a varying len(1000000)
D rtnparm
D file a const varying len(500)
D data S a varying len(1000)
D file a const varying len(500)
D data S a varying len(1000)
/free
data = getFileData ('/home/mydir/myfile.txt'),
When a procedure is prototyped to return a large value, especially a large varying value, the performance for calling the procedure can be improved by defining the procedure with this keyword.
The impact on performance because of the RTNPARM keyword varies from having a small negative impact to having a large positive impact. There can be a small negative impact when the prototyped return value is relatively small, such as an integer, or a small data structure. There is improvement when the prototyped return value is a larger value, such as a 32767-byte data structure. The performance improvement is most apparent when the prototyped return value is a large varying length string, and the actual returned value is relatively small. For example, the prototype defines the return value as a 1 million byte varying length character string, and the value 'abc' is returned.
Using RTNPARM for a procedure prototype can also reduce the amount of automatic storage that is required for other procedures that contain calls to that procedure. For example, if procedure MYCALLER contains a call to procedure MYPROC that returns a large value, procedure MYCALLER requires more automatic storage (even if MYCALLER does not call procedure MYPROC at run time). In certain cases, procedure MYCALLER cannot compile because of excessive automatic storage requirements; in other cases, MYCALLER is not able to be called because the total automatic storage on the call stack exceeds the maximum. Using RTNPARM avoids this problem with additional automatic storage.
 
RTNPARM considerations:
The additional parameter is passed as the first parameter.
The %PARMS and %PARMNUM built-in functions include the additional parameter in the parameter count. When the RTNPARM keyword is specified, the value that is returned by %PARMNUM is one higher than the apparent parameter number.
When you call APIs that require a parameter number, such as CEEDOD or CEETSTA, you must account for the additional first parameter. For example, if your procedure has three parameters, and you want to find the length of the third parameter as it appears in your parameter list, you must ask for information about the fourth parameter. If you use the %PARMNUM built-in function to return the correct parameter number for calling these APIs, you do not need to worry about manually determining the correct parameter number.
When the calling procedure is written in a language other than RPG, the caller must code the call as though the procedure has no return value and there is an additional first parameter that is passed by reference with the same type as the RPG return value.
Similarly, when the called procedure is written in a language other than RPG, the procedure must be coded without a return value, and having an additional first parameter that is passed by reference with the same type as the RPG return value.
When RTNPARM is specified for the procedure, the maximum number of prototyped parameters is 398.
The RTNPARM keyword is not allowed for a Java method call.
Teraspace storage model
 
Definition: Teraspace is a large temporary space that is local to a job. A teraspace provides a contiguous address space but might consist of many individually allocated areas, with deallocated areas in between. Teraspace exists no longer than the time between job start and job end. A teraspace is not a space object, which means that it is not a system object, and that you cannot refer to it by using a system pointer. However, teraspace is addressable with space pointers within the same job.
The teraspace storage model has the following features:
Much higher limits for automatic storage.
Can compile *CALLER programs with STGMDL(*INHERIT) so that they can be called from either single-level or teraspace programs.
RPG’s %ALLOC and %REALLOC can allocate teraspace with a much higher limit.
Teraspace allocations are the default in the teraspace storage model.
You can specify H-spec ALLOC(*TERASPACE) to have teraspace allocations in any storage model.
16.3.6 ILE COBOL compiler
Here are the ILE COBOL compiler enhancements available with Rational Development Studio for i V7.1:
The new COMP-5 data type is supported.
You can use a non-numeric literal in the VALUE clause for a national data item.
There are new PROCESS statement options:
 – ACTGRP
This option is now available as a PROCESS statement parameter with the option values of STGMDL, NEW, or CALLER.
 – NEVEROPTIMIZE
This option is now available as a PROCESS statement option.
 – STGMDL
This option is now available as a PROCESS statement parameter with the option values of INHERIT, SNGLVL, or TERASPACE.
 – XMLGEN
This option is now available as a PROCESS statement parameter with the option values of NOKEEPFILEOPEN / KEEPFILEOPEN or NOASSUMEVALIDCHARS / ASSUMEVALIDCHARS.
 
Using SEU: For customers using SEU to edit ILE COBOL source, the syntax checkers do not recognize any features that were added after V6R1.
COMPUTATIONAL-5 or COMP-5 now supported
COBOL supports the COMP-4 binary type, which does not handle the full range of the binary value. For example, a 2 byte COMP-4 supports values -9999 - 9999, when a 2-byte integer supports values -32768 - 32767. The NOSTDTRUNC process option can be specified to force all COMP-4 values to be treated as true integers.
The COMP-5 type is a true integer. This type is a native binary data type that is supported by the USAGE clause. COMP-5 data items are represented in storage as binary data, and can contain values up to the capacity of the native binary representation (2, 4, or 8 bytes).
When numeric data is moved or stored into a COMP-5 item, truncation occurs at the binary field size rather than at the COBOL picture size limit. When a COMP-5 item is referenced, the full binary field size is used in the operation.
COMP-5 is supported by COBOL on IBM System z®. This support enhances portability to or from COBOL on other IBM platforms and operating systems.
Table 16-3 shows the equivalent SQL data types for the COBOL COMP-5 data type.
Table 16-3 SQL equivalent data types
COBOL data type
SQL data type
SQL description
01 name PIC S9(4) COMP-5.
SMALLINT
16-bit signed integer
01 name PIC S9(9) COMP-5.
INTEGER
32-bit signed integer
01 name PIC S9(18) COMP-5.
BIGINT
64-bit signed integer
Allows programmers to include a debug view with their application that is only visible with an encryption key.
OPTIMIZE(*NEVER) support to compile large programs
The new COBOL compiler command parameter OPTIMIZE(*NEVER) allows large COBOL programs to be compiled. This parameter is present in both CRTBNDCBL and CRTCBLMOD
CL commands.
The PROCESS option NEVEROPTIMIZE is also added, and can be specified within the COBOL source file.
OPTIMIZE(*NEVER) and NEVEROPTIMIZE reduces the size of the generated code by preventing the COBOL compiler from generating the information necessary to optimize the program.
Teraspace storage model
The storage model for a program or module can now be specified using the new CRTBNDCBL or CRTCBLMOD parameter STGMDL with the following values:
*SNGLVL
This value specifies that the program / module is to be created with a single-level storage model.
*TERASPACE
This value specifies that the program / module is to be created with the teraspace storage model.
*INHERIT
This value specifies that the program / module is to inherit the storage model of its caller so that they can be called from either single-level or teraspace programs.
Additionally, the activation group parameter ACTGRP on the CRTBNDCBL command now has a new default option value. When you specify STGMDL(*TERASPACE), the program is activated in the QILETS activation group. For all other storage models, the program is activated in the QILE activation group when it is called.
XML GENERATE performance improvements
Performance improvements were made for XML GENERATE when the APPEND option is specified. Users who have many data records to be appended to a data structure or to a stream file benefit from these changes. The improvements include the addition of the new PROCESS statement parameter XMLGEN with the following option values:
NOKEEPFILEOPEN / KEEPFILEOPEN
Specify KEEPFILEOPEN to indicate that the XML stream file is to be left open and not closed when the XML GENERATE statement is complete. This allows subsequent XML GENERATE FILE-STREAM APPEND statements to quickly append data to the stream file.
NOASSUMEVALIDCHARS / ASSUMEVALIDCHARS
Specify ASSUMEVALIDCHARS to have XML GENERATE bypass the checking for special characters (less than “<", greater than “>”, ampersand “&”, and the single and double quotation mark symbols), and for characters that are not supported by XML that must be generated as hexadecimal. Otherwise, normal checking is done with the default NOASSUMEVALIDCHARS.
Example 16-10 shows the usage of a PROCESS statement with XML GENERATE.
Example 16-10 Improved performance for XML GENERATE
PROCESS XMLGEN(KEEPFILEOPEN).
...
* write out XML records to the stream file
perform until DONE = 1
read MYFILE next record into CUST-INFO
...
xml generate file-stream 'cust.xml' append from cust-info
end-perform.
* close the stream file
xml generate file-stream 'cust.xml' from cust-info.
16.3.7 ILE C and ILE C++
For ILE C and ILE C++ compilers, the following additions and modifications were made in IBM i 7.1:
ILE C/C++ predefined macros
do_not_instantiate and namemanglingrule pragmas
ILE C++ decimal floating-point support
ILE C++ compiler other enhancements
 – __func__ predefined identifier.
 – Hexadecimal floating-point literals
 – Variable length arrays
 – Empty arguments for function-like macros
 – Variable number of arguments for function-like macros
For more information about Rational Development Studio for i, go to:
Predefined macros
These macros can be grouped either for C or for C++. Most of them are new, and others were modified.
C macros
Here are the predefined macros for C:
__C99_CPLUSCMT indicates support for C++ style comments. You can define it when the LANGLVL(*EXTENDED) compiler option is in effect.
__IBMC__ indicates the version of the C compiler. It returns an integer of the form VRM, where V represents the version, R the release, and M the modification level. For example, using the IBM i 7.1 compiler with the TGTRLS(*CURRENT) compiler option, __IBMC__ returns the integer value 710.
__ILEC400__ indicates that the ILE C compiler is being used.
__ILEC400_TGTVRM__ is functionally equivalent to the __OS400_TGTVRM__ macro.
__SIZE_TYPE__ indicates the underlying type of size_t on the current platform. For IBM i, it is unsigned int.
C++ macros
Here are the predefined macros for C++:
__BOOL__ indicates that the bool keyword is accepted.
__cplusplus98__interface__ can be defined when the LANGLVL(*ANSI) compiler option is specified.
__C99_COMPOUND_LITERAL indicates support for compound literals and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__C99_FUNC__ indicates support for the __func__ predefined identifier and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__C99_HEX_FLOAT_CONST indicates support for hexadecimal floating constants and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__C99_PRAGMA_OPERATOR indicates support for the _Pragma operator and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__C99_RESTRICT indicates support for the C99 restrict qualifier and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__C99_VARIABLE_LENGTH_ARRAY indicates support for variable length arrays and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__IBMCPP__ indicates the version of the AIX Xpertise Library C++ compiler upon which the ILE C++ compiler is based. It returns an integer that represents the compiler version. For example, using the IBM i 7.1 compiler with the TGTRLS(*CURRENT) compiler option, __IBMCPP__ returns the integer value 900, which means the ILE C++ compiler is based on the Xpertise Library C++ V9.0 compiler.
__IBM__ALIGN indicates support for the __align specifier.
__IBM_ATTRIBUTES indicates support for type, variable, and function attributes and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__IBM_COMPUTED_GOTO indicates support for computed GOTO statements and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__IBM_EXTENSION_KEYWORD indicates support for the __extension__ keyword and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__IBM_LABEL_VALUE indicates support for labels as values and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__IBM_LOCAL_LABEL indicates support for local labels and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__IBM_MACRO_WITH_VA_ARGS indicates support for variadic macro extensions and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__NO_RTTI__ can be defined when the OPTION(*NORTTI) compiler option is in effect.
__OPTIMIZE__ indicates the level of optimization in effect. The macro is undefined for OPTIMIZE(10). For other OPTIMIZE settings, the macro is defined with 2 for OPTIMIZE(20), 3 for OPTIMIZE(30) and 4 for OPTIMIZE(40).
__RTTI_DYNAMIC_CAST__ can be defined when the OPTION(*RTTIALL) or OPTION(*RTTICAST) compiler option is specified.
__RTTI_TYPE_INFO__ can be defined when the OPTION(*RTTIALL) or OPTION(*RTTITYPE) compiler option is specified.
C and C++
Here are the predefined macros for C and C++:
__BASE_FILE__ indicates the fully qualified name of the primary source file.
__IBM_DFP__ indicates support for decimal floating-point types and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__IBM_INCLUDE_NEXT indicates support for the #include_next preprocessing directive.
__IBM_TYPEOF__ indicates support for the __typeof__ or typeof keyword. This macro is always defined for C. For C++, it is defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__IFS_IO__ can be defined when the SYSIFCOPT(*IFSIO) or SYSIFCOPT(*IFS64IO) compiler option is specified.
__IFS64_IO__ can be defined when the SYSIFCOPT(*IFS64IO) compiler option is specified. When this macro is defined, _LARGE_FILES and _LARGE_FILE_API are also defined in the relevant IBM-supplied header files.
__LONGDOUBLE64 indicates that the size of a long double type is 64 bits. This macro is always defined.
LONG_LONG indicates support for IBM long long data types and can be defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__POSIX_LOCALE__ can be defined when the LOCALETYPE(*LOCALE), LOCALETYPE(*LOCALEUCS2), or LOCALETYPE(*LOCALEUTF) compiler option is specified.
__UCS2__ can be defined when the LOCALETYPE(*LOCALEUCS2) compiler option is specified.
__UTF32__ can be defined when the LOCALETYPE(*LOCALEUTF) compiler option is specified.
__C99_MACRO_WITH_VA_ARGS indicates support for function-like macros with variable arguments. It is defined when the LANGLVL(*EXTENDED) compiler option is in effect.
__DIGRAPHS__ indicates support for digraphs.
Pragmas
The #pragma preprocessor directive allows each compiler to implement compiler-specific features that can be turned on and off with the #pragma statement. The do_not_instantiate and namemanglingrule pragmas are included in IBM i 7.1.
do_not_instantiate
The #pragma do_not_instantiate directive suppresses the instantiation of a specified entity. It is typically used to suppress the instantiation of an entity for which a specific definition is supplied. If you are handling template instantiations manually (that is, compiler options TEMPLATE(*NONE) and TMPLREG(*NONE) are in effect), and the specified template instantiation exists in another compilation unit, using #pragma do_not_instantiate ensures that you do not get multiple symbol definitions during the link step.
namemanglingrule
Name mangling or name decoration is a technique that is used to solve various problems that are caused by the need to resolve unique names for programming entities. You can use it to encode additional metadata information in the name of a function, structure, class, or another data type to pass more semantic information from the compilers to linkers. Most of the time, you need it when the language allows entities to be named with the same identifier if they occupy another namespace, which is typically defined by a module, class, or explicit namespace directive.
The #pragma namemanglingrule directive provides fine-grained control over the name mangling scheme in effect for selected portions of source code, specifically regarding the mangling of cv-qualifiers in function parameters. You can use it to control whether top-level cv-qualifiers are mangled in function parameters or whether intermediate-level cv-qualifiers are considered when the compiler compares repeated function parameters for equivalence.
 
Definition: cv stands for constant and volatile.
ILE C++ decimal floating-point support
Decimal (the classic day-to-day base 10) data is widely used in commercial and financial applications. However, most computer systems have only binary (base two) arithmetic, using 0 and 1 to represent numbers. There are two binary number systems in computers: integer (fixed-point) and floating-point. Unfortunately, decimal calculations cannot be directly implemented with binary floating-point. For example, the value 0.1 needs an infinitely recurring binary fraction, but a decimal number system can represent it exactly as one tenth. So, using binary floating-point cannot ensure that results are the same as those using decimal arithmetic.
In general, decimal floating-point operations are emulated with binary fixed-point integers. Decimal numbers are traditionally held in a binary-coded decimal (BCD) format. Although BCD provides sufficient accuracy for decimal calculation, it imposes a heavy cost in performance because it is usually implemented in software.
IBM POWER6 and POWER7 processor-based systems provide hardware support for decimal floating-point arithmetic. POWER microprocessor core includes the decimal floating-point unit that provides acceleration for the decimal floating-point arithmetic.
ILE C++ compiler enhancements that are available with Rational Development Studio for i V7.1 include decimal floating-point support. The support has the following features:
Allows floating-point computations to be performed by using decimal arithmetic (base 10).
Avoids potential rounding errors when you convert binary floating-point data to / from human readable formats.
Conforms to the decimal formats and arithmetic that is described in the IEEE 754-2008 Standard for Floating-Point Arithmetic.
Adds support to the ILE C++ compiler, which is based on Draft Technical Report 24732 submitted to the ISO/IEC JTC1/SC22/WG14 Programming Language C committee.
New data types:
 – _Decimal32, 4 bytes, 7 digits precision, and -95/+96 exponent
 – _Decimal64, 8 bytes, 16 digits precision, and -383/+384 exponent
 – _Decimal128, 16 bytes, 34 digits precision, and -6143/+6144 exponent
Provides conversions to / from C++ built-in data types, such as integers and binary floating-point types
Includes the DECFLTRND option for the C++ compiler commands (CRTCPPMOD and CRTBNDCPP) to control compile-time decimal floating-point rounding mode.
ILE C/C++ compile-time round options
With the DECFLTRND compiler option, you can specify the compile-time rounding mode for the evaluation of constant decimal floating-point expressions. This option does not affect the runtime decimal floating-point rounding mode, which is set using the setca built-in function.
Here are the possible values for this option:
*HALFEVEN
This setting is the default setting. It rounds to the nearest value, but, when in a tie, it chooses an even number. For example, 5.22 rounds to 5.2, 5.67 rounds to 5.7, and 5.55 and 5.65 round to 5.6.
*DOWN
This value rounds toward zero, or truncates the result. For example, 5.22 rounds to 5.2, 5.67 rounds to 5.6, 5.55 rounds to 5.5, and 5.65 rounds to 5.6.
*UP
This value rounds toward away from zero. For example, 5.22 rounds to 5.3, 5.67 rounds to 5.7, 5.55 rounds to 5.6, and 5.65 rounds to 5.7.
*HALFUP
This value rounds toward to the nearest value and, in a tie, rounds away from zero. For example, 5.22 rounds to 5.2, 5.67 rounds to 5.7, 5.55 rounds to 5.6, and 5.65 rounds to 5.7.
*HALFDOWN
This value rounds toward to the nearest value and, in a tie, rounds toward zero. For example, 5.22 rounds to 5.2, 5.67 rounds to 5.7, 5.55 rounds to 5.5, and 5.65 rounds to 5.6.
*FLOOR
This value rounds toward negative affinity. For example, 5.22 rounds to 5.2, 5.67 rounds to 5.6, 5.55 rounds to 5.5, and 5.65 rounds to 5.6.
*CEILING
This value rounds toward positive infinity. For example, 5.22 rounds to 5.3, 5.67 rounds to 5.7, 5.55 rounds to 5.6, and 5.65 rounds to 5.7.
16.4 IBM Rational Open Access: RPG Edition
Rational Open Access: RPG Edition provides a way for RPG programmers to use the simple and well-understood RPG I/O model to access resources and devices that are not directly supported by RPG.
Open Access opens RPG’s file I/O capabilities, allowing anyone to write innovative I/O handlers to access other devices and resources, such as:
Browsers
Mobile devices
Cloud-computing resources
Web services
External databases
XML files
Spreadsheets
An Open Access application has three parts:
1. An RPG program that uses normal RPG coding to define an Open Access file and use I/O operations against the file.
2. A handler procedure or program that is called by Open Access to handle the I/O operations for the file.
3. The resource or device that the handler is using or communicating with.
Open Access is the linkage between parts 1 and 2. Licensed program 5733-OAR is required to use Open Access at run time.
Figure 16-17 illustrates the three parts of an Open Access for RPG solution.
Figure 16-17 Rational Open Access: RPG Edition
Open Access does not provide handlers. A handler can be customer-developed or it can be provided by another provider, such as an ISV. The following list details the characteristics of a handler:
A handler is a program or a procedure in a service program.
A handler can be a generic handler that can handle any file of that device type, or it can be a handler that is specifically written to handle a particular “file”.
A handler is not required to support every operation that RPG allows for that type of file. If the handler does not support a specific operation, then the RPG programmer must not code that operation. For example, for a PRINTER file, if the handler does not support the Force-End-Of-Data operation, then the RPG programmer does not code an FEOD operation for the file.
16.4.1 How to use Rational Open Access
There are two ways to use Rational Open Access: RPG Edition:
Handler After
Handler First
The following two sections describe how each approach is done.
Handler After
The handler is written after the application is written. For example, an existing application that uses 5250 display files is modified to use Open Access for the WORKSTN files, where:
The RPG program is modified by adding the HANDLER keyword to the WORKSTN files.
The handler must handle all the operations and requirements of the existing
RPG program.
This type of handler is often provided by an outside expert, such as a software tool vendor or IBM Business Partner.
Handler First
The handler is written before the application is written. For example, the RPG programmer wants to use a web service that returns information for a specific set of criteria, where:
The handler provider creates a keyed database file that matches the web service.
The handler provider can tell the RPG programmer what I/O operations that the handler supports.
The RPG programmer codes the RPG program, using the file as an externally described keyed DISK file, with the HANDLER keyword to identify the Open-Access handler.
The handler uses externally described data structures that are defined from the same file.
This type of handler can be written by the same RPG programmer who uses the Open Access file, or it can be provided by an outside expert.
Open Access Example
Example 16-11 illustrates a web service that provides the weather based on City Name.
Example 16-11 Web service example
* Define the Open I/O file to use handler cityWeather
* in service program WEBSVCS/CITYWTHR
FweatherF IF E K DISK HANDLER('WEBSVCS/CITYWTHR(cityWeather)' (2) and (3)
F : commArea)
F EXTDESC('WEBSVCS/CITYWTHR') (4)
* Data structure to receive the weather information
D weatherDs ds likerec(wthrRec)
* Definitions for communication-area parameter that allows the RPG
* programmer to communicate directly with the handler
/copy WEBSVCS/QRPGLESRC,CITYWTHR
D commArea ds likeds(cityWeatherComm_t)
/free
// set up communication area parameter; Programmer is telling
// handler to deliver temperature in Celcius
commArea.temperatureUnit = CITYWTHR_CELCIUS;
// the CHAIN operation will call the handler
chain ('Chicago') wthrRec weatherDs; (1)
if %found;
// process the data in weatherDs
Where:
1. A city name is input as a key.
2. An RPG keyed DISK “file” is used as the interface to the web service.
3. The handler provider chooses to handle OPEN, CLOSE, and CHAIN.
4. The handler provider puts all the required objects into library WEBSVCS, including:
 – A service program that contains the handler procedure
 – A binding directory for the RPG program to locate the service program with the handler
 – A /copy file to define the handler-specific information
An RPG program using PF CITYWTHR defines records and key information.
The following actions then occur:
1. RPG implicitly opens the “file” and calls handler cityWeather to handle the
CHAIN operation.
2. The handler sets up information that is needed by the handler-specific data structure so that it can handle the CHAIN operation correctly. In this case, perhaps a socket to the web service URL is used.
3. When the RPG program does a CHAIN operation, RPG calls the handler again to handle the CHAIN operation.
4. After the handler returns, RPG determines the value of %FOUND according to the feedback from the handler.
5. When the RPG program ends with LR on, RPG implicitly closes the file and calls the handler again to handle the CLOSE operation. The handler closes the socket to the web service URL.
The handler service program uses PF CITYWTHR to define the records and key information, as shown in Example 16-12.
Example 16-12 Handler service program
H NOMAIN
/copy WEBSVCS/QRPGLESRC,CITYWEATHER
/copy QOAR/QRPGLESRC,QRNOPENACC
D wthrKey e ds extname('WEBSVCS/CITYWTHR':*KEY)
D wthrData e ds extname('WEBSVCS/CITYWTHR':*INPUT)
* The Handler:
P cityWeather...
P b export
D cityWeatherChain...
D pi
D info likeds(QrnOpenAccess_T)
D wthrInfo ds likeds(cityWeatherComm_t)
D based(info.userArea)
D key ds likeds(wthrKey)
D based(info.key)
D data ds likeds(wthrData)
D based(info.inputBuffer)
/free
 
...
if info.rpgOperation == QrnOperation_CHAIN;
. . . call the web service using the key ... (not shown here) . . .
if an error occurred . . .
info.rpgStatus = 1299;
else;
// set the data values from the info returned by the web service
data.precip = . . .
data.temp = . . .
// use the wthrInfo communication area to find out how the RPG
// programmer wants to get the temperature
if wthrInfo.temperatureUnits = CITYWTHR_CELCIUS;
data.temp = (dataParm.temp * (9/5)) + 32;
endif;
16.4.2 IBM Rational Open Access: RPG Edition withdrawn
Effective May 8, 2012, IBM withdrew from marketing the following programs and features, which were licensed under the IBM International Program License Agreement:
5733-OAR 1.1.0 IBM Rational Open Access: RPG Edition
5733-OAR 1.1.1 IBM Rational Open Access: RPG Edition
To encourage the adoption of the technology of Rational Open Access: RPG Edition and enhance the value of the IBM i platform and the RPG language, IBM removed the additional license entitlement requirement for Rational Open Access: RPG Edition for customers of IBM i and IBM Rational Development Studio for i. IBM i 6.1 and 7.1 program temporary fixes (PTFs) are available to enable Open Access: RPG Edition applications to run in the absence of a Rational Open Access runtime license, and to move the technology of Open Access: RPG Edition into Rational Development Studio for i. Here are descriptions of the relevant PTFs:
A PTF for the RPG runtime function that checks for the 5733-OAR license: With this PTF, the function does not check for the 5733-OAR license, but instead returns the value that indicates that the license is valid.
A PTF for the RPG compiler: With this PTF, the compiler does not generate a call to the RPG runtime license-checking function as part of the generated code for opening an Open Access file.
A PTF to make the QOAR library part of the Rational Development Studio for i product: If you do not have 5733-OAR, you must apply this PTF to obtain the include files that are used for developing handlers. If you have 5733-OAR, it is not necessary to apply this PTF. However, any further updates or fixes to the include files are available only through more PTFs for the compiler product 57xx-WDS. 5733-OAR must be removed from the system before the PTF is applied.
As of February 1, 2012, running an ILE RPG program using an Open Access file is available, at no additional charge, to everyone who is licensed to use IBM i 6.1 and 7.1. Also, compiling an ILE RPG program using an Open Access file is available, at no additional charge, to everyone who is licensed to use the ILE compilers feature of either IBM Rational Development Studio for i 7.1 or IBM WebSphere Development Studio for i 6.1
For the announcement letter and more PTF information, see the RPG Cafe at:
16.4.3 Open Access requirements
Here are the Open Access requirements for IBM i 6.1 and IBM 7.1:
IBM i 6.1: IBM WebSphere Development Studio for i V6.1 (5761-WDS) or RPG runtime V6.1 (5761-SS1) with applicable PTFs
IBM i 7.1: IBM Rational Development Studio for i V7.1 (5770-WDS) or RPG runtime V7.1 (5770-SS1) with applicable PTFs
For IBM i 6.1
 – POWER5/5+: 9407-515, 9406-520, 9406-525, 9406-550, 9406-570, 9406-MMA, 9406-595, 9406-800, 9406-810, 9406-825, 9406-870, and 9406-890
 – BladeCenter: 7998-61X
For IBM i 7.1
 – POWER7: 8233-E8B, 9117-MMB, 9179-MHB, 8406-70Y, or 8406-71Y
 – POWER6/6+: 9407-M15, 9408-M25, 9409-M50, 8203-E4A, 8204-E8A, 8234-EMA, 8261-E4S, 9406-MMA, 9117-MMA, and 9119-FHA
 – BladeCenter: 7998-60X, 7998-61X, or 7778-23X
 – POWER5/5+: 9405-520, 9407-515, 9406-520, 9406-525, 9406-550, 9406-570, or 9406-595
For more information about Open Access RPG Edition, go to:
16.5 Other Rational and RPG related tools - ARCAD
As part of the IBM application development tools strategy there are also available tools from open source community as well from third-party providers. One third-party-provided tool is ARCAD-Transformer RPG product.
16.5.1 ARCAD-Transformer RPG tool
Because ILE RPG IV language (its syntax) has been modernized in the terms of allowing most of RPG specifications (except for I and O) to be free format, there was space opened for a tool that can convert old ILE RPG IV fixed format source code to free format.
Such a tool is now available from ARCAD software called ARCAD-Transformer RPG. This tool is able to convert RPG IV code, including calculation specifications (C) and declaration specifications (H, F, D, P).
The ARCAD-Transformer tool is delivered and maintained by ARCAD software. The product is also sold by IBM as part of the ARCAD Pack for Rational under the name ARCAD Converter.
Prerequisites for this tool are IBM Rational Developer for Power Software V8.5 or IBM Developer for i V9.0. ARCAD-Transformer RPG works as an Eclipse plug-in for these Rational tools. For more information, see the Arcad website:
16.5.2 ARCAD Pack for Rational
IBM has become a reseller of ARCAD Pack for Rational, which is an extension to the IBM Rational Developer for i and IBM Rational Team Concert.
ARCAD Pack for Rational provides modern development enhancements to Rational Team Concert and Rational Developer for i. Designed specifically to complement these Rational products, ARCAD Pack provides a modern collaborative development environment, supporting both agile and traditional methods. ARCAD Pack for Rational uses deep dependency analysis to provide audit, impact analysis, intelligent build, and deployment capabilities. It also allows RPG code to be converted to the latest free format RPG specifications.
ARCAD Pack for Rational helps IBM i development teams deliver high-quality software faster based on six main components:
ARCAD-Observer provides in-depth application analysis and visualization.
 – Provides deep dependency analysis and powerful change impact analysis coupled with graphical presentation and reporting, giving analysts and developers a much faster understanding of applications.
 – Automates program and application documentation production.
 – Synchronizes dependency information with code that is in Rational Team Concert.
 – Integrates with Rational Developer for i for making dependency information available to developers when and where they need it.
ARCAD-Builder supports complex integration builds of composite IBM i applications.
 – Automate 100 percent of the build process for any type of IBM i component.
 – Manage and save data, and automatically restore into a new file structure.
 – Automate the recompilation sequencing of dependent components.
 – Manage all compilation specifics, such as SQL and ILE compilations.
 – Use ARCAD-Builder with Rational Team Concert.
ARCAD-Deliver automates and synchronizes deployment across multiple platforms with automatic rollback on error.
 – Deploys any type of files to any number of servers that host UNIX, AIX, Linux, Windows, and IBM i operating systems.
 – Coordinates deployment of all platform components in a single transfer.
 – Allows return to the previous release at any stage during the implementation, using automatic rollback.
 – Provides validated integration with Rational Team Concert.
ARCAD-Audit: provides IBM i code audit and restructuring.
 – Analyzes libraries and source code to identify relationships between components (such as programs and files), databases, and work fields.
 – Identifies application components that are no longer used.
 – Provides tools for rapid clean-up of applications: compare, archive, compile, and delete obsolete components with full traceability and security.
 – Cleans applications before loading Rational Team Concert.
ARCAD-Converter (also known as ARCAD Transformer RPG) converts RPG to free form RPG.
 – Converts RPG to free form RPG.
 – Supports the latest language specifications.
 – Includes Rational Developer for i plug-in.
 – Provides one-off or bulk conversion.
CASE and 4GL support allows CASE/4GL environments to be managed.
 – Allows CASE and 4GL tools to be managed.
 – Supports CA 2E (SYNON), LANSA, Adelia, and JDE (JE Edwards) tools.
 – Provides integration with native development IDEs.
 – Is integrated with Rational Team Concert.
More information can be found on the following website:
The ARCAD Software web page contains information about the ARCAD Pack for Rational and ARCAD tools included in this product:
16.6 IBM Rational Application Management Toolset for i
Rational Application Management Toolset for i provides IBM i system administrators and other advanced users with a lightweight set of tools for the common tasks of working with library file system objects, and for creating and maintaining Command Language (CL) programs.
Application Management Toolset for i is a subset of the Application Development Toolset (ADTS), which is sold as part of WebSphere Development Studio for i V6.1 or as part of Rational Development Studio for i V7.1. Two of the key components of ADTS are Programming Development Manager (commonly known as PDM) and Source Entry Utility (commonly known as SEU).
The new Application Management Toolset for i includes these two components, in modified form, as illustrated in Figure 16-18.
Figure 16-18 Application Management Toolset for i includes modified components of ADTS
The version of SEU that is included in Application Management Toolset for i supports only editing of the CL source. It does not support editing of source members that are written in other languages, such as RPG, COBOL, C, C++, or DDS. Like SEU, this editor provides language-sensitive features, such as syntax checking and prompting for CL source members.
Application Management Toolset for i supports the operating system member types CL, CLLE, CLP, TXT, and CMD in the EDTCLU (same as STRSEU) command.
The version of PDM that is included in Application Management Toolset for i can be used to browse, move, filter, and manipulate objects of any type. However, it enables only software development options (such as Edit and Compile) for CL objects.
Application Management Toolset for i supports the following functions from PDM:
All the menu functions of STRPDM (new command STRAMT)
All the functions of WRKLIBPDM (new command WRKLIBAMT)
All the functions of WRKOBJPDM (new command WRKOBJAMT), including FNDSTRPDM (new command FNDSTRAMT), except for:
 – No option 18 to call DFU.
 – No option 34 to call ISDB.
 – No option 54 to call CMPPFM.
All the functions of WRKMBRPDM (new command WRKMBRAMT), including FNDSTRPDM (new command FNDSTRAMT), with the following exceptions:
 – Option 2 (Edit) uses the new command EDTCLU, which supports only the CL, CLLE, CLP, TXT, and CMD member types.
 – No option 17 to call SDA.
 – No option 19 to call RLU.
 – No option 54 to call CMPPFM.
 – No option 55 to call MRGSRC.
None of the other components from ADTS are included with Rational Application Management Toolset for i.
16.6.1 Application Management Toolset for i Licensing
IBM Rational Application Management Toolset for i V6.1.0 (5761-AMT) is licensed per processor, for unlimited usage on that processor by any number of persons. The license is priced according to the software tier of the system on which Application Management Toolset for i is used.
Like WebSphere Development Studio for i and Rational Development Studio for i, ongoing maintenance and support costs for Application Management Toolset for i are included in the IBM i system Software Maintenance agreement (SWMA).
16.6.2 Application Management Toolset for i Requirements
Hardware requirements:
IBM Rational Application Management Toolset for i V6.1 supports all the hardware models that support IBM i 6.1 and 7.1.
Software requirements:
IBM Rational Application Management Toolset for i V6.1 supports IBM i 6.1 and 7.1.
16.6.3 Accessing Application Management Toolset for i
The main menu for Application Management Toolset for i (AMT) (Figure 16-19) can be accessed by running STRAMT.
Application Management Toolkit (AMT)
Select one of the following:
1. Work with libraries
2. Work with objects
3. Work with members
9. Work with user-defined options
 
Selection or command
===>
F3=Exit F4=Prompt F9=Retrieve F10=Command entry
F12=Cancel F18=Change defaults
Figure 16-19 Main menu for Application Management Toolkit for i
16.7 IBM Rational Host Access Transformation Services (HATS)
IBM Rational Host Access Transformation Services (HATS) is a tool that allows you to transform applications using text-based 5250 user interface into web pages. HATS allows you to quickly create a web application from an existing 5250 application without manually changing the source code. It is also able to connect to IBM Mainframe 3270 screens at the same time, and general UNIX VTY screens, run macros there, gather the data, and present data from multiple system them in a single webpage.
16.7.1 HATS general description
The HATS tool is based on the Eclipse environment like other Rational development tools. The latest version v9.0 uses Eclipse 4.2.2.
As a prerequisite for development activity it needs one of the following Rational products:
Rational Developer for i V9.0
Rational Business Developer V9.0
Rational Application Developer for WebSphere Software V9.0
Rational Software Architect for WebSphere Software V9.0
Rational Developer for AIX and Linux V9.0
The following are the supported runtime Java application servers:
IBM i - Release Overview V7.1 and future modification levels and their fix packs
IBM i - Release Overview V6.1 and future modification levels and their fix packs
IBM i - Release Overview V5.4 and future modification levels and their fix packs
Apache Geronimo 2.2.1 and future modification levels and fix packs
Apache Geronimo 2.1.7 and future modification levels and fix packs
WebSphere Application Server - different versions of Express/Base/Network Deployment editions from version 7.0 to the latest 8.5.5.
Oracle WebLogic server 12c (12.1.1) and future modification levels and their fix packs
 
Note: Any of the WebSphere, WebLogic, and Apache Geronimo technologies can run on a different platform from where they are supported (IBM i is not mandatory). These servers then connect using telnet, or secure telnet protocol to the IBM i server where the original 5250 application runs.
HATS V9.0 can create two types of clients, the first is web based running in a web browser, and the second is a client/server based client running either in Lotus Notes, Lotus Expeditor environment, or in Eclipse SDK environment.
Supported web browsers include the following:
Mozilla Firefox
Android
Google Chrome
Apple Safari
Apple Safari on iOS
Microsoft Internet Explorer
Microsoft Internet Explorer mobile browser
Konqueror
Opera
Rational HATS can also create portlets when used with IBM Rational Application Developer for WebSphere Software. It supports different IBM WebSphere Portal Server Editions from version 7.0 to version 8.0.
For detailed system requirements and possible limitations, see the following website:
16.7.2 HATS basic functionality
IBM Rational Host Access Transformation Services (HATS) transforms traditional text-based interfaces, such as 3270 and 5250 green-screen applications, into web, portlet, rich client, or mobile device user interfaces. It also extends 3270, 5250, and virtual terminal (VT) applications as standard web services. With Rational HATS, you can easily convert traditional text-based host application screens to user-friendly GUIs.
Rational HATS is available in the following packages:
Rational HATS for Multiplatforms and HATS for Linux on zSeries
Rational HATS for 5250 Applications on Multiplatforms
Rational HATS for 5250 Applications on i5/OS
 
Note: Rational HATS for Multiplatforms can create applications using IBM i 5250, IBM Mainframe 3270, and UNIX VT based screens (VT is only for capturing data, not screens). Rational HATS for 5250 can use only IBM i 5250 screens.
Rational HATS for Multiplatforms and Rational HATS for 5250 Applications on Multiplatforms can use any supported HTTP server on any supported Java application server (see 16.7.1, “HATS general description” on page 667). Rational HATS for 5250 Applications can only have a Java application server runtime on IBM i.
The Rational HATS product provides both a HATS Toolkit (Windows Eclipse based plug-in for development of HATS applications) and a HATS run time. The HATS toolkit can be downloaded for no extra cost from the Rational HATS product web page.
Rational HATS allows you to reuse your existing assets in the following innovative ways:
Terminal applications
 – Transforms the user interface of your 3270 and 5250 green-screen applications.
 – Allows tunable default rendering of all non-customized panels of the application.
 – Transforms specific panels using panel customizations and transformations.
 – Transforms terminal application components, such as function keys and menu items, into intuitive links, buttons, or text with images.
Web services
 – Extends 3270, 5250, and VT application core business logic as web services or JavaBeans.
 – Captures panel flows, inputs, and outputs with a wizard-based macro recorder. Allows you to edit what is captured with the Visual Macro Editor, and creates integration objects and web services from the screen flows.
 – Reuses terminal application business logic in new business processes and applications.
Customization
 – Provides customizable workflow and application navigation.
 – Rational HATS simplifies panel navigation with macros and screen combinations.
 – Uses global variables to store data, pre-fill drop-down menus or pop-up windows, and input information for the user.
 – Can transform a text-based user interface with a rich set of GUI widgets, such as drop-down menus, calendars, tables, pop-up windows, and radio buttons.
 – Using business logic, Rational HATS augments terminal applications by aggregating terminal application data with other data sources.
HATS Toolkit
 – Provides wizard-based, visual development including visual page design and macro editing.
 – Works with a supported Rational IDE environment, such as IBM Rational Application Developer for WebSphere Software, or Rational Business Developer, or Rational Developer for i V9.0 + Modernization Tools, EGL Edition.
 – Provides access to standard Eclipse features such as Java development tools.
 – Features a wizard-based development process for creating Rational HATS applications.
Deployments
 – Routes applications to IBM WebSphere Application Server and IBM WebSphere Portal Server, as well as a number of devices and clients.
 – Creates standard web applications for deployment to WebSphere Application Server.
 – Customizes portlets with the Rational HATS Toolkit for deployment to WebSphere Portal Server.
 – Optimizes web applications for mobile devices running Apple iPhone OS or Microsoft Windows Mobile.
 – Creates a standard Eclipse rich client application for deployment to IBM Lotus Notes, Lotus Expeditor, or Eclipse Rich Client Platform.
For more information about the IBM Rational HATS product, see the following websites:
Rational HATS product web page:
IBM Rational Host Access Transformation Services (HATS) V9.0 Knowledge Center:
 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.105.159