I've checked the ILE RPG Programmers Guide, this list's archives and
various Google searches but I have been unable to find the answer.

My question is if RPG can catch thrown errors when calling java
methods/classes.

For example, in java if I code

[java code]
try {
new FileOutputStream("mydirectory$HelloWorld.pdf");
} catch (IOException ioe) {
System.err.println(ioe.getMessage());
}
[/java]

Since FileOutputStream throws FileNotFoundException and the directory is
invalid control will be passed to the catch code.

How do I do the same in RPG?
My thought is something similiar to
[RPG]
Monitor;
fileOutputStream =
new_FileOutputStream("mydirectory$HelloWorld.pdf");
On-Error (what do I check)
// handle the error
Endmon;
[/RPG]

If anyone knows an article or can explain how to handle exceptions it
would be greatly appreciated,

Robert Rogerson

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.