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



Yikes - I just spent most of the morning debugging some code I converted
to /free over the weekend. I thought I'd pass on a difference between
EXTRCT and %subdt hoping to save someone else from the same headache.

The original program used EXTRCT to retrieve *month into a 0-filled 2-char
field:
C                   Eval      w_Date = %date()
C                   Extrct    w_Date:*m     w_Char2

I assumed this /free code was equivalent. Boy, was I wrong...
           w_Char2  = %editc(%subdt( w_Date : *months ) : 'X');

The %subdt BIF does not automatically adjust the size of its workfields
according to the 2nd parameter. Unless explicitly defined, it uses a 10,0
decimal field which caused the %editc to give unexpected results. It would
have been a bonus if the compiler automatically used a 2,0 workfield when
processing *M and *D values, but I guess you can't have everything! My
solution was to code two /free statements:
           w_Dec2  = %subdt( w_Date : *months );
           w_Char2 = %editC( w_Dec2 : 'X' );

JK

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.