Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

SNDMSG in CL program

Posted on 2004-10-08
6
Medium Priority
?
1,433 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

How do you create a user-centered user experience on your website? And what are some things you should consider in the process?
Why WooCommerce is one of the majorly favored choices when it comes to having an eCommerce store. This article will acquaint you with some reasons that I believe make it one of the best eCommerce platforms available.
Loops Section Overview
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

571 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