RPGLE Free Format Tutorial

Simple RPGLE Program (Hello World)

Written by AS400i · 58 sec read >
First RPGLE Program

Create a member “helloworld” in your working source physical file. Give the type of this member as “RPGLE”. Now type the following code in the source member.


Now compile the module. Create the program and call it, It Will display the phrase Hello World.

That is a basic RPGLE program but you learn several things as discussed below.

  • The C specs is mentioned on the 6th place. Other specifications are also specified at this place only. Other specifications are H, F,D, I and P. (Specifications O and E are RPG specifications)

  • The text Hello world is written at ‘Factor one’ position. i.e at the 12th place. At this place we specify the factor one of any operation code in RPGLE. You will use this factor frequently for declaring keylists of file and defining parameter list.

  • The Op codes in RPGLE. The opcodes are placed at the position starting from 26. In the example above we have used two opcodes dsply and Return.

  • Dsply – This opcode is used to display any text as the output. The program does not stop execution but halts for a small time. When you press the return key. The subsequent statements are executed. This opcode can be used to display a text of maximum 52 length.

  • Return – This opcode is a required keyword. When the program runs this statement, it terminates its execution and returns to the calling program immediately. In the example above the caller is the system as we have called this program from command line, hence the program will end when it executes the return statement.

Hello World RPGLE Tutorial

in RPGLE Free Format Tutorial
  ·   2 min read

10 Replies to “Simple RPGLE Program (Hello World)”

  1. Hi there I am so excited I found your blog page, I really
    found you by error, while I was browsing on Bing for something else,
    Anyhow I am here now and would just like to say thanks a lot for a marvelous
    post and a all round entertaining blog (I also love the
    theme/design), I don’t have time to read through it all at the
    moment but I have book-marked it and also included your RSS feeds, so when I have time I will be back to read a great deal
    more, Please do keep up the great work.

  2. I haven’t checked in here for a little while because I thought it was
    getting uninteresting, but the last few posts are actually good quality
    so I guess I’ll add you back to my daily bloglist. You deserve
    it my buddy.

why dont you add your experience here