Solved

SNDMSG in CL program

Posted on 2004-10-08
6
1,337 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now