RPG Debug display large field content


Jan 15

How to view big fat fields using the RPG Debugger

In my on-going mission to to prove that you can teach an old dog new tricks… I learned a neat one today. I was trying to debug an IBMi Web Interface program (IBM RPG/FreeFormat Language) that was blowing the 64k field size limit when reading in an XML string containing hundreds of order lines.

“Yes, I know the upgrading to IBMi 6.1+ will solve the problem and increase the field limit to 16MEG (Yum!) but the client is on v5r4 and I’m stuck with that….”

So, after a little XML cleanup routine I go the field size down below the 64k limit but still had a problem with XML validation. More scratching of head and after running around in debug I discovered that my XML-RPG validation routine didn’t like something at character position 34,381 in the string. Of course, when in debug and you look at a variable it only shows you the first 1000 character of any fields data:

EVAL gReqData  GREQDATA =  ....5...10...15...20...25...30...35...40...45...50...55...60 1 '<Message source="CWDIRECT" target="CWINTEGRATE" type="CWEmai' 61 'lOut" date_created="2013-01-15" time_created="10:26:09"><Ema' 121 'il notification_type="OC" notification_type_desc="Order Conf' 181 'irmation" email_addr="xxxxxxxxxx@somethingsomewhere.com" com' 241 'pany="100" company_desc="Env-U Test Company 100" entity="21"' 301 ' entity_desc="BABY AND CHILD WEB"><CustomerSoldTo sold_to_nb' 361 'r="108498" sold_to_fname="RANDY" sold_to_lname="WATKINS" sol' 421 'd_to_addr1="1255 32ND AVENUE" sold_to_city="FREMONT" sold_to' 481 '_state="CA" sold_to_state_name="CALIFORNIA" sold_to_postal="' 541 '94538" sold_to_country="USA" sold_to_country_name="UNITED ST' 601 'ATES">/CustomerSoldTo><CustomerShipTo ship_to_fname="RANDY" ' 661 'ship_to_lname="WATKINS" ship_to_addr1="123 MAIN STREET" ship' 721 '_to_city="FREMONT" ship_to_state="CA" ship_to_state_name="CA' 781 'LIFORNIA" ship_to_postal="94538" ship_to_country="USA" ship_' 841 'to_country_name="UNITED STATES"/><Order order_nbr="129045" o' 901 'rder_date="2013-01-15" order_source="BF112WBU" order_source_' 961 'desc="BC WEB" order_offer="C8K" order_offer_desc="BABY AND C' 1021 'HILD' 

So how about when this is a huge field has something bad at position 34,381?

Just tell it you want to see more!

We can tell the EVAL statement to show us more information by telling it how much to show:

EVAL gReqData:c 35000 

This tells the EVAL statement to show me the gReqData field in Character format and to show me the first 35,000 characters. Awesome – of course, V5R4 we could go as mad as asking to see the first EVAL gReqData:c 65535 characters…

RPG Debug display large field content 1

.. just roll down till you see it:


About the Author

IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.

%d bloggers like this: