ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Need to subtract 1 day from character

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need to subtract 1 day from character

    If I have an RPG program and a charater parm of POSTDATE as '20070111'. How do I convert it to ISO so I can subtract 1 day from it?

    Thanks,

    DAC

  • #2
    Re: Need to subtract 1 day from character

    Numeric
    d NewDate s 8 0 Inz
    d OldDate s 8 0 Inz(20070111)
    /Free
    NewDate = %Dec(%Date(OldDate:*Iso) - %days(1));
    *Inlr = *On;
    Return;
    /End-Free

    or Alpha
    d NewDate s 8 Inz
    d OldDate s 8 Inz('20070111')
    /Free
    NewDate = %Char(%dec((%Date(OldDate:*Iso0) - %days(1))));
    *Inlr = *On;
    Return;
    /End-Free


    Good Luck
    Bill
    Last edited by Billw; January 11, 2007, 10:27 AM.
    Bill
    "A good friend will bail you out of jail,
    A true friend would be sitting beside you saying,
    'Wow, that was fun.'"

    Comment

    Working...
    X