More Related Content
Similar to RPG investment (20)
More from COMMON Europe (19)
RPG investment
- 1. IBM’s Investment in RPG
Past, Present and Future
Alison Butterill
Power Systems Software
© 2010 IBM Corporation
IBM Power Systems
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.
© 2010 IBM Corporation
1
- 2. IBM Power Systems
Commitment to RPG
Hayden Lindsey
Vice President and Distriguished Engineer
Enterprise Modernization, Modeling,
Construction and Compilers
IBM Rational
© 2010 IBM Corporation
IBM Power Systems
Agenda
Our Investment in RPG IV
Highlights from previous releases
RPG 7.1 Enhancements
Rational Open Access: RPG Edition
Future of RPG IV
© 2010 IBM Corporation
2
- 3. IBM Power Systems
RPG IV – A Concept Comes Forth
Three main goals for RPG IV
1. Interoperability
• Java
• XML
• SQL
2. Readability
• Free form
• Blank lines
• Comments
3. Functionality
• Procedures
• Data areas/data structures
• More data types
• Extended file support
© 2010 IBM Corporation
IBM Power Systems
V3R1… RPG IV 1st release
• Expanded names • New Definition specification (D-spec)
•10 characters allowed •Clear, concise, consistent
•Underscore supported •Built in functions
•Upper and Lower case source •Most limits raised or remved
•More readable, maintainable •Source migration tool provides
•Free form expressions •All this and support for ILE
•Date and time support
RPG CRTRPGMOD *MODULE X
Source *PGM PGMA
X PRC X
*MODULE X *MODULE Y *MODULE Z
RPG *MODULE Y CRTPGM...
CRTRPGMOD PRC X PRC Y PRC P1
Source MOD(X Y Z)
Y PRC Y
RPG CRTRPGMOD *MODULE Z
Source
Z
© 2010 IBM Corporation
3
- 4. IBM Power Systems
RPG IV -V3R2/V3R6
• User Defined Procedures
• With support for Local variables
• Create your own Functions
• Free-form CALL
• With parameter validation via Prototypes
• New Integer Data Types
• 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. )
© 2010 IBM Corporation
IBM Power Systems
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
• editing (%EDITW, %EDITC, %EDITFLT)
• scanning strings (%SCAN)
Data type conversions
• 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
4
- 5. IBM Power Systems
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
• ‘Permanent’ compiler options Simplifies string handling
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
© 2010 IBM Corporation
IBM Power Systems
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
• THREAD(*SERIALIZE) can run multi-threaded, but serialized
access
• Unicode
• UCS-2 (Unicode) character set
© 2010 IBM Corporation
5
- 6. IBM Power Systems
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
IBM Power Systems
Free Form C-Spec
/FREE
read file; // Get next record
dow not %eof(file); // Keep looping while we have a record
if %error;
dsply ‘The read failed’;
leave;
else;
chain(n) name database data;
time = hours * num_employees
+ overtime_saved;
pos = %scan (‘,’ : name);
name = %xlate(upper : lower : name);
exsr handle_record;
read file;
endif;
enddo;
begsr handle_record;
eval(h) time = time + total_hours_array (empno);
temp_hours = total_hours - excess_hours;
record_transaction();
endsr;
/end-free
© 2010 IBM Corporation
6
- 7. IBM Power Systems
Qualified Data Structures
D cust DS QUALIFIED
D name 50a
D id_num 10i 0
D part DS QUALIFIED
D name 25a
D id_num 10i 0
D part1 DS LIKEDS(part)
D part2 DS LIKEDS(part)
C eval cust.name = 'ABC Electronics'
C eval part1.name = 'Radio'
C eval part1.id_num = 100035
C eval part2.name = 'Telephone'
C eval part2.id_num = 100036
© 2010 IBM Corporation
IBM Power Systems
V5R2 - Another BIG release
• 31 digit support for numerics (DECPREC keyword)
• Allow Character parms for the following built-ins:
• %DEC, %DECH, %INTH, %UNS, %UNSH, %FLOAT
• e.g. %DEC(‘12345.67’ : 7 : 2) create decimal number from‘12345.67’
• Bitwise logical built-in functions (direct bit manipulation)
•%BITAND, %BITOR, %BITXOR, %BITNOT
• IFS Source File Support
• Library qualified access to data areas (not only *LIBL)
• Specify selected fields for UPDATE (%FIELDS)
•UPDATE record %fields(field1 : field3)
• PCML file generation into IFS
• I/O enhancements
•Externally-described DS can hold I/O/B fields
•DS can be specified in result field when using I/O operations to an
externally described file
•Prior to V5R2 only allowed for program-described files
• Short Form Operators
Variable1 += Variable2
© 2010 IBM Corporation
7
- 8. IBM Power Systems
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 = D’2003-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
IBM Power Systems
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
© 2010 IBM Corporation
8
- 9. IBM Power Systems
Embedded SQL in Free Format RPG
/free
exec sql
WHENEVER SQLERROR GOTO handleError;
outSqlMsg = *blanks;
exec sql
SELECT count(*) into :orderCount FROM orders
WHERE cust_no = :inCustNumber;
return orderCount;
/end-free
handleError tag
/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
IBM Power Systems
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******************************************************** <info>
D info DS Target Field
<name>Frank</name>
D name 10A
D val 5I 0 DIM(2) <val>10</val>
D**********************************
<val>-5</val>
/free </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
9
- 10. IBM Power Systems
V6R1 Enhancements
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 doesn’t have to
be a bottleneck
© 2010 IBM Corporation
IBM Power Systems
New Options for Overrides
History:
•Pre-V5R1 many overrides executed at Compile time
–externally described files
–data structures
•EXTFILE in V5R1
–allowed reassigning of file/member/library within the
program
–not a compile time option
V6R1:
•New F Spec keywords
–EXTDESC for files
–EXTNAME enhancement for data structures
© 2010 IBM Corporation
10
- 11. IBM Power Systems
EXTDESC and EXTNAME
For F specs:
• new keyword EXTDESC
• enhanced keyword EXTFILE(*EXTDESC)
– EXTDESC(‘LIBNAME/FILENAME’) or
EXTDESC(‘FILENAME’) locates the file at compile time
– EXTFILE(*EXTDESC) indicates that the file specified by
EXTDESC is also to be used at runtime.
For D specs
• EXTNAME keyword is enhanced
– EXTNAME(‘LIBNAME/FILENAME’) or
EXTNAME(‘FILENAME’) locates the file for the data
structure at compile time.
© 2010 IBM Corporation
IBM Power Systems
Local File Definition
Files can be defined within a subprocedure
Global definition no longer only way to define a file
Advantages:
1. Maintainability :
Coding the file definition in a subprocedure, the RPG programmer
can explicitly limit the file’s access to only that subprocedure
1. Reduction of static storage:
Defining the file locally reduces of the static storage required by
the module, if the file is defined to use automatic storage for the
internal storage required to manage the file.
© 2010 IBM Corporation
11
- 12. IBM Power Systems
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.
© 2010 IBM Corporation
IBM Power Systems
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.
© 2010 IBM Corporation
12
- 13. IBM Power Systems
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 LIKEFILE(custF_t)
F EXTFILE(*EXTDESC)
© 2010 IBM Corporation
IBM Power Systems
Qualified Record Formats
Using qualified record formats makes it easier to read and maintain RPG code.
Consider this code without qualified names:
read custRec custDs;
if not %eof(inFile);
if amtOwing > 1000;
Compare to this version using qualified names:
read inFile.custRec custDs;
if not %eof(inFile);
if custDs.amtOwing > 1000;
© 2010 IBM Corporation
13
- 14. IBM Power Systems
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
© 2010 IBM Corporation
IBM Power Systems
More Array Elements
Larger limit for DIM and OCCURS
No limit on the number of elements in an array or occurrences
in a multiple-occurrence data structure.
Total size for an array or structure remains at 16,773,104
bytes.
Example:
– If the elements of an array are 1 byte in size, the maximum
DIM for the array is 16,773,104.
– If the elements of an array are 10 bytes in size, the
maximum DIM for the array is 1,677,310 (16773104/10).
© 2010 IBM Corporation
14
- 15. IBM Power Systems
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.
© 2010 IBM Corporation
IBM Power Systems
Main With No Cycle
Most modern RPG code does not overtly use the RPG Cycle
Now available - an RPG module with a main procedure that does not
rely on the RPG cycle.
New Keyword on H Specification - MAIN
– Designates one subprocedure as the main procedure (PEP)
Designated subprocedure is like any other subprocedure - no RPG
cycle.
The prototype for the main subprocedure must have the EXTPGM
keyword
The main subprocedure can only be called by a program call.
© 2010 IBM Corporation
15
- 16. IBM Power Systems
Main With No Cycle Example
H MAIN(ordEntry)
D ordEntry PR EXTPGM(‘ORDENTRY’)
D custname 10A CONST
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
© 2010 IBM Corporation
IBM Power Systems
Relaxed UCS-2 Rules
Pre V6R1:
RPG IV supported the UCS-2 data type; including support for UTF-16
– Extremely difficult to change the data type of a database character
or graphic field to be UCS-2.
– Compiler gives diagnostic error messages saying that the UCS-2
field cannot be used with the character data.
RPG IV considers Character, UCS-2 and Graphic to be three separate
data types.
Using these data types together in the same statement required
specific conversion using RPG built-in functions %CHAR, %UCS2 or
%GRAPH.
© 2010 IBM Corporation
16
- 17. IBM Power Systems
Relaxed UCS-2 Rules
Change to compiler allows any string types to be used in assignment
and comparison operations without explicit conversion.
– Conversion performed implicitly by compiler
UCS-2 variables can now be initialized with character or graphic
literals
– %UCS2 built-in function no longer necessary
This enhancement is available in V5R3 and V5R4 with PTFs:
V5R3M0 TGTRLS(*CURRENT): SI24532
V5R4M0 TGTRLS(*CURRENT): SI26312
V5R4M0 TGTRLS(*PRV) : SI25232
© 2010 IBM Corporation
IBM Power Systems
Module Size Reduced
Option now available to eliminate unused variables from the compiled
object
New values *UNREF and *NOUNREF are added to
– the OPTION keyword for the CRTBNDRPG and CRTRPGMOD
commands
– Also for the OPTION keyword on the C specification.
– The default remains *UNREF, meaning that unused variables are still
generated
*NOUNREF indicates that unreferenced variables should not be
generated into the RPG module.
– Reduces Program size
– If imported variables are not referenced, it can reduce the time taken
to bind a module to a program or service program.
© 2010 IBM Corporation
17
- 18. IBM Power Systems
Full Thread Support
Pre-V6R1:
Using THREAD(SERIALIZE), RPG could run safely in multiple
threads
– each RPG module could be accessed by only one thread at a
time.
Overall performance and scalability of the application was impacted
– each RPG module had the potential of being a bottleneck.
V6R1:
RPG module can run concurrently in multiple threads.
© 2010 IBM Corporation
IBM Power Systems
Full Thread Support…
THREAD(*CONCURRENT) available for Control specification of a module
– Multiple threads can run in the module at the same time.
– By default, static variables will be defined so that each thread will
have its own copy of the static variable.
– Individual variables can be defined to be shared by all threads using
STATIC(*ALLTHREAD).
– Individual procedures can be serialized so that only one thread can
run them at one time, by specifying SERIALIZE on the Begin
Procedure specification.
Considerations:
– Using THREAD(*CONCURRENT) increases the total amount of static
storage used
• Total size = size required by module X number of threads
© 2010 IBM Corporation
18
- 19. IBM Power Systems
Parameter Information Stored in the Program
For both the RPG IV and ILE COBOL compilers
PCML can be placed in a stream file as before, directly in the module, or both.
Information can later be retrieved from a program or service program containing
the module, using the new QBNRPII API
The PGMINFO command parameter for the CRTRPGMOD, CRTCBLMOD,
CRTBNDRPG and CRTBNDCBL commands specifies location for PCML
– The default location is the stream file specified by the INFOSTMF parameter
– PGMINFO(*PCML:*MODULE) says to place the PCML information directly
in the module
• becomes part of the program or service program containing the module.
– PGMINFO(*PCML:*ALL) says to place the PCML information both in the
module and in the INFOSTMF stream file.
© 2010 IBM Corporation
IBM Power Systems
Parameter Information Stored in the Program
Alternate: H spec keyword for RPG or PROCESS option for COBOL
The PGMINFO command parameter can be augmented or overridden by an H
spec keyword (ILE RPG) or PROCESS option (ILE COBOL).
– RPG: PGMINFO(*PCML:*MODULE) or PGMINFO(*NO)
– COBOL: PGMINFO(PCML MODULE) or PGMINFO(NOPGMINFO)
Priority ?
– If the source keyword specifies “module”, then it augments the PGMINFO
command parameter. For example, if the command requested *STMF, and
the source keyword specifies *MODULE, then the PCML will be generated
both to the stream file and into the module.
– If the keyword specifies “no”, then it overrides the PGMINFO command
parameter. No matter what was specified by the command parameter, no
PCML information will be generated by the compiler.
© 2010 IBM Corporation
19
- 20. IBM Power Systems
Parameter info in program – V5R4 PTFs
PTF support for V5R4
Part of this support is available in V5R4 with PTFs.
– The H specification keyword for ILE RPG
– The PROCESS option for ILE COBOL
– The QBNRPII API
The following V5R4M0 PTFs will provide the various parts of this function
• 5722SS1 SI23544 (QBNRPII API)
• 5722SS1 SI27064 (Support for compilers)
• 5722WDS SI27061 (ILE RPG compiler PTF 1)
• 5722WDS SI27065 (ILE RPG compiler PTF 2)
• 5722WDS SI27154 (ILE COBOL compiler)
– PCML Restrictions:
http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?topic=/com.i
bm.etools.iseries.pgmgd.doc/c0925076180.htm
© 2010 IBM Corporation
IBM Power Systems
Agenda
Our Investment in RPG IV
Highlights from previous releases
RPG 7.1 Enhancements
Rational Open Access: RPG Edition
Future of RPG IV
© 2010 IBM Corporation
20
- 21. IBM Power Systems
RPG 7.1 Enhancements
Sorting Arrays
Leave and Iter with Condition
Support Alias names
Implicit conversion between characters and UCS-2
Opening of RPG Interface
Tool enhancements
© 2010 IBM Corporation
IBM Power Systems
Sort and Search Data Structure Arrays
Data structure arrays can be sorted and searched using one of the subfields
as a key
Sort the custDs array by the amount_owing subfield
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
- 22. IBM Power Systems
Scan and Replace
New built-in function %SCANRPL
The %SCANRPL built-in function scans for all occurrences of a
value within a string and replaces them with another value.
Replace "NAME" with "Tom"
Before
string1 = 'See NAME. See NAME run. Run NAME run.'
string2 = %ScanRpl('NAME' : 'Paul' : string1)
After
string2 = 'See Paul. See Paul run. Run Paul run.'
© 2010 IBM Corporation
IBM Power Systems
Pass Any Type of String Parameter
Implicit conversion will be done for string parameters passed by value or by
read-only reference.
Example:
Procedure is prototyped using a CONST UCS-2 parameter
Character expression is passed as a parameter on a call to the procedure.
This enables creation of a single procedure with the parameters and return
value prototyped with the UCS-2 type.
Calling the procedure, you can pass any type of string parameter, and assign
the return value to any type of string variable.
Sample
The makeTitle procedure turns value to upper-case and centers it
within the provided length
alphaTitle = makeTitle(alphaValue : 50)
ucs2Title = makeTitle(ucs2Value : 50)
dbcsTitle = makeTitle(dbcsValue : 50)
© 2010 IBM Corporation
22
- 23. IBM Power Systems
Varying Length
%LEN(field-defined-as-varying : *MAX)
Retrieves the maximum number of characters for a varying-length character, UCS-2
or Graphic field
Encrypted listing debug view
Allows distribution of debuggable programs without exposing source code via listing
view
Listing view will only be seen by person doing debug if encryption key has been
entered
Use DBGENCKEY parameter on CRTRPGMOD, CRTBNDRPG or CRTSQLRPG
commands.
© 2010 IBM Corporation
IBM Power Systems
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
RPG: 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
23
- 24. IBM Power Systems
Agenda
Our Investment in RPG IV
Highlights from previous releases
RPG 7.1 Enhancements
Rational Open Access: RPG Edition
Future of RPG IV
© 2010 IBM Corporation
IBM Power Systems
Rational Open Access: RPG Edition 5250 Screens
RPG Applications
Traditional RPG
Interface
User Interface
Business
Logic
DB Access
© 2010 IBM Corporation
24
- 25. IBM Power Systems
Rational Open Access: RPG Edition 5250 Screens
RPG Applications
WRITE record program 5250 datastream
I/O buffer Display file
object
* DSPF
Other information:
•state
•names
•pointers
RPG Runtime Display Manager
IBM i
© 2010 IBM Corporation
IBM Power Systems
Rational Open Access: RPG Edition 5250 Screens
RPG Applications
Traditional RPG
Interface JSPs
User Interface
How to Support
Business Other
Logic
Interfaces?
DB Access
Mobile
Other Devices
Servers
© 2010 IBM Corporation
25
- 26. IBM Power Systems
Rational Open Access: RPG Edition
Extend RPG
to reach to
new interfaces Custom
Devices
Workplace
Future
Rich
Devices
Client
Eclipse
RPG IV Mobile
Rich
Client
+ Open Browsers
Access
SOA Portal
Interface
Web
Browsers
© 2010 IBM Corporation
IBM Power Systems
Rational Open Access: RPG Edition
?
RPG Applications
Handler code to manage building the
interface and proprietary information
Handler Defined
program
I/O buffer
WRITE record
Other information:
•state
•names
•pointers
RPG Runtime Display Manager
IBM i
© 2010 IBM Corporation
26
- 27. IBM Power Systems
Rational Open Access: RPG Edition 5250 Screens
RPG Applications
Traditional RPG
Interface JSPs
Target
F Define the Handler Program
Handlers
D***********************
C* Data
C Write Section1
C* : Handlers
C* :
C Write Section2 Target
C : Program
Handlers
Target
Program
Mobile
Other Devices
Servers
© 2010 IBM Corporation
IBM Power Systems
Any RPG device type
Any RPG device type can be defined as an Open Access file:
DISK, PRINTER, or WORKSTN.
The provider of the handling procedure can choose the RPG
device-type that best fits the function that the handler
provides.
Examples
User interface: WORKSTN file
Creating an Excel document: PRINTER file
Accessing a Web service: keyed DISK file
© 2010 IBM Corporation
27
- 28. IBM Power Systems
The RPG coding to define an Open Access file
The HANDLER keyword identifies the location of the handler.
The handler can be a program or a procedure.
Fmyfile cf e workstn extdesc('MYLIB/MYFILE')
F handler('MYLIB/MYSRVPGM(hdlMyfile)')
F usropn
Other examples of the HANDLER keyword
handler('MYLIB/MYPGM')
handler(charVariable)
where charVariable = 'MYLIB/MYPGM' or ‘MYSRVPGM(proc)'
handler(rpgPrototype)
handler(procptrVariable)
© 2010 IBM Corporation
IBM Power Systems
Rational Open Access: RPG Edition
Target Program
(comms code)
Data Handlers
F Define the Handler
D***********************
C*
C Write Section1
C* :
C* :
ISV or Customer
C Write Section2
C :
Rational Open
Access: RPG
Edition
© 2010 IBM Corporation
28
- 29. IBM Power Systems
Rational Open Access: RPG Edition
New Licensed Program Product
– Required for both development and runtime servers
– 5733-OAR
Tier Group Price
– Priced by processor based on software tier
Requires RDPower: RPG and COBOL Development for i as the
development environment
– For syntax checking, semantic checking, etc
© 2010 IBM Corporation
IBM Power Systems
Agenda
Our Investment in RPG IV
Highlights from previous releases
RPG 7.1 Enhancements
Rational Open Access: RPG Edition
Future of RPG IV
© 2010 IBM Corporation
29
- 30. IBM Power Systems
Summary
RPG IV is Alive and Well!!
Continued Continued
Investment Enhancements
from IBM
Keep Your Cards and Letters Coming!!
© 2010 IBM Corporation
IBM Power Systems
Trademarks & Disclaimers
8 IBM Corporation 1994-2002. All rights reserved.
References in this document to IBM products or services do not imply that IBM intends to make them available in every country.
The following terms are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both:
AS/400 IBM(logo)
AS/400e iSeries
e (logo) business OS/400
IBM
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
30
- 31. IBM Power Systems
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
ACTGRP parameter or keyword is not specified, the activation group of the program will default 2010 IBM Corporation in
© to QILE as it did
Allocate teraspace storage
31