ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Logical LIFO

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

  • Logical LIFO

    I have a logical, dup keys allowed.

    Company
    Part
    Transaction Date (descending)
    Transaction Time (descending)

    K CO
    K PN
    K DATE DESCEND
    K TIME DESCEND

    I have two records with same keys:
    Company = 3
    Part = 123
    Date 2007-04-17
    Time 13:26:49

    RRNs=
    2169116
    2169117

    Without adding a rrn field to the file, how can I define the logical as Last in First out. So I get the rrn 2169117 first then the 2169116 second? The RRN is the only indicator that which one came first. The transactions process so fast they happen within the same second. But in reality 2169117 came second and that's the order I wish to see them in my display

    Thnx
    Bill
    "A good friend will bail you out of jail,
    A true friend would be sitting beside you saying,
    'Wow, that was fun.'"

  • #2
    Re: Logical LIFO

    Can't you just define the physical to the program as unkeyed, do a *HIVAL SETGT on the file then a READP?

    Comment


    • #3
      Re: Logical LIFO

      Originally posted by Billw View Post
      I have a logical, dup keys allowed.

      Company
      Part
      Transaction Date (descending)
      Transaction Time (descending)

      K CO
      K PN
      K DATE DESCEND
      K TIME DESCEND

      I have two records with same keys:
      Company = 3
      Part = 123
      Date 2007-04-17
      Time 13:26:49

      RRNs=
      2169116
      2169117

      Without adding a rrn field to the file, how can I define the logical as Last in First out. So I get the rrn 2169117 first then the 2169116 second? The RRN is the only indicator that which one came first. The transactions process so fast they happen within the same second. But in reality 2169117 came second and that's the order I wish to see them in my display

      Thnx
      Well, if you could change the file(although I'm getting the impression you can't) you could try increasing the accuracy of the time field to handle 13:26:49:01
      The :01 portion can come from the actual time or, if this would still duplicate entries you can set the file to not allow duplicates and handle the error internally and add 1 to the sub-second portion of the time.

      Having said all that, If you can't change the file... I have no idea

      Comment


      • #4
        Re: Logical LIFO

        This is displaying transactions in a subfile for a user selected part in descending date/time order and I "would like" the two above records of equal keys to display Last one first.

        PHP Code:
        Company         part   date        time      qty  type
        3               123    2007
        -04-17 13:26:49   10   Stock-to-Stock      (2169117)
        3               123    2007-04-17 13:26:49   10   Receipt-to-Stock   (2169116)
        3               123    2007-04-16 07:10:42   18   Shipment
        Etc
        ...

        Instead of:
        3               123    2007-04-17 13:26:49   10   Receipt-to-Stock   (2169116)
        3               123    2007-04-17 13:26:49   10   Stock-to-Stock      (2169117)
        3               123    2007-04-16 07:10:42   18   Shipment
        Etc
        ... 
        Thought maybe there was a way within the DDS of the logical file to define this.
        But I guess not.

        PS: You're right Red...I will not change the file for the sake of this. WAY too much work...it's a wish not a requirement.
        Bill
        "A good friend will bail you out of jail,
        A true friend would be sitting beside you saying,
        'Wow, that was fun.'"

        Comment


        • #5
          Re: Logical LIFO

          you could load the subfile by reading the table then use infds attached to file to get rrn...add rrn as a hidden field in the subfile then use this example to sort the subfile by hidden rrn...



          cool crap!

          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


          • ruvinir
            ruvinir commented
            Editing a comment
            Could you please share the document again

        • #6
          Re: Logical LIFO

          Hey Bill:

          from IBM:

          DDS for physical and logical files

          --------------------------------------------------------------------------------

          LIFO (Last-In First-Out) keyword for physical and logical files
          Use this file-level keyword to specify that records with duplicate key values from the same physical file member are retrieved in a last-in first-out (LIFO) order.

          This keyword has no parameters.

          LIFO is not allowed with an FCFO, FIFO, UNIQUE, or REFACCPTH keyword.

          If you do not specify FCFO, FIFO, LIFO, or UNIQUE, records with duplicate key values are retrieved in first-in first-out (FIFO), last-in first-out (LIFO), or first-changed first-out (FCFO) order, but the order in which they are retrieved is not guaranteed.


          Best of Luck
          GLS
          The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

          Comment


          • #7
            Re: Logical LIFO

            Well you're the man GLS...exectly what I wanted. Works like a charm...Next time the beer's on me.

            Thnx
            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