As has been suggested by myself (my first 2 items implied it) and others
- Don't do it. Don't argue. Let it come of its own accord.
Gary
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of sjl
Sent: Thursday, April 14, 2011 2:56 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Reasons for using RPGIV
Here is what I have come up with so far - see below...
- sjl
RPGIV versus RPG/400 (V5R4M0)
April 14, 2011
Subprocedures and prototypes
o Code isolation
* local variables
* Simplifies program changes and testing
* Lowers coupling between modules (a good thing)
o Simplifies program coding when using service programs (which contain
reusable subprocedures)
* Enhances productivity though code re-use
o Binding source makes it possible to add new subprocedures
to existing service programs without having to
recompile all programs which use the service program.
* Mixed programming language support by allowing modules
written in different ILE languages to be bound into a
single program object
* Performance improvement when using bound programs
o Prototypes can reduce the errors caused by coding
program/subprocedure calls incorrectly.
One of the most common sources of difficult-to-debug errors
comes from having mismatched parameters between the
caller and the called routine.
Free-Form code
o Procedural language
o Easier to read (English-like)
o Blank lines allowed
o Longer comments permitted in-line with the RPG code
o Mixed case permitted
o Easier to maintain
o Easier to learn than fixed-format RPG
o More resembles modern programming languages
o Native ability to parse XML documents
* XML-INTO
* XML-SAX
File handling
o Unlimited number of files can be defined in a program
o RPGIV allows renaming all fields within a record format
at the file level with one line of code
Examples:
Prefix( AA : 2 ) changes the current field prefix to 'AA',
thus SDDOCO becomes AADOCO
Prefix(AA) prepends 'AA' to the existing field names,
thus SDDOCO becomes AASDDOCO
o User-opened files can be overridden to other files with
EXTFILE keyword, eliminating the need to use
OVRDBF before calling the program
Data Structures
o Unlimited number of data structures can be defined
o RPGIV allows renaming all fields within a externally-defined
data structure with one line of code
Example: Prefix( AA : 2 )
o By using Prefix('XX') to rename fields within a data structure,
ability to define an multiple external data structures over the
same file without errors caused by duplicate field names
in the data structures.
o Qualified data structures make code more readable.
o Key data structures
* LikeRec (see PDC4701A)
o Read a record from a file directly into a data structure
* LikeRec (see PDC4701A)
o Write a record to a file directly from a data structure
* LikeRec (see PDC4701A)
o Except for the DSTXT data structure, it is unnecessary
to specify From & To positions for subfields -
only subfield lengths need to be specified
o LikeDS allows defining new data structures
the same as existing data structures
o Overlay keyword simplifies overlaying fields within a data structure
* Overlay an array over data structure subfields
* Data structure arrays can be sorted
* Data structure arrays can be sorted by a sub-field
Variables
o Underscore character permitted in variable names
o Long variable names allowed (up to 4096 characters in length)
* Self-documenting
o Longer variables (up to 65535 characters)
o More data types allowed
* Pointer support
o INZ keyword allows work field initialization in D-specs
o On D-spec field definition, LIKE keyword allows defining
fields similar to existing fields
(similar to *LIKE DEFN in RPG/400)
o Indicators
* Named Indicators make code easier to read
* Less dependence on indicators - an RPGIV program
can usually be written without using /any/ indicators
Access to iSeries / System i / IBM i operating system resources
o Ability to use C run-time library functions
* Simplifies executing CL commands from within RPG programs
* Ability to directly manipulate (read, write, update) stream files
in the IFS (and QNTC or NFS) from RPG programs
o Access to System API's and MI built-in functions
o Access to Java Functions (See existing program Pxxxxxx)
RPGIV allows recursion
New Operation Codes
o EVAL
o EVALR
o CALLP
o CALLB
o XML-INTO (free-form only)
o XML-SAX (free-form only)
RPGIV Built-In Functions (BIF's)
(approximately 90 currently available)
o Date-and-time functions
o Data conversion and string-handling functions are
easier to read and understand, simplify coding
* %SUBST
* %REPLACE
* %TRIM
* %EDITC
* %CHAR
* %DEC
* %ADDR
Expressions
o Ability to specify complex mathematical expressions in a single
line of
code
o Logical expressions easier to understand
Examples:
If %EOF ( FILE ); {used for READ operations}
If %EQUAL ( FILE ); {used for SETLL operations}
If %FOUND( FILE ); {used for CHAIN operations}
o Character expressions
Example:
Message = 'File ' + FileName + ' not found';
Arrays/Tables
o Unlimited number of Arrays and Tables
o Enhanced array and table handling
* More elements
* Longer elements
* Multidimensional arrays
Better exception and error handling capabilities
o MONITOR - ENDMON operation codes
o Operation extenders reduce (eliminate) dependence on
indicators for detecting errors, making code easier to
read and maintain
Example:
READ(E) FILE;
If %Error();
// do something
EndIf;
As an Amazon Associate we earn from qualifying purchases.