RPG investment

31
1 © 2010 IBM Corporation IBM’s Investment in RPG Past, Present and Future Alison Butterill Power Systems Software © 2010 IBM Corporation IBM Power Systems 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. Disclaimer

description

COMMON Europe Congress 2012 - Vienna

Transcript of RPG investment

Page 1: RPG investment

1

© 2010 IBM Corporation

IBM’s Investment in RPGPast, Present and Future

Alison ButterillPower Systems Software

© 2010 IBM Corporation

IBM Power Systems

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.

Disclaimer

Page 2: RPG investment

2

© 2010 IBM Corporation

IBM Power Systems

Commitment to RPG

Hayden LindseyVice President and Distriguished Engineer

Enterprise Modernization, Modeling, Construction and Compilers

IBM Rational

© 2010 IBM Corporation

IBM Power Systems

Our Investment in RPG IVHighlights from previous releases

RPG 7.1 EnhancementsRational Open Access: RPG EditionFuture of RPG IV

Agenda

Page 3: RPG investment

3

© 2010 IBM Corporation

IBM Power Systems

RPG IV – A Concept Comes Forth

Three main goals for RPG IV1. 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• New Definition specification (D-spec)

•Clear, concise, consistent•Built in functions•Most limits raised or remved•Source migration tool provides•All this and support for ILE

*PGM PGMA

CRTPGM...MOD(X Y Z)

RPGSource

X

CRTRPGMOD*MODULE X

PRC X

RPGSource

Y

CRTRPGMOD *MODULE Y

PRC Y

RPGSource

Z

CRTRPGMOD *MODULE Z

PRC X

*MODULE Z*MODULE Y*MODULE X

PRC Y PRC P1

• Expanded names•10 characters allowed•Underscore supported

•Upper and Lower case source•More readable, maintainable

•Free form expressions•Date and time support

Page 4: RPG investment

4

© 2010 IBM Corporation

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 typesFloating point Null terminated strings (%STR)

• New Built-In functionsString 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 arithmeticadding an offset to a pointer, subtracting an offset from a pointerdetermining the difference between two pointers.

• Long nameslonger than 10 characters

Page 5: RPG investment

5

© 2010 IBM Corporation

IBM Power Systems

V4R2… RPG IV

• Indicator Data TypeData areas of type *LGL (logical)Indicator data structure (INDDS)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 TypeNew Built-In functions

• ‘Permanent’ compiler optionsUse H specification keyword instead of compile options on CRTBNDRPG and CRTRPGMOD

• Other enhancementsMixed case procedure and variable names on IMPORT & EXPORT keywordsBNDDIR (binding directory) option on CRTRPGMODCustomers Requirements

Associate *LGL and INDDS with each WORKSTN file

that uses INDARA(instead of *IN array)

Simplifies string handling

© 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

Page 6: RPG investment

6

© 2010 IBM Corporation

IBM Power Systems

•Increasing Java-related supportEXTPROC maps to Object (CLASS) methodsCLASS keyword on the D specSTATIC 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

V5R1

© 2010 IBM Corporation

IBM Power Systems

/FREEread file; // Get next recorddow 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

Free Form C-Spec

Page 7: RPG investment

7

© 2010 IBM Corporation

IBM Power Systems

D cust DS QUALIFIED D name 50a D id_num 10i 0D part DS QUALIFIEDD 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 = 100035C eval part2.name = 'Telephone'C eval part2.id_num = 100036

Qualified Data Structures

© 2010 IBM Corporation

IBM Power Systems

• 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 OperatorsVariable1 += Variable2

V5R2 - Another BIG release

Page 8: RPG investment

8

© 2010 IBM Corporation

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

V5R4Embedded 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, *DUMPSEU, add syntax checking for free-form RPG

Page 9: RPG investment

9

© 2010 IBM Corporation

IBM Power Systems

/free exec sqlWHENEVER SQLERROR GOTO handleError; outSqlMsg = *blanks;

exec sqlSELECT 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 sqlGET DIAGNOSTICS CONDITION 1

:outSqlMsg = MESSAGE_TEXT; orderCount = 0;

endif; return orderCount;

/end-free

Embedded SQL in Free Format RPG

© 2010 IBM Corporation

IBM Power Systems

XML SupportXML-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 DSD name 10A D val 5I 0 DIM(2)D**********************************

/free

XML-INTO info %XML('myfile.xml' : 'doc=file');// info now has the value// name = ‘Frank'// val(1) = 10// val(2) = -5

<info>

<name>Frank</name>

<val>10</val>

<val>-5</val>

</info> MyFile.XML

Target Field

Source of XML Options

Page 10: RPG investment

10

© 2010 IBM Corporation

IBM Power Systems

V6R1 Enhancements

Data structure type definitionsNo more compile-time overridesDefining files locally in subprocedures, and passing files as parametersSignificantly higher limits for the size of variables and array elementsA new kind of RPG main procedureRelaxation 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

Page 11: RPG investment

11

© 2010 IBM Corporation

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 subprocedureGlobal 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.

Page 12: RPG investment

12

© 2010 IBM Corporation

IBM Power Systems

LIKEFILE Keyword

Use to define files to same setting as another File SpecificationIf 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.

Page 13: RPG investment

13

© 2010 IBM Corporation

IBM Power Systems

File Templates

FcustF LIKEFILE(custF_t)F EXTFILE(*EXTDESC)

To use a file as a template: – Add the TEMPLATE keyword – File will be used at compile time for LIKEFILE definitions

To define a “real” file that can be used at runtime or passed as a parameter: – Define the file using LIKEFILE.

FcustF_t IF E K DISK TEMPLATE EXTDESC(‘CUSTF’)

© 2010 IBM Corporation

IBM Power Systems

Qualified Record Formats

read inFile.custRec custDs;if not %eof(inFile);

if custDs.amtOwing > 1000;

Using qualified record formats makes it easier to read and maintain RPG code.

Consider this code without qualified names:

Compare to this version using qualified names:

read custRec custDs;if not %eof(inFile);

if amtOwing > 1000;

Page 14: RPG investment

14

© 2010 IBM Corporation

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 isover 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 thefield; 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 OCCURSNo 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).

Page 15: RPG investment

15

© 2010 IBM Corporation

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 CycleNow 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 keywordThe main subprocedure can only be called by a program call.

Page 16: RPG investment

16

© 2010 IBM Corporation

IBM Power Systems

Main With No Cycle Example

H MAIN(ordEntry)

D ordEntry PR EXTPGM(‘ORDENTRY’)D custname 10A CONST

P ordEntry BD ordEntry PID custname 10A CONST... code the main procedure logic here... when it reaches the end, it just returns... *INLR has no meaningP 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.

Page 17: RPG investment

17

© 2010 IBM Corporation

IBM Power Systems

Relaxed UCS-2 Rules

V5R3M0 TGTRLS(*CURRENT): SI24532V5R4M0 TGTRLS(*CURRENT): SI26312V5R4M0 TGTRLS(*PRV) : SI25232

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:

© 2010 IBM Corporation

IBM Power Systems

Module Size Reduced

Option now available to eliminate unused variables from the compiled objectNew 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.

Page 18: RPG investment

18

© 2010 IBM Corporation

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

Page 19: RPG investment

19

© 2010 IBM Corporation

IBM Power Systems

Parameter Information Stored in the Program

For both the RPG IV and ILE COBOL compilersPCML 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 COBOLThe 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.

Page 20: RPG investment

20

© 2010 IBM Corporation

IBM Power Systems

Parameter info in program – V5R4 PTFs

PTF support for V5R4Part 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.ibm.etools.iseries.pgmgd.doc/c0925076180.htm

© 2010 IBM Corporation

IBM Power Systems

Our Investment in RPG IVHighlights from previous releases

RPG 7.1 EnhancementsRational Open Access: RPG EditionFuture of RPG IV

Agenda

Page 21: RPG investment

21

© 2010 IBM Corporation

IBM Power Systems

RPG 7.1 Enhancements

Sorting Arrays Leave and Iter with ConditionSupport Alias namesImplicit conversion between characters and UCS-2Opening of RPG InterfaceTool 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

Search for an element in the custDs array where the

Sort an array either ascending or descendingSort using SORTA(A) or SORTA(D)

array cannot be a sequenced array (ASCEND or DESCEND keyword).Sort the salary array in descending order

SORTA custDs(*).amount_owing;

elem = %LOOKUP("K" : custDs(*).account_status)

SORTA(D) salary

Page 22: RPG investment

22

© 2010 IBM Corporation

IBM Power Systems

Scan and Replace

string2 = 'See Paul. See Paul run. Run Paul run.'

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

After

string1 = 'See NAME. See NAME run. Run NAME run.'

string2 = %ScanRpl('NAME' : 'Paul' : string1)

© 2010 IBM Corporation

IBM Power Systems

Pass Any Type of String Parameter

alphaTitle = makeTitle(alphaValue : 50) ucs2Title = makeTitle(ucs2Value : 50) dbcsTitle = makeTitle(dbcsValue : 50)

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 parameterCharacter 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

Page 23: RPG investment

23

© 2010 IBM Corporation

IBM Power Systems

%LEN(field-defined-as-varying : *MAX)

Encrypted listing debug view

Allows distribution of debuggable programs without exposing source code via listing viewListing view will only be seen by person doing debug if encryption key has been enteredUse DBGENCKEY parameter on CRTRPGMOD, CRTBNDRPG or CRTSQLRPG commands.

Retrieves the maximum number of characters for a varying-length character, UCS-2 or Graphic field

Varying Length

© 2010 IBM Corporation

IBM Power Systems

Alias

D custDs e ds ALIAS D QUALIFIED EXTNAME(custFile) /free custDs.customer_name = 'John Smith'; custDs.customer_address = '123 Mockingbird Lane'; custDs.id = 12345;

Retrieves the maximum number of characters for a varying-length character, UCS-2 or Graphic fieldUse ALIAS names in externally-described data structuresUse the ALIAS keyword on a Definition specification to indicate that you want to use the alternate names for the subfields of externally-described data structuresUse 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

RPG:

A R CUSTREC A CUSTNM 25A ALIAS(CUSTOMER_NAME) A CUSTAD 25A ALIAS(CUSTOMER_ADDRESS) A ID 10P 0

DDS:

Page 24: RPG investment

24

© 2010 IBM Corporation

IBM Power Systems

Our Investment in RPG IVHighlights from previous releases

RPG 7.1 EnhancementsRational Open Access: RPG EditionFuture of RPG IV

Agenda

© 2010 IBM Corporation

IBM Power Systems

Rational Open Access: RPG Edition 5250 Screens

RPG Applications

User Interface

BusinessLogic

DB Access

Traditional RPG Interface

Page 25: RPG investment

25

© 2010 IBM Corporation

IBM Power Systems

Rational Open Access: RPG Edition 5250 Screens

RPG Applications

WRITE recordDisplay file

object * DSPF

5250 datastream

RPG Runtime

Other information: •state•names•pointers

Display Manager

IBM i

program I/O buffer

© 2010 IBM Corporation

IBM Power Systems

Rational Open Access: RPG Edition

Mobile Devices

5250 Screens

RPG Applications

User Interface

BusinessLogic

DB Access

Other Servers

JSPs

How to Support Other

Interfaces?

Traditional RPG Interface

Page 26: RPG investment

26

© 2010 IBM Corporation

IBM Power Systems

Rational Open Access: RPG Edition

Extend RPGto reach tonew interfaces

RPG IV+ Open Access

WebBrowsers

MobileBrowsers

Portal

Custom Devices

EclipseRich

Client

Workplace Rich

Client

SOA Interface

Future Devices

© 2010 IBM Corporation

IBM Power Systems

RPG Applications

Handler Defined

WRITE recordprogram I/O buffer

IBM i

Handler code to manage building the interface and proprietary information

RPG Runtime Display Manager

?Rational Open Access: RPG Edition

Other information: •state•names•pointers

Page 27: RPG investment

27

© 2010 IBM Corporation

IBM Power Systems

Rational Open Access: RPG Edition

Mobile Devices

5250 Screens

RPG Applications

JSPs

Data

Target Program

Handlers

Target Program

Target Program

Handlers

Handlers

F Define the Handler D***********************C*C Write Section1C* :C* :C Write Section2C :

Other Servers

Traditional RPG Interface

© 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.

ExamplesUser interface: WORKSTN fileCreating an Excel document: PRINTER file Accessing a Web service: keyed DISK file

Page 28: RPG investment

28

© 2010 IBM Corporation

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 keywordhandler('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

ISV or Customer

Target Program (comms code)

HandlersDataF Define the HandlerD***********************C*C Write Section1C* :C* :C Write Section2C :

Rational Open Access: RPG Edition

Page 29: RPG investment

29

© 2010 IBM Corporation

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

Our Investment in RPG IVHighlights from previous releases

RPG 7.1 EnhancementsRational Open Access: RPG EditionFuture of RPG IV

Agenda

Page 30: RPG investment

30

© 2010 IBM Corporation

IBM Power Systems

Continued Enhancements

Continued Investment from IBM

Keep Your Cards and Letters Coming!!

RPG IV is Alive and Well!!

Summary

© 2010 IBM Corporation

IBM Power Systems

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:

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.

AS/400 IBM(logo)AS/400e iSeriese (logo) business OS/400IBM

Trademarks & Disclaimers

Page 31: RPG investment

31

© 2010 IBM Corporation

IBM Power Systems

Faster return valuesA procedure defined with the RTNPARM keyword handles the return value as a hidden parameter. When a procedthe 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 functionThe %PARMNUM(parameter_name) built-in function returns the ordinal number of the parameter within the paramkeyword.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 prototypesIf 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 programA 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 modelRPG 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 procUse 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 sACTGRP(*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 assignACTGRP parameter or keyword is not specified, the activation group of the program will default to QILE as it did in

Allocate teraspace storage