|
Answer #1 Change the If statement to check the length of error.description instead of a space. This is a very common mistake when fixed length programmers attempt to use variable length data. Answer #2 Yes, temp2 is taking up more main storage. Setting the maximum length of the variable length variable is important but not as important as being able to support the need of you application program. Setting the value to high tends to be wasteful and setting it too low results in data lose or lack of support. My two cents... Use variable length variables whenever appropriate. Mainly because they process much quicker than fixed length strings. Is INZ mandatory? No. Not any more then INZ on a fixed length string. But then again, sometimes the INZ on a fixed length string is important and keep in mind that the INZ value is actually determined at the EndSR time of the *INZSR statement and that most likely could use it's own thread here to discuss. Hope this helps Aaron, Ken Slaugh (707) 795-1512 x118 Chouinard & Myhre, Inc. CA/400 Certified Specialist iSeries Network/MSE Administrator http://www.cm-inc.com/ "Bartell, Aaron L. (TC)" To: "'RPG programming on the AS400 / iSeries'" <ALBartell@xxxxxxx <rpg400-l@xxxxxxxxxxxx> orp.com> cc: Sent by: Subject: Varying - Inz mandatory? rpg400-l-bounces@x idrange.com 08/15/2003 07:39 AM Please respond to RPG programming on the AS400 / iSeries I have a couple VARYING questions. Question #1. D error DS Qualified D code 10A D description 256A Varying /Free If error.description <> ' '; error.code = '0'; EndIf; *InLR = *On; /End-Free I get a 'Length of varying length variable is out of range.' error message if I don't Inz the error DS or the description subfield. This wouldn't be a problem if in the documentation they said that you needed to Inz DS's/subfields if they have VARYING fields. At least I can't seem to find where it might state that, and I have looked both in the WDSc docs and Info Center. Do you have to Inz or occupy a field before you can check to see if it contains a value? I am on V5R1. Question #2 If I define two fields defined as this. . . D temp D 256A Varying D temp2 D 32767A Varying If both fields contain the value 'Hi there' is temp2 taking up more space or processing than temp? Or doesn't it matter anymore now that I have VARYING specified on each field? TIA, Aaron Bartell _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.