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


  • Subject: Re: "extract" command enhancement
  • From: boldt@xxxxxxxxxx
  • Date: Thu, 16 Sep 1999 08:53:41 -0400



Rick wrote:
>It would be nice to be able to extract only the century  with the "extract"
>command. Right now you can only extract the 2 digit or 4 digit year. I do it
now
>with a data structure.
>
>What also would be nice is to have the "extract" command give you the century
>even though the date in factor 2 is a 6 digit date.
>              ex:   d  date6             s    d    datfmt(*mdy)
>          c    extract   date6: *c century
>Here, *c means you want the century.
>
>Its necessary to isolate the century because alot of files have the century as
a
>field by itself.

Well, I like the idea.  I'll see what I can do.

As you may already know, we're currently thinking of adding
a whole slew of new built-in functions, including a bunch
that do date/time/timestamp manipulations.  I don't know if
we would enhance the old EXTRCT opcode, but this might be
something we could add to a possible %EXTRACT BIF.

However, if you're using V4R4 today, you could extract the
century using the following technique:
   -- EVAL the *mdy date to an *iso date variable
   -- use opcode EXTRCT to get the 4-digit year
   -- use %DIV(YEAR:100) to get the century

(Unfortunately, if the date operand uses a 2-digit year
format, opcode EXTRCT will give you a 2-digit year instead
of a 4-digit year!  For a %EXTRACT BIF, we'll likely always
return a 4-digit year value.)

Even if you couldn't use %EXTRACT to get the century in a
future release, at least you should be able to do the above
steps all in one calc statement instead of three.  ie, you
should be able to code %DIV(%EXTRACT(DT:*Y):100) to get
just the century.

Cheers!  Hans

Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.com


+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.