Thursday, April 13, 2017

Change to SQLRPGLE compile listings

type of rpg used in sqlrpgle compile listing changed to free format

Something I have noticed since the installation of IBM i 7.3 TR2 and 7.2 TR6 on the partitions I use, is a change to the compile listings of SQLRPGLE programs.

The process to create an object from a SQLRPGLE source member is a multi-step process:

  1. The syntax of the SQL within the source member is checked to ensure it is valid.
  2. A copy of the source member being compiled is moved to a source file QSQLPRE in QTEMP.
  3. The SQL statements in the source member are converted to calls and the new source member is placed in the source file QSQLTEMP1 in QTEMP, as a RPGLE source type.
  4. It is this source member that is compiled.

                Work with Objects Using PDM
 Library . . . . .   QTEMP     

Opt  Object      Type        Attribute   Text
     QSQLPRE     *FILE       PF-SRC
     QSQLTEMP1   *FILE       PF-SRC

I can compile the source member in QSQLTEMP1 just with a CRTBNDRPG command.

Prior to these TR the source code generated for step three was still fixed format RPG for the definitions. I copied this from an old compile listing.

                      S o u r c e   L i s t i n g
 1   /SET CCSID(*CHAR:*JOBRUNMIX)
 2 D*      SQL COMMUNICATION AREA
 3 D SQLCA           DS
 4 D  SQLCAID                       8A   INZ(X'0000000000000000')
 5 D  SQLAID                        8A   OVERLAY(SQLCAID)
 6 D  SQLCABC                      10I 0
 7 D  SQLABC                        9B 0 OVERLAY(SQLCABC)
 8 D  SQLCODE                      10I 0
 9 D  SQLCOD                        9B 0 OVERLAY(SQLCODE)
10 D  SQLERRML                      5I 0

Since these TR the generated source code is now in free format RPG.

                      S o u r c e   L i s t i n g
 1   /SET CCSID(*CHAR:*JOBRUNMIX)
 2   // SQL COMMUNICATION AREA
 3   DCL-DS SQLCA;
 4     SQLCAID CHAR(8) INZ(X'0000000000000000');
 5      SQLAID CHAR(8) OVERLAY(SQLCAID);
 6     SQLCABC INT(10);
 7      SQLABC BINDEC(9) OVERLAY(SQLCABC);
 8     SQLCODE INT(10);
 9      SQLCOD BINDEC(9) OVERLAY(SQLCODE);
10     SQLERRML INT(5);

I am in two minds about how to react to this:

  1. Hooray, it is great to see free format RPG being more widely used by IBM in their internal workings.
  2. About time too!

This should serve as another warning to all of you still using fixed format code it is time to start moving to free format.

 

This article was written for IBM i 7.3 TR2 and 7.2 TR6.

2 comments:

  1. We have some "legacy" programmers (LOL) in our shop who are just scared of change. So now, I have been tasked with bring them to the future (present)... I am going to start off showing them the new BIFs and the amazing power of embedded SQL. Hopefully that will prime their minds for more.

    Eight years ago I found myself in the job market and to be honest the biggest issue I had was my lack of staying up to date. I was all of a sudden force to learn everything my former company refused to embrace.

    ReplyDelete
    Replies
    1. Good for you to be given this task. I am sure they will resist, but once they start seeing the benefits of doing things the "new" way, not just because someone says so, they will appreciate your efforts.

      It is also a good opportunity for you to take time to experiment and explore some more of what IBM i can really do.

      Delete

To prevent "comment spam" all comments are moderated.
Learn about this website's comments policy here.

Some people have reported that they cannot post a comment using certain computers and browsers. If this is you feel free to use the Contact Form to send me the comment and I will post it for you, please include the title of the post so I know which one to post the comment to.