ibm i application development strategy - lisug · ibm i application development strategy tim rowe...

31
1 © 2011 IBM Corporation IBM Power Systems IBM i Application Development Strategy Tim Rowe Application Business Architect, Development Environments, IBM i Development © 2011 IBM Corporation IBM Power Systems 2 New Development Paradigms Graphical User Experiences Grown from GUIs to Experiences Agile Development Work in highly collaborative groups Time line is strict Small adaptive modules Framework Development Consistency in code creation Component based Model – View – Controller – Agile Services Orientation Componentized code Business based Distributed function

Upload: dangnhu

Post on 30-Aug-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

1

© 2011 IBM Corporation

IBM Power Systems

IBM i Application Development Strategy

Tim RoweApplication Business Architect, Development Environments, IBM i Development

© 2011 IBM Corporation

IBM Power Systems

2

New Development Paradigms

� Graphical User Experiences

– Grown from GUIs to Experiences

� Agile Development

– Work in highly collaborative groups

– Time line is strict

– Small adaptive modules

� Framework Development

– Consistency in code creation

– Component based

– Model – View – Controller

– Agile

� Services Orientation

– Componentized code

– Business based

– Distributed function

2

© 2011 IBM Corporation

IBM Power Systems

3

Services Orientation - SOA

� Modular

� Reusable

� Loosely Coupled

� Standards based

Services Directory

© 2011 IBM Corporation

IBM Power Systems

4

Application Development in the Power Market

SOA

3

© 2011 IBM Corporation

IBM Power Systems

5

Application Development Strategy for IBM i

Compilers

Embrace Open Source Solutions and Partners to Complete Application Development Portfolio

Common developer desktop across operating systems and languages

Common development infrastructure for Power and the world around Power

High performance compilers reaching to new technologies

© 2011 IBM Corporation

IBM Power Systems

6

Compilers for Optimized Performance

� Compilers tightly integrated with operating systems and POWER7 hardware

� Binary compatibility

– Applications will move to POWER7 with no recompile required

S/36 and S/38 environment applications also

� Rational Open Access: RPG Edition - new offering for RPG

– Long requested feature from customers and partners

4

© 2011 IBM Corporation

IBM Power Systems

7

Integration

i Architecture

Single Level Store Object Based Architecture

Work Management

Technology Independent Machine Interface

... ...

Provides built-in application virtualizationIntegrates business components, e.g. database

Enables integrity, security, virus-resistanceAutomates & optimizes storage management

Ensures application compatibility across multiple technology generations

Language Runtimes (RPG, COBOL, C, C++)

Optimizes underlying IBM i and hardware

Multi-coreMulti-threads

© 2011 IBM Corporation

IBM Power Systems

8

Commitment to RPG and COBOL

Hayden LindseyVice President and Distinguished Engineer

Enterprise Modernization, Modeling, Construction and Compilers

IBM Rational

5

© 2011 IBM Corporation

IBM Power Systems

9

Rational Development Studio for i

5770-WDS

Compilers on IBM i

�Rational Development Studio– RPG, COBOL, C, and C++ compilers for IBM i

– Previously called WDS: “WebSphere Development Studio for System i”

– Designed for creating modern business applications

Feature: ILE Compilers• ILE RPG• ILE RPG *PRV Compiler• ILE COBOL• ILE COBOL *PRV Compiler• ILE C• ILE C++• IXLC for C/C++

Feature: Heritage Compilers• S/36 Compatible RPG II• S/38 Compatible RPG II• RPG/400 (RPG III)_• S/36 Compatible COBOL• S/38 Compatible COBOL• OPM COBOL

Feature: ADTS• PDM• SEU• SDA• RLU

Stabilized StabilizedNew Enhancements

WebSphere Development

Studio for IBM i

© 2011 IBM Corporation

IBM Power Systems

10

RPG IV Goals for the Language

Three main goals for RPG IV

– Interoperability

• Java

• XML

• SQL

– Readability

• Free form

• Blank lines

• Comments

– Functionality

• Procedures

• Data areas/data structures

• More data types

• Extended file support

6

© 2011 IBM Corporation

IBM Power Systems

11

/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

Modern RPG

© 2011 IBM Corporation

IBM Power Systems

12 IBM Confidenti

al

ILE RPG enhancements

� New and updated built-in functions %LEN, %SCANRPL,

%PARMNUM

� Implicit unicode conversion for parameters

� Sort and search data structures

� Sort Ascend or descend

� Performance when returning large values

� Optional prototypes

� Support for ALIAS names in externally-described data structures

� New options for XML-INTO (also available with a PTF for 6.1)

� Support for Open Access RPG Edition (also available with a PTF

for 6.1)

7

© 2011 IBM Corporation

IBM Power Systems

13 13

Rational Open Access: RPG Edition

Extending RPG to reach new interfaces

RPG IV

+ Open Access

WebBrowsers

MobileBrowsers

Databases

Custom Devices

RichClients

XML Interfaces

SOA Interface

Future Devices

<?xml?>

© 2011 IBM Corporation

IBM Power Systems

14

Rational Open Access: RPG Edition*DSPF example 5250 Screens

RPG Application

WRITE recordDisplay file

object

* DSPF

5250 datastream

RPG Runtime

Other information:

•state

•names

•pointers

Display Manager

IBM i

program

I/O buffer

8

© 2011 IBM Corporation

IBM Power Systems

15

RPG Application

Handler Defined

WRITE record

program

I/O buffer

IBM i

Handler code to manage building the

interface and proprietary information

RPG Runtime Display Manager

?

Rational Open Access: RPG Edition*DSPF example

Other information:

•state

•names

•pointers

© 2011 IBM Corporation

IBM Power Systems

16

IBM i Open Source Strategy

� Encourage Open Source vendors to port to IBM i (PASE)

� Encourage Open Source vendors to provide support

� PHP and MySQL run on IBM i

� IBM i PASE Development Team is testing other Open Source products

9

© 2011 IBM Corporation

IBM Power Systems

17

Over one-third of the Web runs on PHP

17

© 2011 IBM Corporation

IBM Power Systems

18

Open Source Solutions for i

� Zend Server Community Edition for i

– Preloaded with IBM i 7.1, 6.1, 5.4

� Zend Server for i

– Provides advanced functions

– Available from IBM with advanced support offerings

� Zend Studio for i

– Eclipse-based development environment

– Available with one year of Silver support from Zend for no additional charge

� Other Open Source Products:

DB2Community

Edition

10

© 2011 IBM Corporation

IBM Power Systems

19

Modernization on IBM i with PHP

| 22-Sep-11 | 19

Leverage Existing Infrastructure to Develop & Run Dynamic Web Applications Easily

Access DB2/400 Data via Browser

Expose part of RPG Application

Access RPG Programs & Data as Web Services

New/Packaged Web Application on IBM i

19 Modernizing IBM I legacy applications with PHP

© 2011 IBM Corporation

IBM Power Systems

20

New Application Development Support

� Web Services

– New client support – WSDL2RPG - Delivered 12/10

Call Web Services natively from RPG

WSDL converted to native RPG to encapsulate Web Service call

� Zend PHP

– New IBM i PHP Toolkit – GA EOY 2011

Call *PGM, *SVRPGM, *CMD, PASE utilities

– Enhanced Database support – May 2011

Local DB support for MySQL, DB2

Remote DB support for MsSQL, Oracle

DB2DB2

OracleOracle

MsSQLMsSQL

MySQLMySQL

IBM/Zend

PHP Toolkit

Remote DB Connection

Web

Service

Native calls!

11

© 2011 IBM Corporation

IBM Power Systems

21

PHP Integration with i - ToolKit

Easy access to IBM i data and resources from PHP

(similar to IBM ToolBox for Java)

–DB2 for i – SQL and Native

–Program call

–Procedure call

–Data Area

–Data Queue

–Message Queue

–Commands

–System values

–Spool files

http://174.79.32.155/wiki/XMLService/XMLService

© 2011 IBM Corporation

IBM Power Systems

22

XMLSERVICE RAW XML PHP Interfaces

� The basic idea of XMLSERVICE is to allow any scripting language to use XML input/output documents to drive XMLSERVICE job(s) calling PGMs, SRVPGMS, CMDs, PASE shells.

� Call ILE or shell scripts from local PHP OR remote PHP environment

� XML based

12

© 2011 IBM Corporation

IBM Power Systems

23

Leveraging Open Source Application Portfolio

Bulletin BoardContent Management System

Wiki

Customer Relationship Management Help Desk

Portal

e-CommerceCourse Management System

Portal

Portal

© 2011 IBM Corporation

IBM Power Systems

2424

Rational Developer for Power Systems Software

� IBM XL C/C++ for AIX and Linux V11.1

� IBM XL Fortran for AIX and Linux V13.1

� IBM COBOL for AIX V4.1

� IBM PL/I for AIX V2

� IBM Rational Development Studio V7.1

� IBM i compilers

� Rational Open Access: RPG Edition V1.1

Rational Developer for Power V8.0•RPG and COBOL for IBM i•COBOL for AIX•C/C++ for AIX•C/C++ for Linux on Power•C/C++ Development Studio for AIX•COBOL Development Studio for AIX•Power Tools for AIX•Power Tools for IBM i•Power Tools for Linux on Power

•Linux Desktop Support

13

© 2011 IBM Corporation

IBM Power Systems

25

Rational Developer for Power: RPG and COBOLRemote System Explorer (RSE)

� Perspective for access to remote IBM i servers

� Reusable actions, dialogs,widgets, APIs

� Editor for traditional IBM i application code

– RPG, COBOL, C, C++, Java & DDS

� Interface to the compilers

� Debugger

– Multi-language

© 2011 IBM Corporation

IBM Power Systems

26

Higher

Profit

More

Output

AccelerateInnovationGrowth

Application

Modernization

Productivity & Innovation – why its important

Productivity: The measure of output from a process, such as output per labor-hour.

¹ Based on IBM customer study, “Making a Business Case for IBM Rational Developer for i”

20% Boost

In developer

Productivity1

HigherProfit

MoreOutput

JobSatisfactionGrowth

Cost

Effectiveness

14

© 2011 IBM Corporation

IBM Power Systems

27

Why RD Power? Developer View (the fun stuff!)Modern, Eclipse-based, development tools for IBM i

Visual editors, outline views, content assist, integrated language help

Integrated file management, search, edit, compile/build, debug capabilities

Analysis tools (application diagram, call hierarchies, type hierarchies)

Easily debug batch, interactive, and Web applications and Web services with a common

visual debugger

Visual DDS design tools: Screen and Report Designer

Integration with Rational Team Concert

© 2011 IBM Corporation

IBM Power Systems

28

Remote Systems LPEX Editor

�Show me the features

© Copyright 2011 IBM Corporation 28

15

© 2011 IBM Corporation

IBM Power Systems

29

From this…

© Copyright 2011 IBM Corporation 29

PDM & SEU – the editor…

© 2011 IBM Corporation

IBM Power Systems

30

To this…

� SEU look and feel

– Prefix commands

– Format bar

� Modern look and feel

– Colors!

– Modern editor features

Best of Both Worlds

Shortcut to open a member, Ctrl + Shift +

A

© Copyright 2011 IBM Corporation 30

16

© 2011 IBM Corporation

IBM Power Systems

31

Undo / Redo

� Unlimited undo / redo inside of LPEX editor

– Undo changes right back to when member was originally opened

– Even if editor was saved during the editing period

– Edit > Undo | Redo or use more common keyboard shortcuts Ctrl + Z | Ctrl + Y

Number of changes made since last save.

* means editor has unsaved changes

© Copyright 2011 IBM Corporation 31

© 2011 IBM Corporation

IBM Power Systems

32

Copy and Paste

Block copy / paste

Stream based copy / paste

(typical of Workstation software)Uses Windows Clipboard, paste

into another editor, email, or

document editor.

Prefix commands for

copy / paste

© Copyright 2011 IBM Corporation 32

17

© 2011 IBM Corporation

IBM Power Systems

33

Outline View and Content Assist

Cross reference

information

Content assist helps jog

your memory (opcodes, BIFs, fields)

Templates provide a quick way

to insert common code patterns

(free form and SQL). Predefined or define your own!© Copyright 2011 IBM Corporation 33

© 2011 IBM Corporation

IBM Power Systems

34

From this…

© Copyright 2011 IBM Corporation 34

Compile Errors

18

© 2011 IBM Corporation

IBM Power Systems

35

…To ThisLaunch compiles

directly from editor or

pop-up menu.

Compile errors

automatically downloaded and shown in Error List

Double clicking on an error opens editor and

positions to the line© Copyright 2011 IBM Corporation 35

© 2011 IBM Corporation

IBM Power Systems

36

From this…

© Copyright 2011 IBM Corporation 36

Application Diagram ???

19

© 2011 IBM Corporation

IBM Power Systems

37

Application Diagram

ORDENTR member

expanded to view a call graph

ORDENTR member

expanded to view a call graph

Subroutine WrtDtaQ calls

program QSNDDTAQ

Subroutine ChgOrder calls

something inside the

ROUTINES member

Subroutine RqsPart calls

subroutine Process

© Copyright 2011 IBM Corporation 37

© 2011 IBM Corporation

IBM Power Systems

38

Application Diagram

� Application Diagram

– Provides developers with a graphical overview of the structure of their native i5/OS

applications

Call graph showing subroutine, procedure, and program calls

ILE program and service program bindings

– Currently supports ILE RPG, ILE COBOL, CL, programs and service programs

© Copyright 2011 IBM Corporation 38

20

© 2011 IBM Corporation

IBM Power Systems

39

From this…

© Copyright 2011 IBM Corporation 39

Build DDM Screens

© 2011 IBM Corporation

IBM Power Systems

40

Use properties view to

modify attributes and keywords for the file,

records and fields.

Outline view for

navigating in the editor

and selecting the file,

records and fields.

Design areaDesign, source and

preview modes

Screen controls allow you

to specify which records

should be visualized

together in the design area.

Palette: drag and drop

parts from the palette

to the design area.

Scre

en

De

sig

ne

r

© Copyright 2011 IBM Corporation 40

Re

po

rt D

esig

ne

r &

21

© 2011 IBM Corporation

IBM Power Systems

41

From this…

© Copyright 2011 IBM Corporation 41

Integrated Debugger

© 2011 IBM Corporation

IBM Power Systems

42

Debug View controls

the debugger Work with breakpoints

(enable / disable, remove,

add, conditional)

Real time monitoring

of the field values

© Copyright 2011 IBM Corporation 42

Breakpoint (set / remove

by double clicking)

22

© 2011 IBM Corporation

IBM Power Systems

43

Launching the DebuggerOne Click Actions

Attach to a job

(STRSRVJOB)

Always use Service Entry Points to debug any ILE

program / service program!

Single click debug for batch (don’t use for interactive – use

service entry points or debug

job)

© Copyright 2011 IBM Corporation 43

© 2011 IBM Corporation

IBM Power Systems

44

JVM Improves Java Performance

� IBM 32-bit & 64-bit Java™ Virtual Machine

– Shared technology with AIX & Linux improves performance & portability

� Exceptional Java environment and performance. Built by IBM for Power

– Fully compatible with other industry standard Java applications

– Can be called by APIs or directly from RPG

� IBM Java ToolBox

– Pre-coded Java classes to access native IBM i artifacts – files, data queues, etc

0

200

400

600

800

1000

1200

1400

Native JDBC Toolbox JDBC

V5R4 GA V6R1 GA

+68% +78%

Tra

nsa

ctions

per

Second

23

© 2011 IBM Corporation

IBM Power Systems

45

IBM Rational Application Developer (RAD)

• Eclipse-based Java development environment

• Full support for J2EE, web, web services, etc

© 2011 IBM Corporation

IBM Power Systems

46

Rational Application Developer Standard Edition

� Java Web Development tool

� Use RAD SE to build rich Java internet

applications

– improve online user experience

– increase customer satisfaction

� Visual development for Web 2.0

– significant productivity benefits

� Award winning! – 2009 Evans Data Users Choice:

Software Development

24

© 2011 IBM Corporation

IBM Power Systems

47 IBM Confidenti

al

New RPG stuff for IBM i 7.1

the Details…..

© 2011 IBM Corporation

IBM Power Systems

48 IBM Confidenti

al

RPG: %LEN(varying : *MAX)

Problem solved by %LEN(*MAX):

�Starting in V6R1, calculations involving the size of the varying-length prefix

became error-prone because the size might be either 2 or 4.

� In V6R1, %ADDR was enhanced with %ADDR(*DATA) to simplify getting the

address of the data part. Previously, programmers added 2 to %ADDR.

�%LEN(*MAX) simplifies getting the maximum length of the data part.

Previously, programmers subtracted 2 from %SIZE, and then divided by 2 for UCS-2 and DBCS.

Get the maximum number of characters for a varying field.D char_varying S 5000A VARYING

/free

// Pass address and length of the data

conv (%addr(char_varying : *data)

: %len(char_varying : *max));

25

© 2011 IBM Corporation

IBM Power Systems

49 IBM Confidenti

al

RPG: New built-in function %SCANRPL

Problem solved by %SCANRPL:

� Hand-written versions of scan-and-replace tend to be large, error prone, and difficult to maintain.

� The %SCANRPL built-in function replaces all occurrences a string with

another string.

fileErr = ’File &1 not found. Please create &1.’;

msg = %scanrpl (’&1’ : filename : fileErr);

// msg = ’File MYFILE not found. Please create MYFILE.’

© 2011 IBM Corporation

IBM Power Systems

50 IBM Confidenti

al

RPG: New built-in function %PARMNUM

D myProc pi 10A OPDESC

D company 25A OPTIONS(*VARSIZE)

D city 25A OPTIONS(*VARSIZE)

CEEDOD (2 : more parms); // hard to understand

CEEDOD (%PARMNUM(city) : more parms); // better

Problem solved by %PARMNUM:�Parameter-information APIs such as CEEDOD or CEETSTA

require a parameter’s number.�The %PARMNUM built-in function returns a parameter’s

position in the parameter list.�Soft-coding the parameter’s number makes the code easier to

read and maintain.

26

© 2011 IBM Corporation

IBM Power Systems

51 IBM Confidenti

al

RPG: Implicit CCSID conversion - parms

� Implicit CCSID conversion is now supported for prototyped parameters passed by VALUE and by read-only reference (CONST)

� This reduces the number of code changes that have to be made when a database field is changed from alphanumeric or DBCS to Unicode (UCS-2 or UTF-16).

� Prior to this change, if the type (A, C or G) of a passed parameter was not the same as the prototype, the compiler would issue a diagnostic. With this change, the compiler will implicitly convert the passed parameter to the type of the prototype.

In the example below, there is only one “makeTitle” procedure with a UCS-2 parameter and return value. If the passed parameter is alpha or DBCS, it will be converted to UCS-2 on the call. The procedure will work with the UCS-2 parameter and return a UCS-2 value. This returned value can then be converted on assignment to alpha or DBCS, if necessary.

// makeTitle() upper-cases the parameter// and centers it within the provided length

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

© 2011 IBM Corporation

IBM Power Systems

52

Sort & Search

SORT AND SEARCH DATA STRUCTURE ARRAYS: �To sort or search a data structure array, one subfield is identified as the

"key" for the array, using the syntax ARRAY(*).KEYSUBFIELD.

Example: Sort the INFO array by the SALARY subfield and search for the

name. Note that 'Jack' in the NAME subfield of the INFO array.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);

27

© 2011 IBM Corporation

IBM Power Systems

53 IBM Confidenti

al

RPG: Sort and search data structure arrays

� The (*) index identifies the array to be sorted. Any other arrays in the expression must have a numeric index.

� The subfields preceding the (*) index indicate the array to be sorted. The subfields following the (*) array represent the key to be searched or sorted.

// sort family array by age of first childSORTA family(*).child(1).age;

// sort child array in each family by agefor i = 1 to numFamily;

SORTA family(i).child(*).age;endfor;

© 2011 IBM Corporation

IBM Power Systems

54 IBM Confidenti

al

RPG: Sort ascending or descending

D meetings S D DIM(100)

/free

// sort descending, with the

// most recent date first

sorta(d) meetings;

�Non-sequenced arrays can be sorted either ascending or descending.

�Extender indicates a descending sort.

�Extender indicates ascending (default).

28

© 2011 IBM Corporation

IBM Power Systems

55 IBM Confidenti

al

RPG: Performance returning large values

D center pr 100000a varying

D rtnparm

D text 50000a const varying

D len 10i 0 value

D title s 100a varying

/free

title = center ('Chapter 1' : 60);

�RTNPARM keyword greatly improves performance when a procedure

returns a large value�The speed of using a parameter with the convenience of using a return

value

�Especially noticeable when the prototyped return value is a large varying

length value

© 2011 IBM Corporation

IBM Power Systems

56 IBM Confidenti

al

RPG: Optional prototypes

�If a program or procedure is not called by another RPG module, it is optional to specify the prototype.

�These are some of the programs and procedures that do not require an RPG 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

29

© 2011 IBM Corporation

IBM Power Systems

57

RPG: Optional prototypes

57

Here is an RPG module with a main procedure and a subprocedure. No prototypes are necessary.

H main(hello)

P hello b

D pi extpgm('HELLO')

D name 10a const

/free

sayHello();

...

P sayHello b

/free

dsply ('Hello ' + name);...

© 2011 IBM Corporation

IBM Power Systems

58 IBM Confidenti

al

RPG: Support for ALIAS namesBackground� Fields in externally described files can have a standard name up to 10 characters and an alternate (ALIAS) name up to 128

characters.

� RPG III only allowed 6 characters, so many customers have files with cryptic names like CUSNAM, CUSADR. The files often

have alternate names such as CUSTOMER_NAME and CUSTOMER_ADDRESS, that can be used in SQL queries.

� RPG programmers would like to use the alternate names in their RPG programs.

New ALIAS keyword for RPG� When ALIAS is specified, RPG will use the alternate name instead of the 10-character standard name.

� Supported on F specs for any file that will not have Input or Output specs generated. Used for LIKEREC data structures.

� Supported on D specs for any externally-described data structure.

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;

30

© 2011 IBM Corporation

IBM Power Systems

59 IBM Confidenti

al

RPG XML-INTO: new option datasubf

The new datasubf option enables XML-INTO to support XML elements in this form <emp type=“regular” id=“13573”>John Smith</emp>

Problem solved by datasubf:

� When an XML element has attributes or child elements, the XML element (emp) itself matches an RPG data structure and the attributes (type, id) match the subfields. (Child elements would also match subfields.) If there is text data for the data structure (“John Smith”), there is no XML name available for subfield matching.

� Without the datasubf option, two XML-INTO operations would be needed to get the data from that XML element.

– One XML-INTO would get the type and id values

– One XML-INTO would get the value “John Smith”

– The allowextra=yes option would be needed for both XML-INTOs

© 2011 IBM Corporation

IBM Power Systems

60 IBM Confidenti

al

RPG XML-INTO: datasubf example

<emp type=“regular” id=“13573”>John Smith</emp>

RPG coding to get the information with one XML-INTO operation:

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’

31

© 2011 IBM Corporation

IBM Power Systems

61 IBM Confidenti

al

RPG XML-INTO: new option countprefix

The new countprefix option enables RPG programmers to get more information about anXML document using XML-INTO.

Problem solved by countprefix:

� When an XML element has a variable number repeating elements, it matches an RPG array. The RPG programmer has to code the maximum elements for the RPG array, but the XML document will usually have fewer elements.

� Without the countprefix option,

– The allowmissing=yes option would be required, also allowing other necessary data to be missing

– The RPG programmer would have to figure out how many XML elements there were by looking for some default value.

© 2011 IBM Corporation

IBM Power Systems

62 IBM Confidenti

al

RPG XML-INTO: countprefix

The countprefix option gives the prefix for the subfields to receive the count of the number of XML elements used to fill the RPG array.

<team>

<manager>Jack Spratt</manager>

<emp>John Smith</emp>

<emp>Mary Jones</emp>

</team>

The RPG data structure.

D team DS

D manager 25A

D emp 25A dim(100)

D numemp 10i 0

No "numemp" tag in the XML for subfield "numemp".