Professional Documents
Culture Documents
com
Disclaimer
Acknowledgement: This presentation is a collaborative effort of the IBM Toronto AS/400 Application Development presentation team, including work done by: George Farr, Claus Weiss, Don Yantzi, and Barbara Morris Disclaimer: The information contained in this document has not been submitted to any formal IBM test and is distributed on an as is basis without any warranty either express or implied. The use of this information or the implementation of any of these techniques is a customer responsibility and depends on the customers' ability to evaluate and integrate them into the customers' operational environment. While each item may have been reviewed by IBM for accuracy in a specific situation, there is no guarantee that the same or similar results will result elsewhere. Customers attempting to adapt these techniques to their own environment do so at their own risk. Reproduction: The base presentation is the property of IBM Corporation. Permission must be obtained PRIOR to making copies of this material for any reason.
Agenda
Our Investment in RPG IV Highlights from previous releases RPG 7.1 Enhancements Rational Open Access: RPG Edition Future of RPG IV
10 Characters with underscore allowed Upper and Lower case source More readable, maintainable Free-form Expressions Date and time support
New D(efinition) spec Clear, concise, consistent Built-in Functions Most limits raised or removed Source migration tool provided All this, and ILE, too!
RPG IV -V3R2/V3R6
User Defined Procedures With support for Local variables Create your own Functions! Modernizing Free-form CALL the language: With parameter validation via Prototypes Structured New Integer Data Types Programming Signed (I) Unsigned (U) Other Enhancements *CYMD date formats supported on MOVE, MOVEL and TEST (when working with system values that support such format) Replace option on PREFIX (replace characters in the existing field name with the prefix string. )
V3R7 RPG IV
Null field support Test and set null-capable fields
[ %NULLIND(FLD1)=*ON/*OFF ]
New data types Floating point Null terminated strings (%STR) New Built-In functions String functions
type conversions (%INT, %FLOAT, %DEC, %UNS) Type converts with half-adjust ((%INTH, %DECH, %UNSH)
Pointer arithmetic adding an offset to a pointer, subtracting an offset from a pointer determining the difference between two pointers. Long names longer than 10 characters
2010 IBM Corporation
V4R2 RPG IV
Associate *LGL and INDDS Indicator Data Type with each WORKSTN file Data areas of type *LGL (logical) that uses INDARA Indicator data structure (INDDS) (instead of *IN array) Built-in functions (%EOF, %EQUAL, %FOUND, %OPEN, as well as %ERROR, %STATUS. Indicator data type ('N): defines character data in the indicator format. Varying length Character field. New Data Type New Built-In functions Simplifies string handling Permanent compiler options Use H specification keyword instead of compile options on CRTBNDRPG and CRTRPGMOD Other enhancements Mixed case procedure and variable names on IMPORT & EXPORT keywords BNDDIR (binding directory) option on CRTRPGMOD Customers Requirements
V4R4 RPG IV
EVALR assignment right-adjusts the data within the result. Free form FOR Loop iterative loop; allows free-form expressions for initial, increment, and limit OVERLAY(name : *NEXT) subfield is positioned at the next available position within overlayed field. LEAVESR op-code exit/return from any point within a subroutine New Built-Ins %XFOOT sums all elements of a specified array expression %DIV(n:m) integer division on the two operands n and m and more New Data Types (Java compatibility) 1-byte and 8-byte integer Signed (3I, 20I), and unsigned (3U, 20U) JNI (Calls) direct call to Java method technically possible, but difficult. Thread Safety
V5R1
Increasing
Java-related support EXTPROC maps to Object (CLASS) methods CLASS keyword on the D spec STATIC keyword for static methods Free Form C-Specification Monitor operation group Runtime control of file/member to be opened EXTFILE(filename) Static name or variable Date/time/timestamp operations in expressions ELSEIF Operation instead of nested IFs Predefined compiler directives /DEFINE names *VnRnMn, *ILERPG, *CRTBNDRPG *CRTRPGMOD Qualified names in data structures More Built-in Functions %XLATE, %OCCUR, %CHECK, %CHECKR, %ALLOC, %REALLOC, %LOOKUP, etc
2010 IBM Corporation
D cust D name D id_num D part D name D id_num D part1 D part2 C C C C C eval eval eval eval eval
QUALIFIED
QUALIFIED
LIKEDS(part) LIKEDS(part)
cust.name = 'ABC Electronics' part1.name = 'Radio' part1.id_num = 100035 part2.name = 'Telephone' part2.id_num = 100036
V5R3
RPG preprocessing for SQL Preprocessor handles conditional compilation and nested /COPY 63 Digit support (Packed and Zoned) DECPREC (30|31|63) Second parameter on %TRIMx designated trim characters trimchars = *-; data = **-*a-b-c*-*; result = %trim(data, trimchars); resulting value is a-b-c Allow dynamic resizing of arrays, %SUBARR %SUBARR(array : start : length) sorta %subarr(myArray:4:10) sorts 10 elements of myArray starting at 4th: OPTIONS(*TRIM) on the proc prototype that parameter is always trimmed of leading and trailing blanks Conversion of date/time/timestamp to numeric using %DEC Example: date is DATE type = D2003-08-21; numDDMMYY is numeric numDDMMYY = %dec(date:*dmy) ; numDDMMYY now contains 210803 Relax rules for result data structure Result DS for I/O to a RECORD format may be externally described DS Data structure may be specified in result field for I/O to externally-described fiel CHAIN, READ, READE, READP, READPE New environment variable for Java method calls (performance enhancement)
2010 IBM Corporation
V5R4
Embedded SQL supported in free-format RPG Data structure copy Evaluate corresponding EVAL-CORR Changed Prefix keyword removes Prefix from field names on external described structures XML support New built ins: % XML % Handler New operation codes XML-INTO XML-SAX New prototyped parameter option OPTIONS(*NULLIND) null-indicators bitmap is passed into the procedure. New Debug keyword values *INPUT, *XMLSAX, *DUMP SEU, add syntax checking for free-form RPG
/free outSqlState = sqlState; if %subst(sqlState:1:2) <> '00'; exec sql GET DIAGNOSTICS CONDITION 1 :outSqlMsg = MESSAGE_TEXT; orderCount = 0; endif; return orderCount; /end-free
2010 IBM Corporation
XML Support
XML-INTO variable %XML(xml_document)
Reads from an XML document into a field, data structure or array First parameter of %XML can be a string actually containing XML data, for example '<a>Hello</a>', or it can be the name of an XML file, for example 'mydata.xml'. Second optional operand for %XML specifies indicates weather the first operand is string containing XML data, or an XML file. For example, %XML(xmldata : 'doc=file') D******************************************************** D info DS Target Field D name 10A D val 5I 0 DIM(2) D********************************** /free <info> <name>Frank</name> <val>10</val> <val>-5</val> </info> MyFile.XML
XML-INTO info %XML('myfile.xml' : 'doc=file'); // info now has the value // name = Frank' // val(1) = 10 // val(2) = -5 Source of XML Options
2010 IBM Corporation
Agenda
Our Investment in RPG IV Highlights from previous releases RPG 7.1 Enhancements Rational Open Access: RPG Edition Future of RPG IV
V6R1 Enhancements
Major enhancements for ILE RPG include Data structure type definitions No more compile-time overrides Defining files locally in subprocedures, and passing files as parameters Significantly higher limits for the size of variables and array elements A new kind of RPG main procedure Relaxation of some UCS-2 rules (available for V5R3/4 through PTFs) Run concurrently in multiple threads; RPG doesnt have to be a bottleneck
10
LIKEFILE Keyword
Use to define files to same setting as another File Specification If the file is externally-described, the QUALIFIED keyword is implied. I/O to the file can only be done through data structures. The LIKEFILE keyword is used mostly with file parameters.
11
Files as Parameters
Files can now be passed as a parameters between procedures and programs: A prototyped parameter can be defined as a File parameter using the LIKEFILE keyword. Any file related by LIKEFILE keywords to the same original File specification may be passed as a parameter to the procedure. Within the called procedure or program, all supported operations can be done on the file parameter. However, I/O to the file parameter can only be done through data structures. RPG file parameters are not compatible with file parameters in other languages such as C or COBOL.
File Templates
To use a file as a template: Add the TEMPLATE keyword File will be used at compile time for LIKEFILE definitions FcustF_t IF E K DISK TEMPLATE EXTDESC(CUSTF)
To define a real file that can be used at runtime or passed as a parameter: Define the file using LIKEFILE.
FcustF F
LIKEFILE(custF_t) EXTFILE(*EXTDESC)
12
Larger Fields
No more artificial limits on variable definitions Data structures, and A, C and G variables can now have a size up to 16,773,104 bytes The system limit of 16,773,104 for a single variable still applies The LEN keyword can be used instead of the Length entry Required for length > 7 digits. The VARYING keyword allows a parameter of either 2 or 4 indicating the number of bytes used to hold the length prefix. VARYING(4) is assumed if the defined length of the definition is over 65535. %ADDR(varying_field :*DATA) will get a pointer to the data portion of a varying length field. Prior to 6.1, the data was always 2 bytes after the start of the field; now it can be 2 or 4 bytes.
NOTE: Included to address requirement for working with data from other systems where the data can be much larger
13
Longer Literals
Size limits for string literals have been increased Useful for generating RPG source with literals for prepared SQL statements, or for HTML data. Character literals can now have a length up to 16380 characters. UCS-2 literals can now have a length up to 8190 UCS-2 characters. Graphic literals can now have a length up to 16379 DBCS characters.
14
10A
P ordEntry B D ordEntry PI D custname 10A CONST ... code the main procedure logic here ... when it reaches the end, it just returns ... *INLR has no meaning P ordEntry E
15
16
17
18
19
Agenda
Our Investment in RPG IV Highlights from previous releases RPG 7.1 Enhancements Rational Open Access: RPG Edition Future of RPG IV
Sorting Arrays Leave and Iter with Condition Support Alias names Implicit conversion between characters and UCS-2 Opening of RPG Interface Tool enhancements
20
SORTA custDs(*).amount_owing;
Search for an element in the custDs array where the elem = %LOOKUP("K" : custDs(*).account_status) Sort an array either ascending or descending Sort using SORTA(A) or SORTA(D) array cannot be a sequenced array (ASCEND or DESCEND keyword). Sort the salary array in descending order SORTA(D) salary
2010 IBM Corporation
21
Varying Length
%LEN(field-defined-as-varying : *MAX)
Retrieves the maximum number of characters for a varying-length character, UCS-2 or Graphic field
22
Alias
Retrieves the maximum number of characters for a varying-length character, UCS-2 or Graphic field Use ALIAS names in externally-described data structures Use the ALIAS keyword on a Definition specification to indicate that you want to use the alternate names for the subfields of externally-described data structures Use the ALIAS keyword on a File specification to indicate that you want to use the alternate names for LIKEREC data structures defined from the records of the file
DDS:
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;
2010 IBM Corporation
RPG:
Agenda
Our Investment in RPG IV Highlights from previous releases RPG 7.1 Enhancements Rational Open Access: RPG Edition Future of RPG IV
23
One More Thing Lots of Speculation October Statement of Direction for IBM i 7.1
Open Access for RPG Extend application reach to pervasive devices
Introducing..
5250 Screens
24
5250 Screens
JSPs
Other Servers
Mobile Devices
2010 IBM Corporation
5250 Screens
JSPs
Target Program
Handlers
Data
Handlers Target Program Handlers
Target Program
Other Servers
Mobile Devices
2010 IBM Corporation
25
RPG IV Source
RPG IV Compiler
Open Access
RPG IV Runtime
Open Access
Handlers
Mobile
Handlers
XML
Handlers
Web Service
2010 IBM Corporation
Data
F Define the Handler D*********************** C* C Write Section1 C* : C* : C Write Section2 C :
Handlers
26
Requires RDPower: RPG and COBOL Development for i as the development environment
For syntax checking, semantic checking, etc
Agenda
Our Investment in RPG IV Highlights from previous releases RPG 7.1 Enhancements Rational Open Access: RPG Edition Future of RPG IV
27
Summary
RPG IV is Alive and Well!! Continued Investment from IBM Continued Enhancements
Lotus, Freelance Graphics, and Word Pro are registered trademarks of Lotus Development Corporation and/or IBM Corporation. Domino is a trademark of Lotus Development Corporation and/or IBM Corporation. C-bus is a trademark of Corollary, Inc. 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. ActionMedia, LANDesk, MMX, Pentium and ProShare 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 and 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 in this presentation 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 in this presentation 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.
2010 IBM Corporation
28
Faster return values A procedure defined with the RTNPARM keyword handles the return value as a hidden parameter. When a proced the procedure can be significantly improved by defining the procedure with the 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) /fre %PARMNUM built-in function The %PARMNUM(parameter_name) built-in function returns the ordinal number of the parameter within the param keyword. D pi D name 100a const varying D id 10i 0 value D errorInfo likeds(errs_t) D options(*nopass) /free // Check if the Optional prototypes If a program or procedure is not called by another RPG module, it is optional to specify the prototype. The prototyp A program that is only intended to be used as an exit program or as the command-processing program A program that is only intended to be called from a different programming language A procedure that is not exported from the module A procedure that is exported from the module but only intended to be called from a different programm Teraspace storage model RPG modules and programs can be created to use the teraspace storage model or to inherit the storage model of higher that for the single-level storage model. There are limits for the amount of automatic storage for a single proc Use the storage model (STGMDL) parameter on the CRTRPGMOD or CRTBNDRPG command, or use the STGM *TERASPACE The program or module uses the teraspace storage model. *SNGLVL The program or module uses the single-level storage model. *INHERIT The program or module inherits the storage model of its caller. Change to the ACTGRP parameter of the CRTBNDRPG command and the ACTGRP keyword on the Control specificati The default value of the ACTGRP parameter and keyword is changed from QILE to *STGMDL. ACTGRP(*STGMDL) specifies that the activation group depends on the storage model of the program. When the s ACTGRP(*STGMDL) is the same as ACTGRP(QILE). Note: The change to the ACTGRP parameter and keyword does not affect the default way the activation group is assign to QILE as it did ACTGRP parameter or keyword is not specified, the activation group of the program will default 2010 IBM Corporation in Allocate teraspace storage
29