× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You can go to: http://publib.boulder.ibm.com/iseries/v5r1/ic2924/index.htm?
and see all this information you need.

In addition, I have I have few notes here:
The improvements to RPG IV in V5R1 are so substantial that some have taken to
calling it RPG V. And when the new features are used to their full potential,
V5R1 RPG programs can look like a different language.  The major enhancements to
RPG IV since V4R4 are easier interfacing with Java?, new built-in functions,
free form calculation specifications, control of which file is opened, qualified
subfield names, and enhanced error handling.

RPG: Improved support for calls between Java and ILE RPG using the Java Native
Interface (JNI)
 A new data type: Object
 A new definition specification keyword: CLASS
 The LIKE definition specification keyword has been extended to support objects.
 The EXTPROC definition specification  keyword has been extended to support Java
procedures.
 New status codes.

RPG: New BIFs
Functions for converting a number into a duration that can be used in arithmetic
expressions: %MSECONDS, %SECONDS, %MINUTES, %HOURS, %DAYS, %MONTHS, and %YEARS.
The %DIFF function, for subtracting one date, time, or timestamp value from
another.
Functions for converting a character string (or date or timestamp) into a date,
time, or timestamp: %DATE, %TIME, and %TIMESTAMP.
The %SUBDT function, for extracting a subsetof a date, time, or timestamp.

RPG: New BIFs
Functions for allocating or reallocating storage: %ALLOC and %REALLOC.
Functions for finding an element in an array: %LOOKUP, %LOOKUPGT, %LOOKUPGE,
%LOOKUPLT, and %LOOKUPLE.
Functions for finding an element in a table: %TLOOKUP, %TLOOKUPGT, %TLOOKUPGE,
%TLOOKUPLT, and %TLOOKUPLE.
Functions for verifying that a string contains only specified characters (or
finding the first or last exception to this rule): %CHECK and %CHECKR
The %XLATE function, for translating a string based on a list of from-characters
and to-characters.
The %OCCUR function, for getting or setting the current occurrence in a
multiple-occurrence data structure.
The %SHTDN function, for determining if the operator has requested shutdown.
The %SQRT function, for calculating the square root of a number.

RPG: FREE /END-FREE directives
The new /FREE and its closing directive /END-FREE allow you to isolate a set of
source statements, much like the /EXEC SQL and /END-EXEC directives do.?/FREE
and /END-FREE, however identify a non-columnar operation code area. That is yet
a 3rd Calculation specification.
No specification type in column 6--it must be blank.
End every statement with a semi colon ( ; ).
The EVAL operation code name itself is optional:
X = A + B /C;
EVAL X = A + B / C;

Statement continuation is implied except for broken literal values or extended
names
Most Operation codes can be specified.
When using traditional operation codes, reverse Factor 1 and the OpCode
location
That is:? CHAIN keyvalue? file-name


Let's look as how many different techniques there are for doing an ADD operation
in RPG IV:
1) Traditional long-form ADD operation code:      C    COST      ADD
MARKUP    PRICE

2) Traditional short-form ADD operation code:     C    Z-ADD     COST
PRICE    C    ADD  MARKUP    PRICE

3) Contemporary EVAL operation code:    C    EVAL      PRICE = COST + MARKUP

4) Contemporary EVAL operation code enclosed in /FREE /END-FREE directives:
/FREE
     Eval Price = Cost + MarkUp;
/END-FREE

5) EVAL operation code enclosed in /FREE /END-FREE directives without specifying
the OpCode name:
/FREE
     Price = Cost + MarkUp;
/END-FREE

RPG: Exception Handling
The MONITOR operationIt sets up an event handler for a monitored group of
statements. This event handler works similar to a MONMSG command in CL. It
establishes a block of code (group of RPG statements) that are run when an error
occurs within the monitored group.
To set up a monitored group, you type the MONITOR operation code, then follow it
with the statements for which the monitoring applies. Then, after the final
statement in the monitor group, type the ON-ERROR operation with the RPG Status
Code error ID in Factor 2. These are the same status codes found in the *STATUS
position of the INFDS and PSDS data structures, and in the contemporary %STATUS
built-in function.

ON-ERROR - Set Up Event MonitorYou can specify one or more status codes with
the ON-ERROR operation. This is similar to using a MONMSG command in CL with
multiple message IDs specified. As always in RPG IV, you separate multiple
status code with a colon.

There are three identifiers that you can use to create a more generic handler.
In place of a specific status code, specify *PROGRAM to indicate that any
program status code (i.e., those in the range of 1000 to 9999) are monitored, or
*FILE to indicate that any file-related status code (i.e., those in the range
of 100 to 999) are monitored. Optionally, you can specify *ALL for the status
code that, obviously, monitors for any status code to occur.

RPG: Data Structures
 A new definition specification keyword: QUALIFIED. This keyword specifies that
subfield names will be qualified with the data structure name.
 A new definition specification keyword: LIKEDS. This keyword specifies that
subfields are replicated from another data structure. The subfield names will be
qualified with the new data structure name. LIKEDS is allowed for prototyped
parameters; it allows the parameter's subfields to be used directly in the
called procedure.
 The INZ definition specification keyword has been extended to allow a data
structure to be initialized based on its parent data structure.

These keywords and enhancements offer several benefits:
 Subfields in different data structures can have the same  name.
 It's clear when you're dealing with subfields within calculation.
 You can specify data structures easily as parameters to procedures.

RPG: Softcoded Filenames (EXTFILE and EXTMBR Keywords)
A common coding technique is to code USROPN for a file, call QCMDEXC to override
the file to a specific external file, then open the file. Now you can use the
EXTFILE and EXTMBR keywords to control which external file gets opened.

RPG: ELSEIF (Else clause with an IF statement)
This operation code consolidates the ELSE and the IF opcodes by integrating
their function into one ELSEIF operation.?  Factor 2 of the ELSEIF operation
supports everything the traditional IF operation supports. So now, instead of
coding an ELSE opcode on one line, and an IF opcode on a second line, you can
code one ELSEIF operation to handle the situation.

But the ELSEIF goes one step further. It eliminates the requirement to code a
closing ENDIF opcode. Unlike the IF opcode which requires a corresponding ENDIF
opcode to close the IF condition, an ELSEIF uses the same ending ENDIF operation
that the opening IF operation uses. That is, only one closing ENDIF statement is
needed!.  In fact, this effectively does the same kind of function as the SELECT
/ WHEN / OTHER / ENDSL operation.

RPG: Other Enhancements
The following /DEFINE names are predefined: *VnRnMn, *ILERPG, *CRTBNDRPG, and
*CRTRPGMOD.
The search string in a %SCAN operation can now be longer than string being
searched. (The string will not be found, but this will no longer generate an
error condition.)
The DUMP operation code now supports the A extender, which means that a dump is
always produced - even if DEBUG(*NO) was specified.
A new directive, /INCLUDE, is equivalent to /COPY except that /INCLUDE is not
expanded by the SQL preprocessor.  Included files cannot contain embedded SQL or
host variables.
RPG: Other Enhancements
 The OFLIND file-specification keyword can now take any indicator, including a
named indicator, as an argument.
 The LICOPT (licensed internal code options) keyword is now available on the
CRTRPGMOD and CRTBNDRPG commands.
 The PREFIX file description keyword can now take an uppercase character literal
as an argument. The literal can end in a period, which allows the file to be
used with qualified subfields.
 The PREFIX definition specification keyword can also take an uppercase
character literal as an argument. This literal cannot end in a period.
 The parameter to the DIM, OCCURS, and PERRCD keywords no longer needs to be
previously defined.

HTH!!!
Peter Vidal
Pall Aeropower Corp.
SR Programmer Analyst
WWW.Pall.com / 727-539-8448, x2414

"A good player makes himself look good; a great player makes the team look
good."
Author unknown



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.