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




That would have been smart of me to include!
V5R1

Will either your R2 or R3 option work? (I'll be trying while I wait for a
response ~  Thanks...

The %int() BIF in V5R1 doesn't know how to convert character to numeric, it only knows how to control the intermediate representation of numeric expressions.

They added the ability to convert to numeric in V5R2.

They added the ability for %DEC() to convert dates to numeric in V5R3.

So, in V5R1 you can use %CHAR() to format the date, but you can't use %INT to convert it to numeric. A quick workaround is to use the ILE C runtime library for the char -> numeric conversion, an example follows:

     H DFTACTGRP(*NO) BNDDIR('QC2LE')

     D atoi            pr            10I 0 extproc('atoi')
     D   char                          *   value options(*string)

     D result          s              8  0
      /free

          result = atoi( %char( %date() : *ISO0 ) );
          dsply result;

          *inlr = *on;
      /end-free

Personally, I'd wrap that up in a subprocedure and stick it in a global "utilities" service program so you never have to worry about it again.

If you want to do it in "pure RPG" in V5R1, you'll have to use a data structure for the character to numeric conversion. For example:

     D chardate        ds
     D   result                       8S 0

      /free

          chardate = %char( %date() : *ISO0 );
          dsply result;

          *inlr = *on;
      /end-free

Good luck


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.