ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Bad or Smart? DESCEND !

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

  • Bad or Smart? DESCEND !

    Using DESCEND for read file reverse!

    It's almost 5 o'clock here
    Just a thought... before going home...

    I looked at some DDS code written on



    by JimmyOctane

    And I noticed this DDS keyword on a key: DESCEND
    in one of the examples.

    If I use it on a key , can It then replace READP with a READ ? ( Or Vice Versa )

    Is it BAD programming or Smart ?

  • #2
    Re: Bad or Smart? DESCEND !

    Well that depends on the situation, cos in order to this you would need a separate logical with the keys specified with DESCEND keyword.

    If youre using an existing logical to read forward and in one case read backward then READP/READPE is a better option.

    Comment


    • #3
      Re: Bad or Smart? DESCEND !

      Hi Marc:

      I use it in combination with ascending.

      Acct-ascending
      Transaction Date-decending

      Setll on acct and read
      That shows the latest/previous/previous etc transaction for the account.

      Works great.

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

      Comment


      • #4
        Re: Bad or Smart? DESCEND !

        it's not good or bad really. it depends on the situation. sometimes it's done just to prevent other folks coming behind you from going nuts wondering why you're reading the file backwards (if it's ascending and you need to process in descending order). as GLS mentioned there have been occasions where i've had to have multiple keys in the same LF some were needed in ascending order and other key fields in descending order. it's the same ol' use the right tool for the job
        I'm not anti-social, I just don't like people -Tommy Holden

        Comment

        Working...
        X