Is there any method to clear the screen in RPG for the AS400? I'm looking for something with the same result as clrscr()
in C.
views:
243answers:
2You can clear the screen with RPG, but it's not like clrsrc()
RPG does not address the screen directly. You work with a device file aka display file (DSPF). The standard way to create that file is with DDS source and the DDS compiler (always available on a AS/400). The DSPF has one or more records. The RPG program writes or reads these records. If you write a record that is defined with the keyword CRLR(), then your screen will be clear. Also read about OVERLAY() that goes hand in hand with this keyword.
All information is in the IBM information center. DDS is described in the IBM DDS reference (pdf)
I guess that you need to start with understanding the mechanism (RPG programmers guide (pdf). It is quite simple but need a little reading.
Disclaimer: there are more ways to do this (including dirty & nasty tricks). But RPG+DDS is the preferred, standard, and most-used way in the iSeries world.