ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Losing my mind: OVRDBF

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

  • Losing my mind: OVRDBF

    Hello,

    I've lurked here and there and usually can find a resolution to my issue but this time I'm stuck.
    I have gotten around it my explicitly specifying QTEMP as the library but I am wondering why the OVRDBF command below doesn't work with the CLRPFM?

    This is an extract of my program, &QTEMP = 'Y';

    Code:
    IF         COND(&QTEMP = 'Y') THEN(DO)                   
    
    CRTDUPOBJ  OBJ(RAMERREPWF) FROMLIB(RAREPORTS) +          
                 OBJTYPE(*FILE) TOLIB(QTEMP) CST(*NO) TRG(*NO)
    MONMSG     MSGID(CPF2130)                                
    OVRDBF     FILE(RAMERREPWF) TOFILE(QTEMP/RAMERREPWF) +   
                 MBR(*FIRST) OVRSCOPE(*JOB)                  
    ENDDO                                                    
    
    CLRPFM     FILE(RAMERREPWF)
    However my joblog looks like this;

    Code:
    RAMERREP FROM(120117) TO(010317) MAIL(N) QTEMP(Y)     
    Object RAMERREPWF in QTEMP type *FILE already exists. 
    0 objects duplicated. 1 objects not duplicated.       
    [B]Member RAMERREPWF file RAMERREPWF in RAREPORTS cleared.[/B]
    Extract sucessful.
    So it fails to duplicate, that's fine I monitor for that error.
    However the CLRPFM clears the workfile in RAREPORTS, which is the library I copied the object from.

    RAREPORTS is first in my library list
    QTEMP is second.

    I've spend too long on Google and IBM's website which states this;
    Note: The override cannot be used for all commands. A list of
    the commands that cannot be overridden, along with more
    information on overriding files is in the Files and file systems
    category in the IBM i Information Center at
    http://www.ibm.com/systems/i/infocenter/.


    But as usual, IBM's website is a mess and I am unable to find what commands don't work - I'm starting to think it CLRPFM doesn't work but wanted to confirm that is the case or learn what I have done wrong for the future.

    Thanks in advance,
    Ryan

  • #2
    CLRPFM ignores overrides.

    This may be the link you're looking for:

    Some commands ignore overrides entirely, while others allow overrides only for certain parameters.

    Comment


    • #3
      Since the program doesn't "open" the file, I wouldn't expect CLRPFM to be affected by OVRDBF. But this thread makes me wonder about possible implications for RUNSQL SQL('delete from mylib/myfile'), i.e., no WHERE clause. Is there currently a possibility that CLRPFM gets used? If so, is OVRDBF still ineffective?
      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


      • #4
        The SQL Delete from "file" will work. I do it all the time. So you can do it in the CL or RPGLE program first thing or run an sql script.

        Comment


        • #5
          It's possible to write programs that ignore overrides, and I think IBM does that frequently with their tools.

          After all, instead of using OVRDBF, you could've just as easily have specified the appropriate library/file/member on the CLRPFM. What value do you gain by using an override?

          On the other hand, overrides can very easily be left active by mistake -- especially those specified at the *JOB level. So it could be very dangerous to apply an override to CLRPFM or DLTF, etc.

          Comment


          • #6
            Apologies for the late reply, had account issues - thanks for confirming the CLRPFM.

            Regarding the SQL query, I use RUNSQL in the same program, without a library qualifier and it updates the QTEMP library despite the original object being higher in my library list - which is why I couldn't understand the CLRPFM not doing the same.

            Comment


            • #7
              Scott Klement - You're right, there is no specific gained value here but there are numerous ways to skin a cat and this achieves a similar result. Manually specifying the library would involve me changing the numerous SQL scripts in the program and I'm too lazy for that!

              Comment


              • #8
                I was only trying to explain that CLRPFM ignores overrides, and that there are many other IBM-supplied commands that also do. I was not suggesting that you change any of your code that already works...

                Comment

                Working...
                X