|
Rob said: "HI I noticed that a program that I am modifying, gets a data decimal error, when there is no data to process for a given year that is entered. Is there some better way to handle such an occurance than the program dump? Thanks, Rob" Is the field value causing the blow or is the fact that there was no data to process? On any case, you should check and ensure that the math, arrays indexes, data structures, etc. operations are numeric fields, nicely initialized and are not invalid field values, like blanks or other stuff like that. Depending on your OS level, (I am on 5.2) you could use the MONITOR operation for example. It sets up an event handler for a monitored group of statements. This event handler works similar to a MONMSG command in CL. It establishes a block of code (group of RPG statements) that are run when an error occurs within the monitored group. To set up a monitored group, you type the MONITOR operation code, then follow it with the statements for which the monitoring applies. Then, after the final statement in the monitor group, type the ON-ERROR operation with the RPG Status Code error ID in Factor 2. These are the same status codes found in the *STATUS position of the INFDS and PSDS data structures, and in the contemporary %STATUS built-in function. You can also use ON-ERROR - Set Up Event Monitor. You can specify one or more status codes with the ON-ERROR operation. This is similar to using a MONMSG command in CL with multiple message IDs specified. As always in RPG IV, you separate multiple status code with a colon. There are three identifiers that you can use to create a more generic handler. In place of a specific status code, specify *PROGRAM to indicate that any program status code (i.e., those in the range of 1000 to 9999) are monitored, or *FILE to indicate that any file-related status code (i.e., those in the range of 100 to 999) are monitored. Optionally, you can specify *ALL for the status code that, obviously, monitors for any status code to occur. 0010 C MONITOR 0020 C EXFMT EditCust 0030 C if CustNo > 0 0040 C Write CustMast 0050 C endif 0060 C ON-ERROR 01021 0070 C CallP DupKeyDetected 0080 C ON-ERROR *FILE 0090 C CallP DupKeyDetected 0100 C ENDMON Peter Vidal Pall Aeropower Corp. SR Programmer Analyst WWW.Pall.com "My religion consists of a humble admiration of the illimitable superior spirit who reveals himself in the slight details we are able to perceive with our frail and feeble mind." Albert Einstein
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.