|
Normally a varying field would have "lost" its trailing spaces whenloaded. i.e. alpha1 = %TrimR(dataSource);
because the Fixed Length (aka. Allocated-Length) must be respected !
These VarLen( ) fields are pretty cool. Let me ask a couple of lastquestions to confirm my understanding about VarLen() fields. . . .
If I have an RPG pgm that was originally written to do concatenation
of Fixed Length Fields in the form of . . . Result = %Trim( Alpha1 )
+ %Trim( Alpha2 ) ;
And if the underlying database is changed to now store these monstrous
alpha fields as VarLen() then I assume that a recompile of the RPG
will NOT be optimized enough to look and say "Hey, these are already
trimmed already, so drop the trim and keep going. (This is not that
far-fetched. I believe we have some horrible EDI - XML builder pgms
that are doing this Trim and concatenate in RPG. )
Additionally if the fields are turned into VarLen( 15 ), regular
string manipulation handles them like regular Fixed-Length Fields
// alpha1 VarLen(15) Value of 'A234567890 '
// alpha2 VarLen(15) Value of 'B234567890 '
Result = Alpha1 + %Trim( Alpha2 ) ;
then the concatenation results in 'A234567890 B234567890'
because the Fixed Length (aka. Allocated-Length) must be respected !
Variable-Length.
Now in the DDS, when the VarLen( ) is not stated, then the entire field is
( Think of a CLOB Character Large Object ) everything in the field
would be variable and would never ever need %Trim()
The DDS manual has:graphic fields) allocated for the field in the fixed portion of the file.
"The allocated-length parameter is optional.
Use it to specify the number of bytes (two byte characters in the case of
If you do not specify the allocated-length parameter, the data for thisfield is stored in the variable length portion of the file."
Is the column searchable like XML or doing Wildcard searchs. . . . the SQL
So what Birgitta says now makes sense to me about how . . .
* Decisions are made as to where to store the data
* How to manipulate the data during processing (all done under the
covers in the database, of course, irregardless of RPG or SQL to even
CPYF )
* What we should consider in Database design for the data-entity types.
- John Voriswill stop searching the varying length data a wildcard string search
from: "Birgitta Hauser"
subject: AW: Variable length fields question
6. Varying length columns are, more efficient on the IBM i when there
is a need to provide for wildcard searching. That's because DB2 UDB for i
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/midrange-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.