|
What would happen if, on the next line after the write, you did a LEAVESR ? --------------------------------- Booth Martin http://www.martinvt.com --------------------------------- -------Original Message------- From: RPG programming on the AS400 / iSeries Date: 07/29/05 13:49:37 To: RPG programming on the AS400 / iSeries Subject: Displaying Error Messages Hi All, Earlier I asked about displaying error messages when a user enters invalid data. Thanks to everyone who responded. I'm having a further issue now in that when the program issues the error message, it waits for a prompt from the user before continuing on with the code. Is there a way I can display the error message and exit out of the subroutine instead of doing an exfmt within the sub and having it continue on from where the exfmt is located? For example, I have this in my mainline code: ExFmt prompt_fmt; DoW not Exit; If PrevScreen; ExFMT PROMPT_FMT; PressPrev = *OFF; Endif; If EError = *OFF; ExSR FindPQ; Else; ExFMT PROMPT_FMT; EError = *OFF; Endif; If PrintRpt = *ON; ExSR PrintReport; Endif; EndDo; *InLR = *on; In a subroutine (Named FindPQ) I have this as a section of the code: BegSR FindPQ; EError = *OFF; NoRecs = *OFF; MissingCat = *OFF; MissingIn = *OFF; MissingOut = *OFF; DateFillI = ''; DateFillO = ''; If %trim(pqcat) =''; MissingCat = *ON; Message = ' Please enter a category'; write Msg; MissingCat = *OFF; Eerror = *ON; Exfmt prompt_fmt; endif; .... More checks - if there are no errors, run the fillsub routine ... EndSR; So, here's the logic of my program: 1) Execute the prompt_fmt and wait for some user input (in the mainline code). 2) Check the user input (done when it goes through the DoW loop) using the FindPQ logic. 3) If there is an error, display it to the user. Step 4) is where I am having trouble. I would like to display the error message to the user and go back to the prompt_fmt awaiting changes. However, when the program hits the EXFMT prompt_fmt in the FindPQ subroutine, it will wait here until the user enters something. Then it will continue on within the FindPQ subroutine on the next line following the Exfmt prompt_fmt. Can someone tell me how I can make it drop out of the routine without continuing? Should I move the error checks to their own subroutine, or do something else other than EXFMT? Thanks again! Brian. -=-=-=-=-=-=-=-=-=-=-=-=-=- Brian Piotrowski Specialist - I.T. Simcoe Parts Service, Inc. Ph: 705-435-7814 x343 Fx: 705-435-6746 bpiotrowski@xxxxxxxxxxxxxxx -=-=-=-=-=-=-=-=-=-=-=-=-=- -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. .
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.