RPG Next Gen
Wiki RSS Feed Bug Reporting
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
ILEDocs

Projects


rss feed Latest News

  • 2010-07-06 - RPG Next GEn Editor release 0.5.4
  • 2010-06-06 - STDLIB replacement functions - mkstemp
  • 2010-05-24 - RPG Next Gen Editor Dev Snapshot 0.5.3.99
  • 2010-04-02 - RPG Next Gen Editor release 0.5.3
  • 2010-01-28 - JSON service program release 1.2.2
  • 2010-01-05 - First Linked Map release 1.0.0
  • 2009-12-15 - Linked List API Documentation at Sourceforge.net
  • 2009-12-15 - Linked List release 1.2.0
  • 2009-08-27 - RPG Next Gen Editor update site 0.5.1
  • 2009-08-13 - RPG Next Gen Editor release 0.5.1
  • 2009-07-17 - Package Management for System i - concept draft
  • 2009-06-15 - New RPG Next Gen Editor video tutorial - Offline projects
  • 2009-06-04 - RPG Next Gen Editor update site available again
  • 2009-06-01 - RPG Next Gen update site NOT working
  • 2009-05-31 - RPG Next Gen Editor release 0.5.0
  • 2009-05-26 - ILEDocs java client released
  • 2009-05-26 - More documentation available
  • 2009-05-22 - Wiki online
  • 2009-05-01 - ILEDocs released

Last updated

2010-07-06