15
© Logicalis Group ILE and RPG IV Logicalis Briefing, 9 September 2005

© Logicalis Group ILE and RPG IV Logicalis Briefing, 9 September 2005

Embed Size (px)

Citation preview

© Logicalis Group

ILE and RPG IV

Logicalis Briefing, 9 September 2005

Green screen

5250

Display file

RPG or COBOL program

Physical or logical file

DB2/400

Interface

Presentation andnavigation

Transport

Application logic

Interface to data store

Database

Web browser

WebFacingand/or HATS

Struts/JSF

Entity bean

Session bean

ConnectorsJDBC, MQ, etc.

Web service, e.g. for.Net coexistence

Embedded SQL

An iSeries developer’s roadmap

Another view

RPG IV

RPG III

ILE

SEU/PDM/SDA

Remote Systems Explorer

Java

DDS

Separate presentation from logic (HTML/GUI)

Nativedatabaseaccess

SQL

WDSC J2EE IDE

Support, maintainability and reuseChange control and deployment techniquesPerformanceOpen standardsDebugging

Batch FTP, custom formats

Assured delivery messaging, message transformation, XML

Program-to-program calls

Open standards

component interaction

RPG IV and the Integrated Language Environment

RPG IV

Functionality

Syntax

Why ILE?

Flexibility

Performance

Ease-of-use

RPG/IV Highlights

Specification layout changes (no L or E specs)

New D(efinition) spec

Expanded names - underscore allowed - 10 chars

Upper/lower case source equivalency

Free-form Maths & logical expressions

Date, Timestamp support

Pointer support

Most limits raised or removed

You have to convert - not source compatible

Migration process is straightforward (CVTRPGSRC)

RPG/IV Examples

DQCUSTCDT C 'QCUSTCDT' DPROCDS DS D PTR1 * PROCPTR INZ(%PADDR(QCUSTCDT)) D PROCS 1 1600* PROCPTR DIM(100) DFILEDS DS D FIL1 10A INZ(QCUSTCDT) D FILES 1 1000A DIM(100) DPROC S * PROCPTR C FILE LOOKUP FILES(X) 50 C MOVE *NULL PROC C RETURN

If (A > 10 AND *IN02)EVAL Salary = Salary * 1.25Endif DOU CowsComHom = '1'Exsr MovCowsEval CowsComHom = (CowsInFld = 0 AND

CowsEnRte = 0)

EndDo IF NeedNameEval(P) WholeName = FirstName + ' ' + LastName + '.'EndIf

DName DS BASED(Ptr)D FirstNameD LastnameDARRA S 10 DIM(10)

ILE benefits

Original Program Model (OPM)

Single entry point

Single variable scope, no pointer support

One program = one compilation

Dynamic program-to-program calls with performance overhead

Integrated Language Environment (ILE)

Modular programming with good performance

No need for dynamic program-to-program calls

Mix programming languages without performance overhead

C, C++, COBOL, RPG, CL

Code re-use, multiple entry points

Nested variable scope, pointer support

Faster compilations

ILE example

PTSTSOCKET HOST(PACIFIC6) PORT(1352)If successful, a completion message will be returnedConnection successfully obtained to PACIFIC6 on port 1352Otherwise, an appropriate escape message will be returnedHost CAT32 name resolved but no connection was possible on port 1352

Invocation: dynamic (external) versus bound (internal)

Program A

Program A subroutine calls another subroutine in same program:INTERNAL CALL

Program B

Program C

SUB1

SUB2Program B calls Program CEXTERNAL CALL

Structure of a simple ILE program

Procedure CRTINVNBR

Procedure DATEHANDLE

RPGMOD1

Module MOD1

Module MOD3

Program INVMAST

CBLMOD1

Module MOD2

Programs

*PGM object. OPM via CRTxxxPGM, ILE via CRTPGM

*PGMs contain 1 or more modules

Modules

*MODULE object type

Contains translated but unexecutable code

Must be BOUND into a program to run

Input is a source member

May contain one or more procedures

Procedures

Executable code with entry point

Not an AS/400 object

RPG & Cobol: 1 per compilation, C: many per compilation

Appear on CALL stack

Binding

Procedure CRTINVNBR

Procedure DATEHANDLE

Module RPGMOD1

Module CMOD3

Module CBLMOD2

Program INVMAST

Module RPGMOD1

Module CBLMOD2

Module CMOD3

Procedure CRTINVNBR

Procedure DATEHANDLE

CRTPGM INVMASTMOD(RPGMOD1 +CBLMOD2 +CMOD3)Cobol

SRCMBR

CBLMOD2

RPG SRCMBR

RPGMOD1

C SRCMBR

CMOD3

CRTRPGMOD

CRTCBLMOD

CRTCMOD

CALLB CBLMOD2

CALL LINK CMOD3PROC CRTINVNBR

Program INVMAST is statically bound by copy

Service programs

Procedure CRTINVNBR

Procedure DATEHANDLE

Module MODX

Module CMOD3

Module MODY

*SRVPGM SRV1

Module MODX

Module MODY

Module CMOD3

Procedure CRTINVNBR

Procedure DATEHANDLE

CRTSRVPGM +SRV1 +MOD(MODX +MODY +CMOD3)

Cobol SRCMBR

MODY

RPG SRCMBR

MODX

C SRCMBR

CMOD3

CRTRPGMOD

CRTCBLMOD

CRTCMOD

Service program is analogous to subroutine library or DLL

Activation groups

Menu

FILEX

INV1 INV2 INV3

ActGrp INV

FILEX

OE1 OE2 OE3

ActGrp OE

Default Group

OPM Pgm

OPM Pgm

OPM Pgm

Activation groups

Applications can be separated more cleanly at run time

Activation groups own resources such as ODPs, Commit Scope, exception handlers and SQL cursors but not Overrides

A default activation group created for OPM and IBM code

CRTPGM and CRTSRVPGM commands specify activation groups:

By name

*CALLER

*NEW

Requires some design thought, especially if exception handling is used and if OPM and ILE programs are mixed

Watch out for third party usage!

Hints and tips

Don’t go overboard …

Change control and regression testing impact