ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

IFS Directory Renaming

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

  • IFS Directory Renaming

    If I have a directory with 50000 log files in it; would renaming the IFS directory be relatively quick or would it take a long time? To elaborate; we are a JDEdwards E1 shop and we cycle E1 weekly. What I'd like to do is rename the directory with all the logs when E1 is down and create a new empty directory for E1 to stick logs in once I restart it. My management wants to keep 30 days of logs, but having them all in one directory makes it too hard to find anything, i.e. errors. My thought was to allocate the logs each time we recycle E1 to its own directory by just renaming the directory.

    I am not sure if all the pointers to the logs are touched when a rename is done.

    TIA, Jay
    "Not that I need one; but I.T. is just one more reason to drink, and drink heavily! Also, they claim there is too much violence in the workplace, perhaps there isn't enough."

  • #2
    Re: IFS Directory Renaming

    just a wild guess...it wouldn't be much difference on the initial "rename" since it's already full up. personally i would create a new directory by the date for the logs and move them into that directory rather than renaming the directory & creating a new one each day. just seems more simple to my very simple mind
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: IFS Directory Renaming

      I agree with Tom... make a new folder every day inside the main folder...

      I actually renamed the documents by date - let me know if you are interested in the rest of the code
      Code:
            //  *****  Rename the file  *****                            
            // RNM OBJ('/home/Reserve_Adjustments/May Claim Fees.csv')   
            // NEWOBJ('SomeNewName.csv')                                 
            // *like: November16_2011_114547.csv                         
                                                                         
               nDays = %diff(today : baseDate : *days);                  
               ceedate(nDays:'Mmmmmmmmmm':ReturnData:*OMIT);             
                                                                         
               MyNewName = %trim(ReturnData)  +                          
               %char(%subdt(Today:*days)) + '_' +                        
               %char(%subdt(Today:*years)) + '_' +                       
               %ScanRpl('.' : '' :                                       
               %char(%time())) + '.csv';                                 
                                                                         
               cmdstring = 'RNM OBJ(' + Q +                              
                           %trim(filename) + Q + ')' +                   
                           ' NEWOBJ(' + Q + %trim(MyNewName) +           
                           Q + ')';                                      
                                                                         
               cmdlength = %len(%trim(cmdstring));
      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: IFS Directory Renaming

        Thanks for the replies. I think your suggestions might be what I may ultimately implement.

        However, what I am really trying to determine is; would a rename of the directory be faster than executing a program that scans and renames (moves) each log to a different directory. I.e. Is renaming 1 directory object faster than running a program that performs an action on each file object in the directory?

        Jay
        "Not that I need one; but I.T. is just one more reason to drink, and drink heavily! Also, they claim there is too much violence in the workplace, perhaps there isn't enough."

        Comment


        • #5
          Re: IFS Directory Renaming

          I believe the rename would be faster.....
          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


          • #6
            Re: IFS Directory Renaming

            Originally posted by jamief View Post
            I believe the rename would be faster.....
            the difference would most likely be unnoticeable. but if you go the rename & recreate route make sure that your newly created one has the appropriate authorities assigned to it.
            I'm not anti-social, I just don't like people -Tommy Holden

            Comment


            • #7
              Re: IFS Directory Renaming

              Thanks for the replies. I would agree that a rename wouldn't be noticably faster for a directory with only a few hundred objects. If you have a directory with 50,000 objects, then I wonder if the rename wouldn't be noticabily faster than a program that scans and touches the directory. It might not be faster if the rename also has to touch each object in the directory to change pointers. I still don't have a good "feel" as to whether it would be faster, I guess I'll have to setup a test.

              J
              "Not that I need one; but I.T. is just one more reason to drink, and drink heavily! Also, they claim there is too much violence in the workplace, perhaps there isn't enough."

              Comment


              • #8
                Re: IFS Directory Renaming

                that sounds good......save the folder to a *SAVF then restore in another sub folder.
                then test away.

                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

                Working...
                X