Skip to Content
0
Former Member
Jul 22, 2008 at 03:27 PM

Using the MESSAGE statement

2947 Views

Greetings.

I'm working on a program that will, among other things, process inbound files. If the filename specified does not exist I thought I would use the MESSAGE command to generate a runtime error using a parameterized Text Symbol which would have the name of the errant file; something like this:

text-m02 = "File &1 Not Found'.

MESSAGE text-m02 TYPE 'X' DISPLAY LIKE 'E'.

However, when I add the "WITH dobj" (where dobj is a string var w/ the name of the file) it won't compile saying that the "WITH dobj" statement is unexpected (regardless of where I put it).

But that got me thinking - is this the best approach? This program will be ran and the selection screen saved as a variant for each input file but it is entirely possible the file may not be around when this program fires off so I have to account for that possibility, along with processing errors.

Is there a recommended or "best" practice for handling errors in applications that will be ran in batch? If so, what are they?

Thanks!