BrianGarland / vscode-rpgfree

Visual Studio Code extension to convert fixed format RPGLE to free format
MIT License
18 stars 11 forks source link

LOOKUP conversion free format design problem #102

Open m-tyler opened 4 months ago

m-tyler commented 4 months ago

When I converted some / most look-ups, I noticed a problem created by IBM in the RPGLE language.

Before.

     C                   Z-ADD     1             XIDX
     C     PHWKN         LOOKUP    EWK(XIDX)                              50
     C                   IF        *IN50 = *OFF

After

       XIDX = 1;
       *In50 = ( %Lookup( PHWKN :EWK :XIDX ) > 0 );
       IF *IN50 = *OFF;

Now it doesn't look incorrect but the issue it creates for me is when a match occurs with LOOKUP XIDX is loaded with the matching index value but this does not occur with %LOOKUP because it loads the index value as its return result.

I would ask that this conversion be changed to become two lines.

    XIDX = %Lookup( PHWKN :EWK );
    *In50 = ( XIDX > 0 );

These two lines are more correct in regards to the original use of LOOKUP.