I am just learning the AS/400 and RPG. How do you read a formatted dump of an RPGIII Program and what do you look...
for? Example: I received an error message on the concole RX402R 6641 decimal-data error in field (C G S D F). I enter "D" to get a dump. Where do I start to find the problem?
What the "dump" shows you are the files that are opened, the record they are pointing to, and the value in each of the fields. All "dumps" are stored in output queue "QEZDEBUG". If you type WRKOUTQ QEZDEBUG you will see all the different spool files that were created when a program failed.
When you receive a decimal data error, the program either placed non-numeric data into a numeric field or the field was never initialized before it was accessed. If you look through the spool file, you will see "Invalid data" listed for the value of a numeric field. The dump will also tell you at what line of the program the error occurred. Look inside your program at the line and see which of the fields are in error.
Decimal data errors are one of the most common errors to receive in RPG. Here are a few hints to help to ensure they don't happen.
1. Before dividing two fields, make sure factor two is not equal to zero.
C @NUMB1 IFNE *ZEROS
C @NUMB2 DIV @NUMB1 @RESULT
2. If defining numeric fields in the "I" spec, place an "I" in column 8 so the field is initialized at the start of the program.
I I 0 B 1 40NUBMQ
3. If defining numeric fields in a multiple occurrence data structure, initialize all the fields.
ITEST DS 100
I 1 20 TST1
I 21 30 TST2
I 31 350TST3
C* C** Clear the initial Test array
C 1 DO 100 X
C X OCUR TEST
C Z-ADD1 X 30
I hope this helps, and you can find the error within the program. The dump can be several pages long, but in there is the one piece of information you need. Take some time and read the dump, you will find all kinds of useful information on what the program was doing at the time it failed. Remember that by knowing the statement the program failed on, you can run it in debug and see were the problem is before the fail actually happens.
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.