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…
.. just roll down till you see it:
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.
It’s realy cool. From Moscow with big thanks 🙂
Very helpful. Thank you
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.
This is great and a huge help. Thanks!
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.
Hi,
Thanks. Do you know how to
assign a longer length value to a variable in debug mode
Hi,
Thank you.
It doesn’t work anyway for CCSID 1208 variables.