PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

RPG IV - V6R1 Enhancements: 1) Increased Length

Go down

RPG IV - V6R1 Enhancements: 1) Increased Length

Post  maran on Tue Sep 08, 2009 7:05 pm

Increased Sizes

The maximum amount of storage that can be occupied by a data structure, array, or standalone field is now 16M. Yes, the maximum size of a character field has increased from 64K to 16M (16,773,104 bytes to be exact).

This is an enhancement that is long overdue. More and more of our programs should be making use of memory, but we have been restricted by the 64K limit in RPG. This enhancement means that a whole lot of dynamic memory management procedures and pointer/user space procedures are about to disappear. It also means that operations such as XML-INTO are now more functional and less cumbersome to use.

(1) D LongFld S a Len(25000000)

(2) D BigDS DS a Len(60000000)

D BigArray1 S a Len(10000000)

D Dim(6)

(4) D BigArray2 S 1a Dim(50000000)

(5) D BigVarying S a Len(25000000) Varying(4)

D DummyPtr S *


(6) DummyPtr = %Addr(BigVarying : *Data);
Use the LEN keyword to define a large length.

1) Since only seven positions are available to specify the length of a field in the D spec, you use the LEN keyword to specify a length greater than 9,999,999.

2) The LEN keyword may also be applied to a data structure.

3) The LEN keyword may also be applied to an array.

4) Larger variable sizes also mean you can have a larger number of elements in an array as long as the total storage for the array does not exceed 16M. The same applies to multiple-occurrence data structures.

5) Varying-length fields now require 2 or 4 bytes to store the actual length of the field. A size of 2 is assumed if the specified length is between 1 and 65535; otherwise, a size of 4 is assumed. You can specify either VARYING(2) or VARYING(4) for definitions whose length is between 1 and 65535. For definitions whose length is greater than 65535, VARYING(4) is required.

6) The %ADDR BIF has also been enhanced. The optional *DATA parameter may be specified so that %ADDR returns the address of the data portion of a variable-length field.[b]

Posts : 442
Join date : 2009-07-24

View user profile

Back to top Go down

Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum