Imagine if you could send a message to an AS400 (or I5) machine, by using a neat and small program that gives you a lot of power on messaging.
How it works
This program uses a “Stored Procedure” in AS400 (or I5) to send a message to another user, or all the users. All you need to do is to type the message, choose the recipients, and hit the “SEND” button. You are allowed to save the message, or retrieve a message to be sent. Adding new recipient is as easy as filling in an input box! All together, this program is very easy to use and straightforward.
Something about the code
- Here is the main trick that uses the Stored Procedure (
"CALL QSYS.QCMDEXC('" & StrCom & "'," & ParameterL & ")"
CALL QSYS.QCMDEXC() is a function that lets you run a procedure in AS400 (or I5). This function accepts two parameters:
- Procedure name
- Procedure length
The following is the made up procedure:
"SNDMSG MSG('" & Messagetxt & "') TOUSR(" & Recepient & ")"
ParameterL keeps the length of the procedure and its parameters. Once you make up the procedure, then the
CALL QSYS.QCMDEXC() would execute it. However, setting up a procedure and an accurate length for the procedure and its parameters are crucial.
- The second trick in the program is an “embedded .wav file”. Once you click on the “SEND” button, it sends the message and runs an embedded .wav file.
Private Declare Function PlaySound Lib "winmm.dll" (ByVal data() As Byte, _
ByVal hMod As IntPtr, ByVal hwFlags As Integer) As Integer
Private Const SND_ASYNC As Integer = &H1 Private Const SND_MEMORY As Integer = &H4
Private Shared ClickSound As Byte()
Shared Sub New()
Dim NameSpc As String = _
Dim SoundFile As String
Dim WavStrm As IO.Stream = _
NameSpc + "." + "DRIVEBY.WAV")
ReDim ClickSound(CType(WavStrm.Length, Integer))
WavStrm.Read(ClickSound, 0, Int(CType(WavStrm.Length, Integer)))
Public Sub PlayWav(ByVal WavResource As Byte())
PlaySound(WavResource, IntPtr.Zero, SND_ASYNC Or SND_MEMORY)