NetRPG icon indicating copy to clipboard operation
NetRPG copied to clipboard

Support of older RPG Versions

Open szsascha opened this issue 5 years ago • 11 comments

Is the support for older RPG Versions planned?

I think most of the production applications still use older RPG Versions in fixed format (RPG 3 / fixed ILE and upwards).

szsascha avatar Aug 30 '19 16:08 szsascha

Hi

Yes it's in the plans. There will have to be a second parser for the fixed-format bits but I am not too worried about that.

Liam

worksofliam avatar Aug 30 '19 17:08 worksofliam

Okay, so on my last flight today I figured out a plan to get fixed-format being parsed.

  • The Preprocessor class needs some thing news.
    1. We need to create a class to represent a line of source. This RPGLine class might have two properties: LineType (FIXED, FREE, DIRECTIVE) and content (string)
    2. We need to add a new method to the Preprocessor class, like #Parse in which it will read through the array of lines. If it’s FIXED, then it will parse the fixed and generate RPGTokens (essentially converting fixed to free). If it’s FREE, then we call RPGLex#Lex to get the tokens for a free format line.
    3. We then take all the tokens, pass it to Statement#ParseDocument, etc as usual

We will also need to add some kind of check-in the Preprocessor#Parse method for the **FREE directive.

I will have to go through and change all the unit tests to use **FREE when I get around to this PR.

I have no idea when I get around to implementing this. This is a big set of work (most the generating of tokens from fixed-format). It will require implementing new operations (MOVE, TAG, GOTO, SETON, SETOFF) which are not available in free-format. We will need a way to make sure people still cannot use those operations in free-format RPG and I think that’ll be pretty easily actually. We also need to think things like KLIST and PLIST. I should be mentioning now that just because we are going to support fixed-format RPG does not mean we are going to support the cycle.

There are also special operations like OR and AND which haven’t even been implemented in the free-format lexer yet. This will be done while we implement fixed format as it’s pretty straight forward. Although the OR and AND operations can wait till later for the fixed-format stuff.

This was a long reply which ended up turning into a ramble. This is actually such a large bit of work I could write a simple spec for it or at least organise it into a GitHub project to track the progress.

worksofliam avatar Sep 05 '19 22:09 worksofliam

Nice Ideas!

I think we don't have to cover the whole functionality for the beginning. We can still add move, goto etc later.

Maybe we do not need to differentiate between free and fixed in the commands. What keeps us from using these commands for free-format RPG?

Let's not make it so complicated in the beginning. First let's add the simplest basic functionality.

szsascha avatar Sep 06 '19 18:09 szsascha

Built-in functions are available in conditions and eval. Maybe for ILE conditions (if, dow, dou) and eval we can use parts of the free parser too.

https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_74/rzasd/zzif.htm#zzif

http://www.go4as400.com/rpgle-opcodes/as400.aspx?cid=227

Just a thought...

szsascha avatar Sep 06 '19 19:09 szsascha

Some more information.

https://patentimages.storage.googleapis.com/fe/af/87/7c620fb27a0743/CA2267482C.pdf

szsascha avatar Sep 07 '19 16:09 szsascha

Thanks for sharing this with me. Cool document to have a read through and has some useful bits in.

I am probably going to start on the implementation tomorrow. I have a cool idea of how it could work.

Also, please feel free to share any more document likes that!

Liam

worksofliam avatar Sep 09 '19 00:09 worksofliam

@SaschaS93 I have started to implement the code for supporting fixed-format RPG. Check out the rpgfree branch. I fixed all the current unit tests to be **FREE for them all to work again.

I will eventually start work on actually supporting fixed format sometime this week.

Liam

worksofliam avatar Sep 09 '19 19:09 worksofliam

So, for future reference.. this is where we need to take the fixed format line and generate the free-format tokens:

https://github.com/worksofbarry/NetRPG/blob/rpgfree/NetRPG/Language/Preprocessor.cs#L73

This sounds like a lot of work and that's because it is. I don't plan on supporting the AND and OR operations. They will need to be converted to extended factor 2 IF operations.

Also, as a note, the AND and OR keywords are not yet supported in expressions. That will be implemented in a separate PR though.

worksofliam avatar Sep 10 '19 01:09 worksofliam

I am heavily considering this again. I am starting to think we should just support free-format. Hm, not sure.

worksofliam avatar Oct 14 '19 18:10 worksofliam

I think you should think about what you want to achieve with this project.

If you want to have just a fun project for your free time that's absolutely cool.

But I think if you take this a bit serious and you are want to address business users you have to provide the fixed format. Nobody wants to convert 20 - 30 years old software to free rpg just to run it in .net. It would make more sense to convert it step to step into oop .net.

But that's just my opinion.

szsascha avatar Oct 14 '19 18:10 szsascha

You are probably right @SaschaS93. The code is there for fixed format to become supported.. I just need to get around actually doing it.

Thanks for your input!

worksofliam avatar Oct 14 '19 18:10 worksofliam