Archive

Archive for January, 2010

RPG Next Gen › JSON Service Program Release 1.2.2

January 28th, 2010 Comments off
This is more a feature release than a bug fix release. In the last version of the service program you had to use the exact get procedure for getting a numeric value from a json object. Now the value will be casted to the requested type if possible. For example you can use the json_getInt procedure to get a value like 4.99 with a returned value of 4. The procedures in the json array module have also been adjusted.


Read the original at RPG Next Gen.

Categories: Blogs Tags:

RPG Next Gen › JSON Service Program Release 1.2.2

January 28th, 2010 Comments off
This is more a feature release than a bug fix release. In the last version of the service program you had to use the exact get procedure for getting a numeric value from a json object. Now the value will be casted to the requested type if possible. For example you can use the json_getInt procedure to get a value like 4.99 with a returned value of 4. The procedures in the json array module have also been adjusted.


Read the original at RPG Next Gen.

Categories: Blogs Tags:

ile rpg programming: tips and techniques › How to search message files

January 21st, 2010 Comments off
While working with message file descriptions you have probably noticed the lack of a built-in search facility. With wrkmsgf you can 'position to' a message id but many times the need is finding the...

Visit site to read full content and more



Read the original at ile rpg programming: tips and techniques.

Categories: Blogs Tags:

ile rpg programming: tips and techniques › How to search message files

January 21st, 2010 Comments off
While working with message file descriptions you have probably noticed the lack of a built-in search facility. With wrkmsgf you can 'position to' a message id but many times the need is finding the...

Visit site to read full content and more



Read the original at ile rpg programming: tips and techniques.

Categories: Blogs Tags:

RPG and Programming › Adventure in Modernization

January 21st, 2010 Comments off

But sometimes, to old codgers like me, it’s difficult to know just how far to go. In previous posts I have written about my vaguely negative feelings about freeform RPG, and I have written very clearly about how I feel about IBM’s unwillingness to implement the MOVE instruction in freeform RPG, pointing out how this can only hinder conversion of old code and diminish acceptance of the new RPG dialect.

Case in point, a program I was working on today. I was writing code to implement formatting of a six-digit account number based upon the rightmost 6 digits of an 11-digit number. It was based upon some old code (the usual situation where I work), but the old code was hideous. The old program consisted of about 15 lines of MOVE and MOVEL statements. I said, this has got to go.

So I contemplated the best way to do it. I could set up a data structure and put pieces of the account number into that, using EVALs or MOVEs,with dashes embedded as needed. But that didn’t seem quite elegant enough. I have been working harder to modernize my own code, so I finally broke it down to these two possibilities, as illustrated in this test program. The result I am aiming for is the number formatted as 01-234-5.


     H DFTACTGRP(*NO)   ACTGRP(*CALLER)
     D BACTNO          S             11  0 INZ(99999012345)
     D ACC6            S              8    INZ(*BLANKS)
     D NUM6            S              6  0 INZ(0)
     D ACCW            C                   '0  -   - '
     C/FREE
       EVALR ACC6 = %EDITW(%DEC(%SUBST(%EDITC(BACTNO:'X'):6:6):6:0):ACCW);
      /END-FREE
     C                   MOVE      BACTNO        NUM6
     C                   EVALR     ACC6 = %EDITW(NUM6:ACCW)
     C                   EVAL      *INLR= *ON

One way mixes the old and the new, with an old-fashioned MOVE to the smaller field, followed by a new-fangled %EDITW BIF using a predefined edit word. The other goes full-bore new age, with one grand set of embedded functions. To get the 11 digit number in string form so I can substring it, I use %EDITC with an X edit code, which does the conversion. Next, I %SUBST (substring) the last six characters. I then use %DEC to convert those six characters back to numeric. Finally, I apply the %EDITW function to format those six digits as desired. (I would be interested in finding out about a shorter way to do it.)

But I have a problem with it. In an earlier post, I pointed out that the ability to create long, complex functions in freeform is not necessarily a virtue. The mere fact that I felt the need to explain it here indicates that I am not comfortable with it. The code is short, but I do not feel that it is clear. On the other hand, while the the two-line version using MOVE is short and sweet, and uses a BIF, it would force me to get out of freeform to use the MOVE; stylistically, that also seems wanting.

Since the thrust of my thinking is in trying to modernize the code so future generations of converted C programmers won’t be freaked out by the C in column 6, I am leaning toward the one-line version. But I don’t like it. It’s ugly.


Read the original at RPG and Programming.

Categories: Blogs Tags: , , ,

ile rpg programming: tips and techniques › Debugging submitted batch jobs

January 14th, 2010 Comments off
In order to debug submitted jobs on the iSeries first submit the job with the Hold parameter set to *Yes, or submit the job to a job queue that is not attached to an active subsystem. Work with...

Visit site to read full content and more



Read the original at ile rpg programming: tips and techniques.

ile rpg programming: tips and techniques › Debugging submitted batch jobs

January 14th, 2010 Comments off
In order to debug submitted jobs on the iSeries first submit the job with the Hold parameter set to *Yes, or submit the job to a job queue that is not attached to an active subsystem. Work with...

Visit site to read full content and more



Read the original at ile rpg programming: tips and techniques.

ile rpg programming: tips and techniques › Debugging submitted batch jobs

January 14th, 2010 Comments off
In order to debug submitted jobs on the iSeries first submit the job with the Hold parameter set to *Yes, or submit the job to a job queue that is not attached to an active subsystem. Work with...

Visit site to read full content and more



Read the original at ile rpg programming: tips and techniques.

ile rpg programming: tips and techniques › How to get the most out of IBM PDM

January 12th, 2010 Comments off
The iSeries Programming Development Manager or PDM (including the workhorse Source Entry Utility or SEU) is one of most widely recognized tools for the iSeries. In order to continue getting the most...

Visit site to read full content and more



Read the original at ile rpg programming: tips and techniques.

Categories: Blogs Tags:

ile rpg programming: tips and techniques › How to get the most out of IBM PDM

January 12th, 2010 Comments off
The iSeries Programming Development Manager or PDM (including the workhorse Source Entry Utility or SEU) is one of most widely recognized tools for the iSeries. In order to continue getting the most...

Visit site to read full content and more



Read the original at ile rpg programming: tips and techniques.

Categories: Blogs Tags: