ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Date format *EUR

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

  • Date format *EUR

    Hi,

    Is it possible to define DDS of a physical file with DDMMYYYY format with no Date separator in it?


    I know *EUR is there but it has length of 10 but i need to be limited with length of 8 only so how can i write the structure of my physical file to achieve this?




    Thanks ...

  • #2
    Again! A Date is (under the covers) a running Number (called scaliger no) starting with January, 1 4713 BC which nobody can read. Date Formats are used to make this scaliger no readable.
    In this way it is possible to compare a dates in any format with each other. However if you need something like European Format without separators you have to convert the date into a character (representation) of a date and remove the separators.

    Comment


    • #3
      so do you mean i need to declare it as a numeric field with 8 length or date fieled with * eur (without mentioning any length) which by default automatically picks up length 10 in the system.


      Also how can we convert the date into a character (representation) of a date and remove the separators.



      Thanks...

      Comment


      • #4
        I'm utterly confused. You are carpet bombing the community with questions that
        are quite basic and your questions are showing us that you are very new to everything.
        But some of them I think you should have been taught by your teachers or colleagues
        that are training you. Or at least you can find them in the examples in the manuals.

        Here is a link to all manuals for the IBM i

        https://www.ibm.com/docs/en/i/7.3?to...-files-manuals

        I recommend you take a look in the DDS manuals ( concepts / physical and logical files / display files )
        and the RPG manuals ( reference / programmers guide ).
        The Control language manual (CL) can also be usefull.

        And by the way -- welcome to the IBM i world




        Last edited by Peder Udesen; January 13, 2022, 02:43 AM.

        Comment


        • #5
          Thanks i have been reading manuals etc but unable to sort out my query "o do you mean i need to declare it as a numeric field with 8 length or date fieled with * eur (without mentioning any length) which by default automatically picks up length 10 in the system.


          Also how can we convert the date into a character (representation) of a date and remove the separators.


          "


          Thanks..

          Comment


          • #6
            For a date field, you can define a field as date or timestamp in DDS. The system will store a value in that field in a format it understands. This is different to how the date for instance is displayed. As the system understands this is a date/timestamp, it can display it in other formats. Maybe it would help if you explained what you were trying to do. Perhaps you are wanting to display the date on a workstation in a particular format? Maybe you are wanting to compare the date to some value? If we knew what you were trying to do, we might be able to offer some assistance.

            Comment


            • #7
              I just want date field with DDMMYYYY format with no Date separator in it and it should have a length of 8.


              thanks..

              Comment


              • #8
                It is not possible to define a date field in DDS without separators.

                If it must only occupy 8 bytes, then you can define it with type A (character) or S (numeric), and then convert it to a true date in your RPG programs using %DATE, or using %CHAR or %DEC to convert the true date version back to the character or numeric version for the file.

                For the built-in functions, use format *EUR0 (that's a zero) if it is a character value without separators or use format *EUR if it is numeric.

                Comment


                • #9
                  As has been explained many times by several people now, DDS does not store a date field as DDMMYYYY or any other date like format, it stores it in it's own internal format (Birgitta mentioned this is a scaliger no from a certain date). How it is displayed is up to you. What are you using to display this date field?

                  Comment

                  Working...
                  X