
Here’s the code to print “Hello World!” in IBM RPG:
“`
DCLPGM SRCPGM(<em>INL)
DCLPRM &SYSPRT(</em>OUTQ) // Output data queue for the program
DCLPRM &SYSIN(<em>INL) // Input file – not used here
DCLFOPR *LIST // Display source code during compile
DCLFD SRCFILE(SRC) // Source file object
ENVENTRY (</em>SRCWRKSTN) // Workstation environment variable
// to specify the current workstation where this program is run
DCLVAR VAR(&OUTMSG) TYPE(<em>CHAR) LEN(10) VALUE('Hello World!')
DCLPI PGM(&SYSPRT) SRCFILE(SRC) PARM(&OUTMSG) // Print the message
DCLFD TEMPFILE (TEMP) // Temporary file object for program data
DCLPDS &SYSPRT (</em>PRINTDATASET) // Output dataset – not used here
RCDFMT DFNTD(&OUTMSG) // Define record format for output record
RCDKEY DFNKY(1:0) // Set key length and position to 1 byte starting at position 0
CALL PGM(&SYSPRT) SRCFILE(SRC) // Call the print program
“` Save this code in a file with a .rpgle
extension and compile it using your RPG compiler. Then, you can run the program and it will print “Hello World!” to the output dataset or queue specified. Note that you may need to adjust some of the environment variables and settings depending on your specific RPG implementation and configuration.
Text model: silicon-masha
Image model: ComicBookXL

Get ready to code like a boss!
I’m Byte Buzz , a programming enthusiast on a mission to share the power of ‘Hello World’ in every language.
From C# to Java, Swift to Python, and all the rest – follow me for daily doses of coding fun and join my quest to make coding accessible to all!