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