ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Ligical deletion of records from physical file

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

  • Ligical deletion of records from physical file

    Hi,

    Is there any way to logically delete a record from a physical file without using any field(field is used to mark deletion code, most people use X for marking a rocord which is logically deleted from file) for deletion code marking.

    Kaleem

  • #2
    Re: Ligical deletion of records from physical file

    My head hurts. Do you want to actually delete the record(s) or not?
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: Ligical deletion of records from physical file

      Thank funny my head hurt after that also....
      it may be a secret CIA torture test.

      you can delete the record....with the delete opcode or sql or.......???
      then right after run a RGZPFM or change the physical file to

      PHP Code:
       Reuse deleted records  . . . . . REUSEDLT       *SAME 
      and pray for someone to write a record to that exact spot in the file.
      (come on it could happen)

      happy friday
      ladies and Germs!

      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: Ligical deletion of records from physical file

        Originally posted by Kaleem Qureshi View Post
        Hi,

        Is there any way to logically delete a record from a physical file without using any field(field is used to mark deletion code, most people use X for marking a rocord which is logically deleted from file) for deletion code marking.

        Kaleem
        I don't think so. The most common approach is to have a field called DELETE or IGNORE or something along that line and have the program/query/SQL ignore those records as if they were deleted.

        There is no way that I know of to "logicly delete" the record without actually programming for it by checking the value of a field or omiting it from a logical by that field.

        You could make another file that you copy the original record over to and then do a physical delete from the original file if you need to retain the information but have the record deleted.

        Hope that helped.
        Goodbye

        Comment


        • #5
          Re: Ligical deletion of records from physical file

          *pounding headache*

          why? can you just answer me that? is there a method to this madness?
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: Ligical deletion of records from physical file



            It's a "soft delete". Sometimes you want to "delete" a record so that it doesn't show up on your screen but is still there for history. Different situations call for different solutions. I've seen this handled by a COMPLETE flag, an ACTIVE flag, a STATUS flag, an IGNORE flag and a DELETE flag. But all of these "flags" take programming to ignore the record in question and Kaleem was asking if there was an easier way other than a "hard delete".

            One way I have seen to handle this without flags is to have 2 physical files, one for regular records and one for deleted records. Delete the record from one file and write it to the other. Using a joined logical you could see all of the records if you needed to.
            Goodbye

            Comment


            • #7
              Re: Ligical deletion of records from physical file

              here is how we handle it. our files have an ID field at the very beginning. And kinda as a default we have 2 logicals over each file. One of them will exclude any of the 'soft deleted' records and the other logical will run wide open. When it comes to certain files, like invoices and orders, we have a history library which we 'purge' our live records over to after a given amount of time. So a closed order or invoice gets moved form our live data file over to the history data file when we do our weekly purging program.

              It is always going to take some coding to decipher the difference. Or just create the logicals you want. Its not like logicals take up a ton of space so you might as well use them.

              IMHO

              Good news, my headache is gone. Our facility president just let us know we are leaving 2 hours early today because our business is doing so good. Gotta love perks and long weekends
              Your future President
              Bryce

              ---------------------------------------------
              http://www.bravobryce.com

              Comment


              • #8
                Re: Ligical deletion of records from physical file

                No other than KenM understood my question well.

                The solutions, suggested by both KenM and Birce are useable.

                I will try them.

                But they could be some other way also,.......

                Thanks for help.

                Kaleem

                Comment


                • #9
                  Re: Ligical deletion of records from physical file

                  Well, maybe there is a way. If you define the file as "reuse deleted records" = *no, deleted records stay in the file, but are no longer seen by the program. They can be actually be un-deleted. However, there is a danger in this, as the records can be lost by RGZPFM, CPYF, RST0BJ, etc.

                  Comment

                  Working...
                  X