ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

A little more help with /free

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

  • A little more help with /free

    I have the following fixed format code to get a date in the format of YYYMMDD stored as a 8 0 field.

    Code:
         C                   MOVEL     *YEAR         TODAY
         C                   MOVEL     *MONTH        MMDD
         C                   MOVE      *DAY          MMDD
         C                   MOVE      MMDD          TODAY
         C                   TIME                    TIMSTP           14 0
         C                   MOVEL     TIMSTP        CURTIME
    How does one go about doing this in /free since the MOVE is no longer available, correct?
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

  • #2
    Re: A little more help with /free

    couldn't you try something like...

    Curtime = %date(*date:*CYMD);

    Comment


    • #3
      Re: A little more help with /free

      I sure could try it
      Your future President
      Bryce

      ---------------------------------------------
      http://www.bravobryce.com

      Comment


      • #4
        Re: A little more help with /free

        As it turns out... "The Format *CMYD is not allowed with UDATE or *DATE." Those words are from the compiler. He wasn't fond of it.

        Code:
         TODAY = %date(*date:*CYMD);
        TODAY is an 8 0 field...I'm gonna keep playing with it. I really want as little lines of code as possible. Its gotta be able to be done in one long string of BIFs
        Your future President
        Bryce

        ---------------------------------------------
        http://www.bravobryce.com

        Comment


        • #5
          Re: A little more help with /free

          I was just looking over Fun with Dates and I see that I could have done this in fixed format all along....

          Code:
          C                   Move      ISODate       Decimal8
          Duh. But I need to perform this exact action in /free because I'm trying to /free myself.
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: A little more help with /free

            Try this
            TODAY = %dec(%date():*CYMD)

            Comment


            • #7
              Re: A little more help with /free

              BTW, CYMD is a 7 pos field. ( 01/30/2008 is 1080130 in CYMD) If you want and 8 position field, you probably want ISO format. This will yield 20080130.
              TODAY = %dec(%date():*ISO)

              If you want a true date field, them TODAY = %date() or TODAY = %date(*date)
              The *DATE and UDATE fields are predefined so you don't need to specifiy any date format. Remember that the format applies to the NON-DATE field in the expression.

              Comment


              • #8
                Re: A little more help with /free

                I tried TODAY = %date() and TODAY = %date(*date)....both of them didn't work.

                But TODAY = %dec(%date():*iso); did work

                I knew there was a simple explanation.

                Would TIMESTMP = %dec(%TIME()); give me the time in HH:MM:SS? if TIMESTMP is a 6 0 field?
                Your future President
                Bryce

                ---------------------------------------------
                http://www.bravobryce.com

                Comment


                • #9
                  Re: A little more help with /free

                  Originally posted by bryce4president View Post
                  I tried TODAY = %date() and TODAY = %date(*date)....both of them didn't work.

                  But TODAY = %dec(%date():*iso); did work

                  I knew there was a simple explanation.

                  Would TIMESTMP = %dec(%TIME()); give me the time in HH:MM:SS? if TIMESTMP is a 6 0 field?
                  Because you have TODAY defined as a numeric, not a "true"date field.

                  You missed the point of the format. The format (date or time) applies to the NON-DATE or NON-TIME field. The format of %time() is unimportant. The format specified is the format you want in the numeric field.
                  Also look at %subdt BIF.

                  Comment


                  • #10
                    Re: A little more help with /free

                    So, TIMESTMP = %dec(%time():*HMS)

                    Comment


                    • #11
                      Re: A little more help with /free

                      Yep Yep. You are right Arrow. I did look into %subdt BIF. Its very easy to use, but more wordy than doing it this way. I can see where it would be useful especially for doing math with dates.
                      Your future President
                      Bryce

                      ---------------------------------------------
                      http://www.bravobryce.com

                      Comment

                      Working...
                      X