CRPence
unread,Oct 24, 2012, 12:09:04 AM10/24/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
On 23 Oct 2012 19:51, suresh1234 wrote:
> I'm novice to AS/400. I have created a simple RPG file which
> displays a value of variable using DSPLY. It is working. But every
> time I run the RPG file old results have been seen in Display message
> area/screen. How can I clear those previous results/data i.e how can
> I clear the screen before displaying new result ???
>
FWiW, unlike some other operating systems, the IBM i [i5/OS, OS/400,
and prior] is and always has been object-based, where everything is
*not* simply a "file". The compiled RPG, as described\alluded, is
presumably an executable *PGM; i.e. a "program object" which can not be
accessed except by appropriate supported methods such as CALL, and is
inaccessible to other methods like EDTF [edit file] which is a method
inappropriate for non-data [objects].
Per use of DSPLY, presumably the reference to the "Display message
area\screen" is reference to the QCMD shell's message log, which is the
job message queue. The DSPLY statement of the RPG language effects
essentially the equivalent of the CL request to SNDPGMMSG TOPGMQ(*EXT)
which requests that "the message is sent to the external message queue
of the job."
While one could clear some or all of the messages, IMO there are more
reasons not to; the job message queue provides great value, because the
messages are there to be reviewed later, optionally filtered when the
joblog is output for later review. What I would do typically, instead
of trying to "clear the screen" prior to the new results, is to send a
DSPLY message value that indicates a new invocation.
/free
DSPLY '** New Run **';
...
DSPLY VariableNm;
There is an option to have a simple CL program that merely removes
all messages from the external [program] message queue of the job. A
simple CL program that does nothing more than "rmvmsg pgmq(*ext)
msgq(*pgmq) clear(*all) rmvexcp(*no)" is something I have used, though
for a different reason. An API to effect the same "remove message" as
the aforementioned RMVMSG CL command invocation should be possible to
effect in an RPG program instead of a CL program if the latter is not
available or for which there is even less familiarity. Obviously
removing all such messages could cause some messages that were sent
there, messages which could be valuable to retain, to also be removed.
There are many other options that would be effective as well: a new
job, an alternate [e.g. a group] job, use an alternate shell which
literally or effectively removes all messages for just that invocation
of the shell, use an alternate target [e.g. a named message queue,
stream file, etc.] for the logging [what is currently being logged by
DSPLY] which requires use of some interface other than the DSPLY, żother?
--
Regards, Chuck