× 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: Query400 question
  • From: gmihajlo@xxxxxxxx
  • Date: Fri, 18 Feb 2000 11:20:11 -0600

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>Bill,
>very interesting your instructions for Date manage with Query/400.
>One more question: don't you know if there is a keyword in query that allow
>me to convert an alphabetic field in a numeric ? (something opposite to the
>keyword DIGITS).
>Thanks
>Claudia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Query/400 does not have such function, but there is a good workaround described
in a document called 'Converting a Character Field to Numeric' (document#:
4892030) on IBM AS/400 Support Web page:

http://as400service.rochester.ibm.com/

Go to the folder:

\\Tech Info & Databases\Software Knowledge Base


and then search for document#:4892030 for all details. The idea is to use
TIMESTAMP function which accepts a character string as a valid time stamp.
Because part of the time stamp is a six-digit microsecond, this one can be used
to be converted using MICROSECOND function to retrieve numeric representation of
the character field.

For example:

CHARFILD is a six-digit character field in the file. If you define the following
result field using TIMESTAMP fuction:

TMSTAMPWK TIMESTAMP('1995-01-01-12.00.00.'

¦¦CHARFILD)

and then another result field as:

NUMERICWK MICROSECOND(TMSTAMPWK)

This field will contain numeric representation of the value in character field
CHARFILD from the begining of the example:

                                 DISPLAY REPORT
                                              REPORT WIDTH . . . . . :      50
 POSITION TO LINE  . . . . .              SHIFT TO COLUMN  . . . . . .
 LINE   ....+....1....+....2....+....3....+....4....+....5
        CHARFILD  TMSTAMPWK                     NUMERICWK
 000001  021700   1995-01-01-12.00.00.021700       21,700
 ****** ********  END OF REPORT  ********


Pay attention that all six digits for microseconds are required. If the field is
less than six digits, it must be padded with zeros (0) to the left. For example,
0000xx would be correct for a two-digit field. If the field is more than six
digits, do multiple conversions and use numeric operations to calculate the
correct value. If the field requires a decimal portion, do the conversion, then
use numeric operations to convert to the correct decimal value.

Regarding Andreas' question:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>what I want to do is to just add one day to a certain date.
>Imagine the 17th of February is the shipping date of goods and we find this
>date in the system. If we always calculate one day for carrying the goods
>to the customer in this case the 18th of February will be the day he
>receives the goods.
>The date the customer receives the goods shall be displayed on the report.

>We already did the conversion from Format  lsdte = 20000217 to lsdted =
>17/02/00 (as you stated in you previous mail). That was already known and
>it was no problem.
>Now I'm still not sure how to change the date to 18/02/00.
>In our recent queries we were used to do it the "quick and dirty" way and
>just said 20000217 + 1 and of couse in this case you'll get the 18st of
>February but in another case it's also possible to get the 30st of
>February....

>Andreas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Bill's explanation covers most of what is needed in this area, but if you need
more examples, there is another very good document on the above mentioned Web
site ('Query/400 Conversion of Date and Calculating Duration',doc#:  6513553)
which basically explains the same techniques of date arithmetics in Query/400
presented by Bill.

There are also good topics in Query/400 Use manual, under chapter 2, for example
topic: 2.3.4.2 Converting Date for Output to a Display or Printer.

Help for Define Result Fields screen, particularly for Expression field also
offers good info on available functions and their use.

Unfortunately, I don't have a copy of Bill's email anymore, but if you need more
details regarding his explanation after the info I mentioned above, please let
me know (at gmihajlo@ssax.com).

Hope this helps,
Goran


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.