wrkmsg - How can I sort messages alphabetically?
Is there any possible way to sort those messages in a way that I like to have开发者_如何学C them?
I'm assuming you mean that you want to sort the message definitions stored in a message file, rather than the current contents of a message queue. You can create a database table (ie. a file) to receive the message descriptions, and then do whatever you'd like with those records.
Normally you can DSPMSGD
to a print file. But we will create a physical file or table, and override the output of the DSPMSGD
command to our file. The first three records are trash, for our purposes, and we will discard them using CPYF
from a workfile into our final file.
Make things easier by setting your library as current.
CHGCURLIB mylib
You could define your files in DDS, but I'll demonstrate this in SQL.
STRSQL
To create your work file and result file:
CREATE TABLE qtemp/workfile
( x1 char(1),
msgid char(7),
sev char(2),
msgtxt char(132)
)
CREATE TABLE myfile
( msgid char(7),
sev char(2),
msgtxt char(132)
)
Exit SQL to return to a command line.
Override the output file for the DSPMSGD
command to your work file, and collect your data.
OVRDBF QPMSGD workfile
DSPMSGD RANGE(*FIRST *LAST) MSGF(some_msgf)
DETAIL(*BASIC) OUTPUT(*PRINT)
CPYF workfile myfile MBROPT(*replace)
FROMRCD(4) FMTOPT(*MAP *DROP)
You can now go back into SQL and see the fruits of your labor.
STRSQL
SELECT *
from myfile
order by msgtxt
Not that I have ever seen. They come appear in datetime order. I am sure they are stored in a physical file somewhere where you could maybe query it, but I usually clear out my messages ASAP.
精彩评论