New features of RPG in V7R1

 The following are the new features of RPG in V7R1

1) Open access

2) Sorting and searching data in Data Structure Arrays

3) New operation extenders

4) %Lookup works with Datastructure Array

5) New BIF %SCANRPL

6) No need to have prototypes for subprocedures that are internal to the module

7) New keyword RTNPARM on the (Procedure Interface level) PI level

8)  ALIAS Longer names defined in DDS /SQL can be accessed in RPG

Sorting and searching data in Data Structure Arrays

Open Access

Now using file manipulation opcodes ( READ, WRITE, CHAIN, EXFMT ) we can access the data that is available not only on the 5250 stream. We can access from browser , Handhelp devices..etc..

For that we need to write the program which handles the request made by the RPG program and these are called “ Handlers

We can have now sort the data in the Data Structure

Example:

 D InvoiceInfo     DS                  Dim(1000)

 D                                           Qualified

 D  Invoice#                       8    

 D  Invdate                          D     

 D  InvAmt                       12p 2  

    // If wanted to SortByName

      SortA  InvoiceInfo(*).Invoice;

    //If wanted to SortBy InvAmt

      SortA  InvoiceInfo(*).InvAmt;

The * indicates the level at which the sorting should occur. Of course, in this example, it’s pretty obvious, since it’s the only level where sorting is possible. But this sorting capability also works with nested Data Structures, so even very complicated structures can be sorted.

Two new operation extenders are available for SORTA

SORTA(A) –  for ascending

SORTA(D) – for descending

%Lookup works with Datastructure Array

Example:

Index = %LookUp( ‘ABC’: InvoiceInfo(*).Invoice#);

New BIF %SCANRPL ( To scan and replace )

This BIF is combination of %SCAN and %REPLACE

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: