RPG Next Gen
Wiki RSS Feed Bug Reporting Weblog
Business picture

Parameter Evaluation

This module makes the processing of a multi user selection easier by passing the selection as one integer parameter which is the sum of all made selections.

Compressing Selection

Most people are familiar with this concept when it comes to unix / linux / IFS file permissions. Each permission has its own number.

  • 1 - Execute
  • 2 - Write
  • 4 - Read

Now all, some or no permissions can be put — compressed to — one value. For example:

  • 0 - no permissions
  • 5 - read and execute permissions
  • 7 - all (read, write and execute) permissions
# create file touch /tmp/my_file.txt # set permissions: # 7 = all for owner # 5 = read/execute for group # 5 = read/execute for other chmod 755 /tmp/my_file.txt

So far so good, but how does this makes life easier?

As far as we have come now in this article it makes life more complicated. But it will get much more easier as we proceed.

Passing multiple selections

The i5/OS API Retrieve Job Information can be used to retrieve the library list of the job. The library list is divided in various sections: System, Product, Current, User. If a procedure should return all or only some parts of the library list then multiple selections may be passed to that procedure. These selections could be coded as constants.

Such a procedure call would look like this:

D SYSTEM_LIBS... D C 1 D PRODUCT_LIBS... D C 2 D CURRENT_LIB... D C 4 D USER_LIBS... D C 8 /free ... listJobLibraryList(qualified_job_name : SYSTEM_LIBS + USER_LIBS); ... /end-free

Much easier to read and understand.

Selection Evaluation

Now that procedure has to know what part of the library list the calling program wants to have retrieved. A data structure with the possible selections is created with an overlay alpha field.

DlistSections... D DS qualified D system N D product N D current N D user N D allSections 4A overlay(listSections)

With the procedure evalParm the data structure gets filled with the following call:

/free ... // userSelection contains the value SYSTEM + USER = 9 // evalParm returns : '1001' listSections.allSections = evalParm(userSelection); ... /end-free

Keep in mind that the constants (and parameter for the evalParm procedure) value must be a number of the power of 2 (1, 2, 4, 8, 16, 32, 64, ...).

See the examples section for an example of using the evalParm procedure.

Donations

Collab Sites

Dieter Bender DV
Thomas Raddatz
ILEDocs
iDevCloud
YiPs

Projects


rss feed Latest News

  • 2012-10-05 - JT400 Javadocs
  • 2012-08-24 - JSON service program release 1.4.5
  • 2012-07-28 - JSON service program release 1.4.4
  • 2012-07-24 - JSON service program release 1.4.3
  • 2012-02-10 - missing RUNUNITEST program uploaded
  • 2011-10-23 - JSON service program release 1.4.2
  • 2011-09-13 - JSON service program release 1.4.1
  • 2011-08-27 - New Modular project
  • 2011-07-24 - JSON service program release 1.4.0
  • 2011-06-05 - New Stomp Client project and release 1.0.0
  • 2011-06-05 - Includes update to 1.2.0
  • 2011-05-09 - zlib port for IBM i
  • 2011-05-09 - New Properties project and release 1.0.0
  • 2011-05-03 - Includes updates
  • 2011-05-03 - libtree release 1.1.0
  • 2011-04-30 - JSON service program release 1.3.1
  • 2011-04-29 - Vector changed to ArrayList with a new release
  • 2011-02-23 - Linked List service program release 1.3.0
  • 2011-02-18 - Red Black Tree implementation docs
  • 2011-02-14 - JSON service program release 1.3.0
  • 2011-02-13 - RNG Input Provider release 1.1.1
  • 2011-02-11 - libtree release 1.0.0
  • 2011-02-05 - New Validator Service Program available
  • 2011-01-30 - New Flat File Parser project
  • 2011-01-15 - RNG Input Provider example added
  • 2011-01-10 - RNG Input Provider release 1.1.0
  • 2011-01-08 - RPG Next Gen Editor update site updated
  • 2011-01-03 - CCSID conversion script updated
  • 2010-12-30 - New project Input Providers
  • 2010-12-27 - CCSID conversion script in section resources
  • 2010-12-12 - RPG Next Gen Editor release 0.5.5
  • 2010-12-12 - RPG Unit Test release
  • 2010-10-02 - New project Unit Testing for RPG

Last updated

2012-10-05