Pages

Wednesday, January 4, 2017

Using SEU with totally free RPG

use seu with modern totally free rpg

I have been asked the same question many times recently: "Why can't I use SEU with the new RPG?" Before I directed people to various posts in this blog, which I think has confused some. Therefore, I have decided to put it all in one place, this post.

Let me start by saying that it is possible to use SEU to edit totally free RPG. The issue is that IBM has not considered SEU the editor of choice for IBM i since release 6.1, not making any changes to it since that release. Rational Developer for i, RDi, is now IBM's preferred editor. Unlike SEU, RDi is not included with the standard package of IBM i based development tools. RDi is not free, its licenses are purchased separately. I would recommend that if you can get a license of RDi you should start learning how to use it, rather than using the out of date SEU. For the sake of this post I am going to assume that you do not have an RDi license, and you have to continue to use SEU.

As SEU has not been changed since IBM i 6.1 all of the new functions, features, etc. added to all of the IBM i based programming languages since then are not supported by SEU's syntax checking. I found the best description of what SEU's syntax checker does in the COBOL manual:

… syntax checker checks each line for errors as you enter new lines or change existing lines. Incorrect source statements are identified and error messages displayed, allowing you to correct the errors before compiling the program.

Columns . . . :     1 100                                       Edit
 SEU==>
 FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 
        *************** Beginning of data *****************
0001.00 **free
0002.00 ctl-opt option(*nodebugio:*srcstmt)
0003.00           dftactgrp(*no) ;
0004.00
0005.00 dcl-pr sleep extproc('sleep') ;
0006.00  *n uns(10) value  ;                             
0007.00 end-pr ;



 F3=Exit   F4=Prompt   F5=Refresh   F9=Retrieve   F10=Curso
 F16=Repeat find       F17=Repeat change          F24=More 
Form-Type entry for main procedure not valid or out of sequence.

To be able to enter all the latest programming language enhancements I have to turn off syntax checking, unless I want every line with a new RPG definition specification, operation code, built in function, CL command, etc. to be highlighted as an error. The question is: Do I have to use the syntax checking? I do not, any errors I make when entering code will still be found when I compile the source.

To turn SEU's syntax checking off:

  1. Edit any source member in SEU, it does not matter which member or what type of member it is.
  2. Press F13, to "Change session defaults", and the following screen is displayed.
                         Change Session Defaults
    
    Type choices, press Enter.
    
    Amount to roll . . . . . . . . .   H        H=Half, F=Full
                                                C=Cursor, D=Data
                                                      1-999
    Uppercase input only . . . . . .   N        Y=Yes, N=No
    Tabs on  . . . . . . . . . . . .   N        Y=Yes, N=No
    Increment of insert record . . .   0.01     0.01-999.99
    Full screen mode . . . . . . . .   N        Y=Yes, N=No
    Screen size  . . . . . . . . . .   1        1=27x132, 2=24x80
    Source type  . . . . . . . . . .   RPGLE     
    Syntax checking:
      When added/modified  . . . . .   Y      Y=Yes, N=No
    
    
  3. Change the "Syntax checking" from Y to N.
  4. Press Enter.

Next issue before I can use totally free RPG without errors is how to position in the editor window in the right place before I enter **FREE.

In all earlier forms of RPGLE (or RPGIV), including: fixed format, free form calculations, and free format definitions, all need to be coded between the sixth and 80th columns in the editor, with the exception of tables. When you edit a RPGLE, or SQLRPGLE, member SEU positions the source to start at the sixth column, which is where you would put the letter for the specification you were entering.

Columns . . . :   6 100                                       Edit
 SEU==>
 FMT *   *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+.
        *************** Beginning of data ***************************
0000.01
0001.00 C<- 6th column: Fixed format starts here
0002.00   <- 8th column: Free format calcs start here
0004.00 e <- 1st column: Totally free starts here

Notice that on the first line where it says "Columns", it shows that this editor window starts in column six. You can also tell from the FMT line, if you count backwards from the tenth position you will find that this window starts in the sixth position. This is ideal for the versions of RPG that were available in IBM i 6.1, but not for totally free RPG, which was released in IBM i 7.2 TR3 and 7.1 TR11. When using totally free RPG you can use every column in the member, from the first to the end, whatever column that maybe. To flag to the RPG compiler that this is totally free code **FREE must be entered starting in the first column.

To move my editor window to start in the first position I press the F19 key. The editing space is moved to the left, the columns line at the top of the screen now shows the first column displayed really is the first column, and the ruler on the format line starts in the first position too.

Columns . . . :   1 100                                       Edit
 SEU==>
 FMT *  ..... *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6
        *************** Beginning of data **************************
0001.00
0002.00      C<- 6th column: Fixed format starts here
0003.00        <- 8th column: Free format calcs start here
0004.00 **free <- 1st column: Totally free starts here

Once the **FREE has been entered in the first column the rest of my totally free RPG can be entered starting in any column.

When I have finished entering code, exit the source member, and then edit or browse it again SEU will start displaying the source in the sixth column as before. I have been unable to find a setting in SEU to override this. If you have please let me know in the comments below.

I hope this explains simply how to configure SEU editor for more than just modern RPG, removing syntax checking will also allow me to use the latest commands and built in functions in CL too.

 

It is possible to download a 60 day trial of RDi from IBM's developerWorks web site here.

 

This article was written for IBM i 7.3, and should work for 7.1 TR11 and 7.2 TR3 and later too.

36 comments:

  1. ust one note:
    for right "rpg compilation" in SEU I must start in column 6


    Colonne . . . : 6 76 Editazione
    SEU==>
    FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...
    ****************** Inizio dati ********
    0001.00 **free
    0002.00 dcl-s damiano char(10);
    0003.00 damiano = 'damiano';
    0004.00 dsply damiano;
    0005.00 *inlr = *on;
    ******************** Fine dati ********


    when I start in column 6 it compile!!!!

    ReplyDelete
    Replies
    1. If the **FREE starts in position 6 then the 2nd "*" is in the 7th position. This renders the line a comment line & limits the space you can enter your RPG code into from the 8th to the 80th columns. This is not what I call totally free RPG, it is what I call free format definition RPG.

      Delete
    2. very good, thank you!!!

      Delete
  2. Get over it! You can blame me for the stabilization of SEU. This was one of my big initiatives back in 2006 and 2007 to stabilize SEU and 5250 based development tools. IBM's RDI and the new RDP are so vastly superior. If your shop can't afford RDI then someone needs to evaluate why you are using the IBM I. SEU is yet another example of customers destroying the future of IBM I!. People complain about IBM not promoting or enhancing IBM I, but refuse to provide IBM with revenue to support enhancement or development. SEU is like using Stone Age tools! Get over it!

    ReplyDelete
    Replies
    1. Every operating system has a text-based editor or "system editor" on it that gets out of the way when you don't need it, and is there when you do. Due to the block-mode interface, SEU suffers from 5250-legacy restraints (although ProFoundLogic did a nice job enhancing it with there add-on products). If I am on a client's system in green screen mode (the only mode supported on this box for 45 years) there should be an Editor available to edit any code I have to work with. Stabilizing SEU was one of the worse and lack of awareness decisions anyone has made on this box--save never adding a native GUI to it. Programmers on this Box do NOT generate revenue for IBM--its capabilities do.

      Delete
    2. Not knocking RDI, but the platform still needs an IBM i based, thin-client IDE comparable to PDM and an editor comparable to SEU. Doesn't have to be display file (5250) based - actually prefer that it's not. The IDE could be browser based. Think thin, IBM! THIN! Don't limit the choice to RDI.

      Delete
    3. I believe IBM ported Orion which I think is browser based and there's also Visual Studio Code which works nicely. Or any other editor with FTP capability probably as well for Windows, Linux or Mac. There are choices.

      Delete
    4. I'm thinking something like Orion. Its developers nailed the user interface. Now add syntax checking and the ability to work with libraries, objects, and members like PDM.

      Delete
    5. Responses like "Get over it!" and "if your shop can't afford RDi" show the arrogance of IBM. Our department does pay for quality, but RDi does not warrant its high price. We know because we tried the evaluation version of RDi and while it does work, we could not justify the high price to upper management by saying "It works with total RPG Free and makes our job a little easier". Needless to say, our new upper management was not pleased and got fed up and said the "biggest expenses coming out of the IT Dept are IBM-related, and the IBM marriage must end and must be replaced with cloud solutions that do not involve IBM products. GET ON IT !"

      Delete
    6. I agree RDi is expensive, and that puts many businesses off using it.
      Have you tried Visual Code Studio for IBM i? Its free!
      Here is a link to a great page of resources about it here.

      Delete
  3. I think it comes down to IBM can only invest in so many backward compatible features. They do more of that than anybody & sometime to a fault. They made a choice to use those dollars to build & enhance a modern IDE - not just an editor. It's so much more & for anybody that really embraces it and is willing to invest in obtaining & learning it, the payback is huge! There are so many ways that it pays for itself many times over. Also as you learn to leverage the shortcut keys, things like content assist, snippets, templates, new procedure wizard etc. you can write code much faster than with SEU. The source compare editor blows SEU away. The Launch SQL Scripts, Visual Explain, debugger, etc are awesome. There are too many other tools to mention. I can honestly say I feel handicap without RDI now. One of the great things about it is that IBM updates are coming out frequently including updates from the folks at Eclipse.

    ReplyDelete
  4. RE: "I have been unable to find a setting in SEU to override SEU starting in the sixth column."

    With Client Access, you can record keyboard macros (named "Edit" and "Browse") to:
    • Type "2" (for Edit, and "5" for browse)
    • Press enter
    • Window to column 1 and
    • Type "**FREE" (for Edit only).
    I assigned the "Edit" and "Browse" macros to Alt-2 and Alt-5 respectively.

    ReplyDelete
  5. We've been on this more-or-less RDI versus PDM/SEU path for years, even if we consider just discussions here. I'll express no personal opinion in this post but give my observation: in 3 or more sites I recall that when WDSC/RDI was made available I noticed that nearly every programmer reverted to PDM/SEU within a week. For whatever reasons, they found it preferable, even though the Eclipse-style IDE gave jolly lists of subroutines and helpful colours and views of more lines of code at once. There has to be a reason for their choice beyond a reluctance to embrace the new.

    ReplyDelete
  6. Will I get in trouble if I mention that some of my clients don't have the licenses so I have to use EDTF to write CLP etc.....

    ReplyDelete
  7. Yeah, It worked. Thank you for sharing

    ReplyDelete
  8. Jesse Gorzinski, MBAJanuary 9, 2017 at 9:45 PM

    I find it much easier to use Notepad++, which is free and knows free-form keywords via this free plugin: https://github.com/WorksOfBarry/Notepad-RPG (of course it requires the source to be in IFS)

    ReplyDelete
    Replies
    1. I find it much easier to use vim in a PASE ssh session. It knows free-form keywords via https://github.com/andlrc/rpgle.vim, and with a little creative use of vim auto commands I can have it automatically update a source physical file member whenever I save an IFS file in vim.

      Delete
  9. I don't code daily any more but if I have a quick change to make I often use SEU. I find it faster because I can do a quick change in a few seconds without the RDI launch, locate, open and save process. For in-depth code analysis of a large program or for RPG based technical demos I use RDI. What's interesting is I have no problem using Eclipse for Java or PHP all the time. If I coded all day long I would probably fully revert to RDI or if IBM removed SEU :-)

    ReplyDelete
  10. I concur with Richard. If it's a one or two line change, then SEU is faster and more convenient. Any new development or tasks involving multiple members almost certainly belongs to RDi. Not sure why there has to be a debate about one over the other. Most of the time we'd rather drive the luxury SUV, but occasionally the zippy little subcompact makes more sense.

    ReplyDelete
  11. I did a recent creating system commands with Java presentation that showed editing Java with RDI, Notepad or 5250 so even the SEU users could edit and compile Java :-)

    ReplyDelete
  12. Folks, keep in mind that SEU & PDM were stabilized in 2007 and will not fully support language enhancements, especially Free Form. There are limitations. It was done deliberately to promote RDI... You can use free form SEU editing capabilities, but that's all. SEU won't be discontinued as it is needed to support a number of text based facilities on the system.

    ReplyDelete
  13. Thanks Simon. I was wondering why i couldnt do a free format in SEU.. I was not aware that SEU was out-dated ! Thanks for this wonderful insight. Much appreciated.

    ReplyDelete
  14. and to add to my previous comment, i was able to successfully compile a free RPG via SEU. Thanks.

    ReplyDelete
  15. Hi Simon
    Love this blog - but was even happier when I saw this article "Using SEU with totally free RPG" as we have JUST upgraded to V7r1 from V5r4. However, am I reading this right, that I cannot use totally free code until V7r2?
    Alan Shore

    ReplyDelete
    Replies
    1. Firstly, thank you for the compliment, it is good to know that people appreciate the work that goes into writing this blog.

      There are different "flavors" of free format RPG, see here.

      While 7.1 will not support totally free format, it will support free format definitions. But you will need to make sure that your 7.1 system has the right PTFs. I would ask them apply all the PTFs that are available for 7.1 and you will find the RPG and SQL ones in there too.

      Good luck with your journey into free your thinking and your RPG.

      Delete
    2. 7.1 does support totally free format. This page has the info about the necessary PTFs. https://ibm.biz/rpgcafe_fullyfree_rpg

      Delete
    3. Ah thought this maybe the answer to my recent Totally free RPG issues as we're on 7.1. i've Downloaded the latest temporary version of RDi whilst we await access from IBM. Wrote my 1st Totally Free program, i.e. with Dcl-F / Dcl-s / Dcl-ds and Sub Procedures etc. The source verifies OK but will not compile... "RNF0257: Form-Type entry for main procedure not valid or out of sequence." on the **FREE statement which is the 1st line of code.

      Copied to a version with Fixed Format F and D specs with /Free /End-Free procedures and all OK.

      A little stumped and any advice would be highly appreciated.

      Delete
    4. Hi Simon,
      A quick update regarding my earlier issue and pain with my 1st Totally Free Format RPG program. FYI I found that I can use totally Free Format on 7.1 however I'm unable to use the **FREE compiler directive, instead I used the /Free as line 1 and the Final Line of code as /End-Free and it compiled :) Hope this may help anyone else out who is trying to start on the Free Format path.

      Delete
  16. The solution is easy peasy, REMOVE THE SOURCE TYPE!!!

    Whenever I have to write something in SEU, the first two things I do are removing source type and turning syntax checking off.

    ReplyDelete

  17. THIS MEANS THAT SEU COULD DISAPPEAR?
    AND OBLIGATE TO USE RDI?

    ReplyDelete
    Replies
    1. I am not sure if IBM will remove SEU any time soon. In my experience of talking to other IBM i developers I would say the majority still use SEU. IBM must realize that and know that they must come up with a cost effective alternative to SEU. Perhaps Orion.

      Delete
    2. I doubt that SEU will go anywhere soon - CLP / CLLE can still be edited just fine.

      Frankly the SDA for the most part is still easier than RDi though RDi is more robust - and RLU has ALWAYS SUCKED - but RDi really isn't that much better, imo.

      Delete
  18. I haven't used SEU for years. It is painful to use because I can only see a few lines of code at once, relative to RDi that is. I code all day. RDi is in my startup, and stays open all day. It is much faster to find things, and using filters to keep track of source is way better than PDM. It's just about learning a new and better way to work.

    ReplyDelete

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.