> Never used message subfiles before. How are they coded? I've seen some
>
> examples but I don't understand what the fields associated to the
> SFLMSGKEY
> and SFLPGMQ keywords are for. How can use message subfiles in RPG/400?
> Do I
> need some API?
>
> Thanks a great deal.
> Mary.
Attached is a sample source code free for the downloading from midrange
computing.
It is from an article titled Message Subfiles 101 and is from the June
1996 issue.
Hope it helps...
--
Jim Welsh
http://www.netcom.com/~jimwelsh/welcome/welcome.html
AS400 Programmer/Analyst
In the DDS of your display file, you will need to code the following:
A R MSGSFL SFL
A
TEXT('Message subfile')
A
SFLMSGRCD(24)
A MSGKEY SFLMSGKEY
A PGMQ SFLPGMQ
A R MSGCTL SFLCTL(MSGSFL)
A
SFLSIZ(0010)
A
SFLPAG(0001)
A
TEXT('Message control record')
A OVERLAY
A N99 SFLDSP
A N99 SFLDSPCTL
A N99 SFLINZ
A N99 SFLEND
A PGMQ SFLPGMQ(10)
A 23 2'F3=Exit'
A COLOR(BLU)
A N40 23 12'F5=Redisplay'
1. The MSGSFL format is where the actual messages appear.
2. The SFLMSGRCD keyword determines what line of the display to put the
messages on.
3. The MSGKEY and PGMQ hidden variables are required to be present. This format
is never referenced by your HLL application. What is stored in the MSGKEY is
the system pointer to the message. The PGMQ field stores the name of the
program the message was sent to. These are supplied by the system and you don't
have to worry about them.
4. The MSGCTL format controls the message subfile and we like to use it for the
command keys.
5. The SFLSIZ(10) is the initial size of the subilfe and should be different
the SFLPAG.
6. SFLPAG(0001) indicates the number of messages to show at a time.
7. OVERLAY allows this format to be viewed with others.
8. SFLDSP, SFLDSPCTL, SFLINZ, SFLEND are all conditioned by N99. In our
programs we never use IN99 and therefore, these keywords are always active. You
will want use an indicator that is never used in your own program.
9. PGMQ is a hidden field required to be in the message subfile control record.
You must initialize this field to '*' in your HLL. (If you are using CL as your
HLL then PGMQ must be the program's name). SFLPGMQ should be set the same as
SFLSIZ.
You can use the MSGCTL format to display other fields constants, whatever. Or
you can make it very generic and reuse it for several record formats.
In your HLL program you must first of all set PGMQ to '*' as mentioned above.
The steps your program should take to place messages in the message subfile are
as follows:
1. Use the SNDPGMMSG command in CL programs to send a message to TOPGMQ(*SAME
*). Use the QMHSNDPM in other HLL's to send the message to the program's own
queue.
2. Write and EXFMT the record formats you want to display.
3. Clear the program's queue with either the RMVMSG command or the QMHRMVPM
api.
And that's all there is to it. If you need actual programming examples refer to
the guide for programming displays book.