ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Date field in DSPF DDS and RPG IV free

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

  • Date field in DSPF DDS and RPG IV free

    Date field are very handy expecially if used in RPG IV free.
    But how can I get an I/O date field to appear empty when no value has been keyed in instead of that annoying 01.01.0001 (*EUR fmt) which is displayed?

    Help.

    Thanks.

    Gianfranco

  • #2
    Re: Date field in DSPF DDS and RPG IV free

    i think what u looking for is on the dspf.
    Code:
    A                                      EDTWRD('0  .   .  ')
    or maybe a rpg solution
    "It's like a koala pooped a rainbow on my head and I can taste the colors."

    Comment


    • #3
      Re: Date field in DSPF DDS and RPG IV free

      arrow483 has the answer you are looking for in your other post.
      please in the future only post your question in one forum.

      Take care
      Jamie
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Re: Date field in DSPF DDS and RPG IV free

        No, you can use neither edit code nor edit word on a date field.

        A DTPR0 R L O 10 64REFFLD(DTPR0 BRE0000F)
        A DATFMT(*EUR)


        Thanks for trying...

        Comment


        • #5
          Re: Date field in DSPF DDS and RPG IV free

          Sorry. Thanks.

          Comment


          • #6
            Re: Date field in DSPF DDS and RPG IV free

            no big deal just glad to have you on the site hope we can share source
            Take care
            Jamie
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: Date field in DSPF DDS and RPG IV free

              Hi

              Try MAPVAL(('01.01.0001' *BLANK))

              LP Zdenko
              LP Zdenko

              Comment


              • #8
                Re: Date field in DSPF DDS and RPG IV free

                Never thought of that Thank you.... Ill test this myself ...Welcome to code400


                Jamie
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #9
                  Re: Date field in DSPF DDS and RPG IV free

                  Thanks a lot Zdenko.
                  It works perfectly. It's wonderful to end needing to deal with date. Now I move dates from DB file to DSPF and viceversa without having to care about date inversion or validity check and, thanks to you, it has a good "appearence" on screen too.
                  Bye.

                  Comment


                  • #10
                    Re: Date field in DSPF DDS and RPG IV free

                    Sorry to re-open this discussion, but...
                    can one define the DSPF dates as 8 long (inc. -,/,., or whatever)? (as with other files)
                    Having worked in several countries, I have found none that actually display the century (or want it displayed).

                    eg. I have a basic enquiry type RPG which, after the prompt, displays a SFL of some of the fields on a record. As hidden fields, I store the other fields including reformated 8 char dates.

                    regards

                    Kit
                    Regards

                    Kit
                    http://www.ecofitonline.com
                    DeskfIT - ChangefIT - XrefIT
                    ___________________________________
                    There are only 3 kinds of people -
                    Those that can count and those that can't.

                    Comment


                    • #11
                      Re: Date field in DSPF DDS and RPG IV free

                      When displaying date fields, its all a matter of which format you want. Usually its easiest to change the date field to a char field, then display. For example
                      dspfield is 8 char field
                      today is date field (any format)

                      dspfield = %char(today:*MDY/)
                      dspfield = %char(today:*YMD/)

                      This allows the pgm to pick the format (maybe based on country or something) and the DSPF sees only the char field.

                      If you do want to display a true date field on the DSPF, use DATFMT to define the format.

                      Comment


                      • #12
                        Re: Date field in DSPF DDS and RPG IV free

                        Hi Arrow,

                        Thx for the reply... I had decided to settle on the DATFMT in the DDS because I have to have 3 or more duplicates of the DSPF. 1 for US (mm-dd-yy), UK (dd/mm/yy), and DE(dd.mm.yy). If it works, I will only only be able to tell once I've translated the DSPF's from english to US english and tested.

                        With the the formatting taking place in the pgm, this would complicate matters deciding which format to use.
                        Also, the system I'm writing, I'm allowing the user to choose their own language preference which will then display dates in the format of the language they're using.

                        Regards

                        Kit
                        Regards

                        Kit
                        http://www.ecofitonline.com
                        DeskfIT - ChangefIT - XrefIT
                        ___________________________________
                        There are only 3 kinds of people -
                        Those that can count and those that can't.

                        Comment


                        • #13
                          Re: Date field in DSPF DDS and RPG IV free

                          Just thought I#D give some feedback...

                          It worked with a tweak. I had to define a standalone date and move the *ISO date to it before moving it to the DSPF field. Works a treat.

                          Now if only I could get my SQL prepare to work.... sighhhhh.

                          Think i'll just go to bed.

                          Regards

                          Kit
                          Regards

                          Kit
                          http://www.ecofitonline.com
                          DeskfIT - ChangefIT - XrefIT
                          ___________________________________
                          There are only 3 kinds of people -
                          Those that can count and those that can't.

                          Comment


                          • #14
                            Re: Date field in DSPF DDS and RPG IV free

                            Originally posted by kitvb1 View Post
                            Just thought I#D give some feedback...

                            It worked with a tweak. I had to define a standalone date and move the *ISO date to it before moving it to the DSPF field. Works a treat.

                            Kit
                            I can't think of a reason why this would be needed. If the display file field is a date, you should just be able to move to it - no need for any intermediate field.

                            Why do you think you need the standalone *ISO field?

                            Comment


                            • #15
                              Re: Date field in DSPF DDS and RPG IV free

                              Hi Jonboy,

                              If the file fields are *ISO 10 long and the display fields are *EUR 8 long and defined only in the DSPF DDS, the program dumps with an invalid year.

                              Regards

                              Kit
                              Regards

                              Kit
                              http://www.ecofitonline.com
                              DeskfIT - ChangefIT - XrefIT
                              ___________________________________
                              There are only 3 kinds of people -
                              Those that can count and those that can't.

                              Comment

                              Working...
                              X