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



Hi Arthur,

After the 'eval', pr_year contained 00, not 07. I figured I'm not understanding something about the step-by-step nature of complex statements.

I believe that the output of %subdt() is actually a 10i 0 variable. This is done because 10i 0 is the fastest performing numeric field on the system, and it's large enough to support any possible number that can be returned by the %subdt() function.

In the middle of your "one big expression" you have this:

%editc(%subdt(iso_date:*y):'X')

The problem with that is that when you apply %EDITC to a 10i 0 field, you end up with a 10-character string. For example, you'll have a character string like this '0000002007' When you try to take a %subst() of that field from position 3, you'll get '00' because the 07 is actually in positions 9-10.

If you really want your big ugly expression to work, you can do it this way:

pr_year = %dec(%subst(%editc(%subdt(iso_date:*y):'X'):9:2):2:0)

However, here's an alternative syntax that I think is nicer:

pr_year = %rem(%subdt(iso_date:*Y): 100);



eval fscl@yr = %subdt(iso_date:*y) eval pr_year = %dec(%subst(%editc(fscl@yr:'X'):3:2):2:0)
This worked fine.

The reason that this worked is that the output of %subdt() is saved into a separate field thats (presumably) a 4,0 field. Therefore, when the %EDITC runs, it generates '2007' instead of '0000002007' since it's taking the edit code of a 4-digit field instead of the edit code of a 10 digit field.

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.