Re: AIX 5.2 vs 4.3.3 differences

From: Green, Simon (Simon.Green_at_EU.ALTRIA.COM)
Date: 06/13/03

  • Next message: Jeff Barratt-Mccartney: "Re: AIX 5.2 vs 4.3.3 differences"
    Date:         Fri, 13 Jun 2003 18:15:34 +0200
    To: aix-l@Princeton.EDU
    
    
    

    First option would be to get the date in the correct format to start with,
    (date +%Y%m%d).

    Second, option:
    typeset -Z -L date=030611
    That will strip leading zeros, so it'll be treated correctly as a decimal
    number.

    Third option, just put 20 in front of it: date=20${date}.

    I've confirmed the same behaviour on a 5.1 box, (ML04). It actually throws
    errors up if you have an "invalid" number, such as 030618, (obviously there
    can't be an 8 in an octal number). So you better fix it before Wednesday!

    I haven't bothered to search for an APAR for this so you might like to do
    that.

    Simon Green
    Altria ITSC Europe s.a.r.l.

    AIX-L Archive at http://marc.theaimsgroup.com/?l=aix-l
    <http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2> &r=1&w=2
    AIX FAQ at http://www.faqs.org/faqs/aix-faq/
    <http://www.faqs.org/faqs/aix-faq/>

    N.B. Unsolicited email from vendors will not be appreciated.

    -----Original Message-----
    From: Tony Gallo [mailto:tony_gallo@THRUWAY.STATE.NY.US]
    Sent: 13 June 2003 16:19
    To: aix-l@Princeton.EDU
    Subject: AIX 5.2 vs 4.3.3 differences

    We recently upgraded a 7025 6F0 box from 4.3.3 to 5.2. So far the only
    problem that the programmers reported was when they run the following to
    manipulate the date:
    4.3.3 software:
    date=030611 (yymmdd)
    date=$(($date+20000000))
    echo $date
    20030611 (this is the
    result we want in yyyymmdd format)

    5.2 software:

    date=030611
    date=$(($date+20000000))
    echo $date
    20012681

    They believe that the leading 0 is causing the number to be treated as an
    octal number. It is converting it to octal an then doing the addition
    causing the difference. I realize to get the date they should have used
    standard date functions but since they did this already, can anyone tell me
    an easy way around this so they don't have to start changing all their
    code??


  • Next message: Jeff Barratt-Mccartney: "Re: AIX 5.2 vs 4.3.3 differences"

    Relevant Pages

    • Re: Opening Up Newsgroups
      ... Use a proper newsreader and turn off your capslock instead. ... There's that echo again ... For goodness sake put it in the correct format so it can be opened in OE :-) ...
      (microsoft.public.windowsxp.general)
    • Re: Opening Up Newsgroups
      ... There's that echo again ... For goodness sake put it in the correct format so it can be opened in OE ...
      (microsoft.public.windowsxp.general)