× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Instead of %prefixsize, why not a %varysize bif that gave you the "usable" length of the field. If you're going to have to use a new bif, it seems to me that it will be more commonly used to get at the size of the data, rather than the size of the prefix/index/whatever...

then you could code...

MaxDataLen = %varysize(MyVarFld);

Or if you really want to, you can still get at the full size with the index using

FieldSz = %size(MyVarFld);

and if you really want the size of the index you could...

IndexSz = %size(MyVarFld) - %varysize(MyVarFld);

I know I would rather type the first line of code to get at the usable length of the data...

I'm not quite sure I really understand why the index was ever exposed to RPG, and to me %size should have given MaxDataLen from the get go, but I digress...

Crispin.

----- Original Message ----- From: "Joe Pluta" <joepluta@xxxxxxxxxxxxxxxxx>
To: "'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx>
Sent: Thursday, May 17, 2007 1:24 PM
Subject: RE: Max length of a VARYING field


That way, you can code something like:

MaxDataLen = %size(MyVarFld) - %prefixsize(MyVarFld)

Right now people who mess around with this stuff are hardcoding this value,
using things like "%size(MyVarFld) - 2", and this will break if a field has
a 4-byte prefix. The %prefixsize BIF will return the size of the prefix
field.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.