ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Declaring timestamp field in physical file

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

  • Declaring timestamp field in physical file

    Hi, how to declare in PF timestamp field?
    like this : DATE Z ?

    and to what type can I write value of %timestamp() in rpg program? to char or to decimal or to some else ?

  • #2
    Re: Declaring timestamp field in physical file

    When you are using SEU go to the type field and press F1 to get the list of all types. works for both source.
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Declaring timestamp field in physical file

      Michael, if your creating the PF in DDS then the data type is Z, IF your creating it through DDL then it is TIMESTAMP. I would recommend you download the relevant PDF's of the reference and programing guides, many questions like these can be found and answered far more quickly by looking through them first then waiting for a response through a message board.

      Comment


      • #4
        Re: Declaring timestamp field in physical file

        Im using DDS - so I defined it with Z. (I have many reference guides, I found there answer for Z type.
        But one more question to what type can I write result of function %timestamp() ? I tried to char and to numeric and I got error (left and right sides are in different types) in both.

        Comment


        • #5
          Re: Declaring timestamp field in physical file

          Define as type Z in RPGLE also.

          Comment


          • #6
            Re: Declaring timestamp field in physical file

            It may be weird, but I did it.

            D xyz Z

            xyz = %timestamp();


            and I also got error of type mismatch....

            Comment


            • #7
              Re: Declaring timestamp field in physical file

              Your definition fro xyz doesn't show it to be a stand alone field but part of a data structure, is that what you intended? Although it shouldn't matter, I do both all the time. What line has the error? You can try the stand-alone definition here, notice the 's'.

              Code:
              d xyz             s               z

              Comment


              • #8
                Re: Declaring timestamp field in physical file

                Originally posted by michal2442 View Post
                Im using DDS - so I defined it with Z. (I have many reference guides, I found there answer for Z type.
                But one more question to what type can I write result of function %timestamp() ? I tried to char and to numeric and I got error (left and right sides are in different types) in both.
                In using ILE RPG you'd declare the variable to be a Timestamp - type Z.

                Comment


                • #9
                  Re: Declaring timestamp field in physical file

                  Yes, I used S - standalone field and Yes, I declared it as Z type. So what could be wrong?

                  Comment


                  • #10
                    Re: Declaring timestamp field in physical file

                    Here is a program that works on my system, I am at 7.1. Copy it exactly and see if it works on your system. It is hard to tell what your exact problem is because you don't show code (post in a code block, in Advanced, so we can see proper spacing/formatting). It would also be nice to see the actual message id and message you are getting and whether it is on the compile or at run-time. The line number of the error would also help. The more information you can give us the better we can help you, otherwise we are just taking guesses which just extends the amount of time it takes for someone to help you.

                    Code:
                         D xyz             S               z       
                                                                   
                           xyz = %timestamp;                       
                           *inlr = *on;                            
                           Return;

                    Comment


                    • #11
                      Re: Declaring timestamp field in physical file

                      Originally posted by michal2442 View Post
                      Yes, I used S - standalone field and Yes, I declared it as Z type. So what could be wrong?
                      What could be wrong is that you coded it wrong. But we can't tell without seeing what you did. Please post your code.
                      Tom

                      There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                      Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                      Comment


                      • #12
                        Re: Declaring timestamp field in physical file

                        What is the Job Date Fmt, and what one did you use when you complied the program.
                        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

                        Comment

                        Working...
                        X