Wednesday, November 11, 2020

Entry plist in all free RPG

entry plist in totally free rpg

This post comes under the category of "I thought I had already written about this". I have written about calling programs with totally free RPG, and how to receive passed parameters to a RPG program with a main procedure, but I just forgot to write about how to receive parameters to a RPG program without a main procedure.

In fixed format RPG the entry parameter list would look like:

01 C     *entry        plist
02 C                   parm                    Parm

Now how do I do the same in free?

Here is where I need to thank Jon Paris and one other for pointing out I do not need a procedure prototype definition. All I need is the procedure interface.

I have created a very basic program with only the essential statements to show how this works:

01  **free

02  dcl-pi *n ;
03    Parm char(1) ;
04  end-pi ;

05  dsply Parm ;

06  *inlr = *on ;

Line 1: Without this it is not totally free RPG.

Lines 2 – 4: The procedure interface. I do give the interface a name so I just use "*N". If I give it a name I need a procedure prototype definition.

Line 5: Not essential but with this I can see if the program received the value I passed to it.

Yes it is as simple as that. Thank you to Bob for finding this omission, and to Jon and the others for their input.


This article was written for IBM i 7.4, and should work for some earlier releases too.


  1. Why bother with a prototype Simon? Not needed and just adds confusion and work. Only needed if the proto is needed by calling programs - in which case it should be in a /Copy.

  2. If you do have a prototype for a cycle-main procedure, you need to specify the prototype name for the PI. If you specify *N as the name for the PI, the compiler won't know which prototype to check for parameter mismatches between the prototype and the PI.

    The only time you would specify *N as the name for the PI of a cycle-main is if you know you will never need to call your program from RPG, so you don't have the prototype in a /COPY file.

  3. if i don't have access to the source of program, and i want to know the input parameteres of this program, is there any way to do that? (AS400 command or sql script..)

  4. Very handy, thank you.


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.