RPG Debug display large field content

  • Home
  • /
  • Blog
  • /
  • RPG Debug display large field content

January 15, 2013

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 field’s 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:

NickLitten


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad 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 remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

  • Just wanted to say, this isn’t the first time I’ve come across something on your site that’s been super helpful. Thanks a ton, once again.

  • Thank you Nick you bloody legend (from Aus/NZ), I always forget the syntax (because IBM decided to make it a little cryptic). Dealing with CLOBs at the moment so I 1024 characters doesn’t cut it.

  • Hi NIck, do you know of a way to show more of an array? Tried your little trick but it turned the displayed array into unintelligible garbage asw there were numeric sub-fields.

    At present, as its a muti-ds array I have to specify the exact sub data structure to see anything, it would be nice (even if for only one element of array) to see the whole array values in one place.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Subscribe NOW
    7-day free trial

    Take This Course with ALL ACCESS

    Unlock your Learning Potential with instant access to every course and all new courses as they are released.
     [ For Serious Software Developers only ]

    Online Learning for IBM i Software Technology Professionals

    “The more that you read, the more things you will know. The more that you learn, the more places you’ll go.” – Dr. Seuss

    >