Solved

SNDMSG in CL program

Posted on 2004-10-08
6
1,369 Views
Last Modified: 2010-05-18
Is there a way to call the sndmsg command without having to pass it all the parameters?

IE: I want to display to the user the sndmsg prompt and let them enter the appropriate values instead of having to write a screen to handle the sending of the message.

0
Comment
Question by:dpalme
  • 2
  • 2
  • 2
6 Comments
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 12263443
Hi dpalme,

you can use selective prompting:

E.g.

OVRDBF ?*FILE(FILEA) ??TOFILE(&FILENAME) ??MBR(MBR1)

Result:

?*FILE --   the command is shown with parameter FILE filled but protected
??TOFILE  -- the TOFILE is filled with the contents of var &FILENAM but can be updated
??MBR -- the MBR is filled with the constant MBR1 but can be updated

there are more selective prompts to use here they are:
Selective
Prompting
Character           Description
??                     The parameter is displayed and input-capable.

?*                     The parameter is displayed but is not input-capable.
                        Any user-specified value is passed to the command
                        processing program.

?<                     The parameter is displayed and is input-capable, but
                         the command default is sent to the CPP unless the
                         value displayed on the parameter is changed.

?/                      Reserved for IBM use.

?–                     The parameter is not displayed. The specified value
                         (or default) is passed to the CPP. Not allowed in
                         prompt override programs.

?&                     The parameter is not displayed until F9=All
                         parameters is pressed. Once displayed, it is
                         input-capable. The command default is sent to the
                         CPP unless the value displayed on the parameter is
                         changed.

?%                    The parameter is not displayed until F9=All
                         parameters is pressed. Once displayed, it is not
                         input-capable. The command default is sent to the
                         CPP.

(copied from: http://www.code400.com/viewsamples.php?lang_id=2)


Regards,

Murphey

0
 
LVL 27

Expert Comment

by:tliotta
ID: 12279910
Murphey's probably shown all you need. If you post what parms you'd like the user to see and/or change, we can provide a clear example. An example would help others in the future (which is a good part of the value of EE).

Tom
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 12284433
Example:

If you include the next command in a CL, the SNDMSG prompt will show up automatically,
and give the user the posibility to enter the messagetext and the receiver's user ID

SNDMSG ??MSG() ??TOUSR()  

BTW if you are on a command prompt screen you can press F13 to see all
details and posibilities of the prompting.

eg.  ?SNDMSG  wil prompt automatically without using the F4 key

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:dpalme
ID: 12300971
The CL code I have coded for this is:

if                     (&fld001 *eq 9) do
                       ? sndmsg
                       enddo

As long as the user enters some text in the sndmsg screen and enters a user name and sends the message, NO PROBLEM, it works perfectly; however if the user after getting the sndmsg display decides against it and F3's out the program generates an error: CPF 6801.

would changing the command to SNDMSG ??MSG() ??TOUSR() correct this?
0
 
LVL 1

Author Comment

by:dpalme
ID: 12300995
I guess I answered my own question, it still generates an error.

Any suggestions on how to avoid the 6801 error on this?
0
 
LVL 27

Accepted Solution

by:
tliotta earned 20 total points
ID: 12303173
dpalme:

I don't think you "avoid" it. You handle it:

if                     (&fld001 *eq 9) do
                       ? sndmsg
                       monmsg  cpf6801  exec( do )
                          sndpgmmsg 'User pressed <F3>' +
                                              topgmq( *ext )
                        enddo
                       enddo

...or something similar.

OS/400 works by passing messages. Much of your programming will be reaction to messages that are received. In this case, SNDMSG has sent a CPF6801 message to your program. You can ignore it or handle it. If you ignore it, OS/400 provides a default handler that shows a screen to the user and asks what to do. Avoid the default by monitoring for the message with the MONMSG command immediately after SNDMSG.

There are a _lot_ of ways to handle messages. This is just one trivial example.

Tom
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Programmer 26 560
As400 Db2 to MS Sql server (data/schema) only 6 356
Coding for returned data using DCL-PR 3 108
IBM MQ moving messages from error queue 4 169
Original post  on Monitis Blog. Web performance monitoring is broken into two camps: passive and active. Passive monitoring is defined as looking at real-world historical performance by monitoring actual log-ins, site hits, clicks, requests for…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question