Q

How to read the formatted dump of an RPGIII Program.

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
C ENDIF

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.
IBINARY DS
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*
C 1 DO 100 X
C X OCUR TEST
C CLEARTEST
C ENDDO
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.


This was first published in March 2001

Dig deeper on RPG iSeries programming

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close