?
Solved

SNDMSG in CL program

Posted on 2004-10-08
6
Medium Priority
?
1,401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
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 80 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Check out the latest tech news, community articles, and expert highlights in August's newsletter.
I don't pretend to be an expert at this, but I have found a few things that are useful. I hope that sharing them here will help others, so they will not have to face some rather hard choices. Since I felt this to be a topic of enough importance and…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

764 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