Show error message to user after a CPYF command ended in error in CL program

2,410 pts.
Tags:
AS/400
CL Program
I have a copy command in my CL program. I have specified tofile and tomember parameters. I have given CRTFILE(*NO) so that I don't want to create a source file if it is not existing. I want to show a message "Sourcefile is invalid" when the source file is not an existing one. I want to show the message directly at the bottom of the screen(not as a BRK message or onto the log). How can I achieve this? Capturing the MONMSG and showing the message using SNDPGMMSG shows the message on the log. Here is the CPYF command:
CPYF FROMFILE(QTEMP/SRCTMP) + TOFILE(&LIBRARY/&SRCFILE) TOMBR(&MEMBER) + MBROPT(*REPLACE) CRTFILE(*NO) FMTOPT(*NOCHK)



Software/Hardware used:
As400
ASKED: April 19, 2013  5:27 AM
UPDATED: April 19, 2013  12:01 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    It depends on how the program runs. Does the program have a display file it will display the message in? If not, how is it expecting any control over what messages display at all, much less where they display or what the format will be? . There are multiple options. Maybe the best option to start with is not to use CPYF for this. If you are copying source file members, consider using CPYSRCF instead. The intention is clearer. . Tom
    125,585 pointsBadges:
    report
  • ToddN2000
    To start with, how are the parameters specified? Through a DSPF, passed parameters or hard coded? If you have a DSPF just add an error message field to the DSPF an then MONMSG and send that to your " CPY ERROR MESSAGE". If there is no user interface, how do you envision displaying an error message? Lastly, as Tom mentioned is this a "source" file or a data file ??
    6,360 pointsBadges:
    report
  • TomLiotta
    We need to know how this programming is going to run. If we don't know the execution environment, particularly how the display is being controlled, we can't tell how messages might be displayed. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following