× 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.



Joe Pluta wrote:
>
> No, I haven't really had a chance to.  What is the primary purpose and/or
> benefit of VARYING?  At some point I need to re-encapsulate my IFS routines
> (I generate JSP and XML files), and something tells me VARYING would work
> well there, probably better than the %trim and "+" technique I've used up
> until now.  (Of course, %trim and "+" is a step up from the original CAT :nn
> syntax that I was using!)

The purpose of VARYING is to make it easier to use character data when
the data doesn't have a constant length.  An additional benefit is that
using varying fields in calculations is usually faster than using
non-varying fields, because you don't have to keep trimming off the
blanks.

If you're using %trim whenever you're using your character fields, then
you'd be better off with varying.  With varying fields, you have at most
one %trim when you're loading the field, and then you don't have to
bother.

qualname = %trim(lib) + '/' + %trim(file) + '(' + %trim(mbr) + ')'

vs

qualname = lib + '/' + file + '(' + mbr + ')'

Not only do the %trims clutter up the code, they cost processing time,
if you ever trim the same field more than once.

If you have routines that have CONST VARYING parameters, your callers
have to be sure to do a %TRIM on the call, unless your callers are
systematically using VARYING for all character variables.

(One of our recent enhancement poll items was OPTIONS(*TSTRING), to
behave like OPTIONS(*STRING) but to trim automatically.  If we do that
enhancement, I think we would also add a way to get automatic trimming
for CONST VARYING parameters.)




As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.