Solved

Debug RPG Program

Posted on 2009-07-11
6
2,726 Views
Last Modified: 2013-12-12

Hello All,
I am having a Physical file(Flat File with one field of record Length 1700)  which is having 5000 record ftped from the client every 30 minutes , there is a batch job (RPG Program) which then loads the file in to our application system basically every 30 minutes.

OK the problem is I am getting Decimal data Error in the RPG PGM,
Question is:
1.When I take RPG Dump How can I read this Dump?
2.When I debug this PGM using STRDBG  How can I get to the Exact record  which is having this error.
3.CL PGM is calling this RPG PGM, so which on I have to Debug
4.What it Production Update(*yes) Mean?
5.Any useful Debugging Tips will be Help full.

Thanks
Oramcle
0
Comment
Question by:Oramcle
  • 3
  • 2
6 Comments
 
LVL 34

Expert Comment

by:Gary Patterson
Comment Utility
1. Post the dump and we can explain it to you.  Easiest way is to use Navigator to save the spooled file as a text file and post the text file here.  Alternately, you can create a physical file to hold the spooled file (CRTPF), copy the spooled file to your new database file (CPYSPLF), and then do an FTP the resulting file down to your PC (do an ASCII transfer), but that is a bit more work.

You are looking for a numeric field that contains invalid numeric data.  Odds are, the flat file gets parsed somehow into specific fields (moved into a data structure, substringed out, etc.), and the error is going to occur when non-numeric data is moved into a numeric field.  Inspect each numeric field int he dump to see which one contains invalid data.  A common error is to move blanks (x'40') into a numeric field.

2. Just STRDBG and run the program.  It will automatically break when it encounters the error, and you can then display variables, etc, and figure out what record was last read.  If the program doesn't block records, you can do a DSPJOB (Sysreq-3), option14, and see what record was last read.  f the program does block records, you will need to inspect the dump or look at the contents of your one big field (EVAL BIGFILEDNAME) to determine which record is being processed.

3. Debug whichever program is the failing program.  It is probably the RPG.

4. It is a safety feature of debug.  *YES means that it is OK for production files (*PROD) to be updated while you are debugging.  *NO means that updates to production files should be blocked.

5. If you want to do source debugging, your program needs to be compiled with some debugging view (source view is best if source code and object code exist on the system where you will be debugging, otherwise use LIST view to embed a compile listing inside the program object.  LIST view results in a larger program object).  It is always best to debug in your test environemnet if possible.

- Gary Patterson
0
 
LVL 32

Expert Comment

by:shalomc
Comment Utility
just a footnote:

Production update refers to a property of the library where the data is located. Each library can be defined as either *PROD or *TEST.

You can see the current property with commands DSPLIBD or CHGLIB.

ShalomC
0
 

Author Comment

by:Oramcle
Comment Utility
Pls find attached RPG DUMP
splf.txt
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
Comment Utility
Starting at the top, scan the listing for "Statement in Error".    Look at a compile listing for the RPG program at line 411 - that is the line that is causing a problem.  With a low number like this, it is possibly happening during I/O on a file or a data structure.  

That line will isolate the failing file/field or data structure for you.

If you look down in the dump further, you will see that there is a File Information Data Structure (http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/books_web/c092508586.htm) section for each file in the program.  At the top, it shows you file status information (You can check out the File Status"Just before the "Key Value / Input Buffer / Output Buffer" section for each file, is the current Relative Record number for the last file operation on each file.  You can also see the contents of the input and/or output buffer for each file, and the contents of the last key value for the file.  That will help you isolate what records were being processed when the problem occurred.

I am guessing that XXFUT is your input file, and it looks like RRN#1770 may be the problem record.  Check out te fields in this record and see if you have an empty field or non-numeric data where numeric is expected,   You might want to inspect the previous few lines of this file - sometimes it is apparent when you look at it as a list.

At the bottom of the dump, you will find the current values (more or less - I'll explain that in a minute) for each variable in the program.  You want to look for invalid numeric values in ZONED and PACKED fields.  There are a bunch in here - a sign of sloppy initialization usually.  In general, you don't get a decimal data error until you access the field directly.  For example, you can have a data structure that contains numeric fields, and if you populate it by moving data into the data structure itself (or a character subfile that overlays a numeric field), you won't get an error.  But if you try to perform an operation on the numeric field later, you will get an error.

Fortunately, the total variable list is small.  Some fields that contain bad values:

F10LEFT, F10WHOLE,  MNN, S12, S9 - numeric files containing blanks.  This is probably just sloppy initialization.  You see this in data structures, since the whole data structure gets initialized to blanks by default - even numeric fields.

In your PRTCHARTONUM subprocedure:

DECPOST, NUM, and WRKNUM all contain invalid decimal data (see the garbage characters in those fields?).

If you need more help, please compile the program and post the listing.

Note that sometimes your dump does not contain up-to-date values for every variable if the program was compiled with any optimization.  If you think this is happening, you might want to recompile the program without any optimization for troubleshoting and testing purposes.  When running under debug. you definitely want to debug with an un-optimized compile.

- Gary Patterson




INFDS FILE FEEDBACK

 File . . . . . . . . . . . . . . . . . :   XXFUT

 File Open  . . . . . . . . . . . . . . :   YES

 File at EOF  . . . . . . . . . . . . . :   NO

 File Status  . . . . . . . . . . . . . :   00000

 File Operation . . . . . . . . . . . . :   READ R

 File Routine . . . . . . . . . . . . . :   *DETC

 Statement Number . . . . . . . . . . . :   00000140

 Record Name  . . . . . . . . . . . . . :   INPUT

 Message Identifier . . . . . . . . . . :

...(skipped to save space)

Relative Record Number . . . . . . . . :   1770

 Input Buffer:

    0000   C6C240C3  40C6E4E3  4DD7D9C9  D4C5E3D9  C1C4C55D  6B6B6B6B  6BF2F0F0  F9F0F7F1      *FB C FUT(PRIMETRADE),,,,,2009071*

    0020   F06B6B6B  6BD6E2D7  F96B6B60  F16BC56B  6BC66B6B  F9F94BF8  F1F0F0F0  F0F0F0F0      *0,,,,OSP9,,-1,E,,F,,99.810000000*

    0040   F0F0F0F0  F0F26B40  6B6B6BF1  F0F04BF0  6BD6E3C8  6B6BD1E6  E36BC6C9  6B6B6BE2      *000002, ,,,100.0,OTH,,JWT,FI,,,S*

    0060   E3E3F56B  6B6BF06B  6B6B6B6B  6BC16B6B  6B6BF2F2  F4F8F9F9  F0F96B6B  6B6B4040      *TT5,,,0,,,,,,A,,,,22489909,,,,  *

    0080   40404040  40404040  40404040  40404040  40404040  40404040  40404040  40404040      *                                *

    00A0   40404040  40404040  40404040  40404040  40404040  40404040  40404040  40404040      *                                *

    00C0   40404040  40404040  40404040  40404040  40404040  40404040  40404040  40404040      *                                *

    00E0   40404040  40404040  40404040  40404040  40404040  40404040  40404040  40404040      *                                *

    0100   40404040  40404040  40404040  40404040  40404040  40404040  40404040  40404040      *                                *

    0120   40404040  40404040  40404040  40404040  40404040  40404040  40404040  40404040      *                                *

    0140   40404040  40404040  40404040  40404040  40404040  40404040  40404040  40404040      *                                *

    0160   40404040  40404040  40404040  40404040  40404040  40404040  40404040  40404040      *                                *

    0180   40404040  404040                                                                    *                                *

Open in new window

0
 

Author Closing Comment

by:Oramcle
Comment Utility
***** (5 Star) , Thank you Gary ( I dont think Just Thank you is enough for your Answer , But any way THANKYOU)
0
 
LVL 34

Expert Comment

by:Gary Patterson
Comment Utility
Happy to help.

- Gary Patterson
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Let’s list some of the technologies that enable smooth teleworking. 
Viewers will learn how to use the Hootsuite Dashboard.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now