This discussion is archived
1 2 Previous Next 15 Replies Latest reply: Sep 11, 2008 4:13 AM by 164229 RSS

Why does this happen - find ';', replace with ';'?

267677 Newbie
Currently Being Moderated
Hi there

Not an urgent question, but I seem to remember reading somewhere that if you open your form in Form Builder, go to 'Find and replace PL/SQL' and replace all occurrences of ; with ; (ie not actually changing anything), it drastically reduces the size of the form, and there may be some other positive effect that I can't remember.

Indeed, I tried this on one of my forms, and it went from a whopping 1.8Mb down to a svelte 800Kb.

Does anyone know
(a) why this happens, or
(b) does it have any effect, other than reducing the size of the .fmb file?

Regards
Andrew Woodward
UK
  • 1. Re: Why does this happen - find ';', replace with ';'?
    Grant Ronald Employee ACE
    Currently Being Moderated
    Its a bit like a Spring Clean - Forms holds information and structures in the file and it tries to be clever about what needs to be compiled - this impacts the size.

    By doing this you are recompiling everything and cleaning out all this information.
    There should be no negative impact.
    Regards
    Grant Ronald
    Forms Product Management
  • 2. Re: Why does this happen - find ';', replace with ';'?
    KevinDClarke Newbie
    Currently Being Moderated
    Grant
    Is this trick really worth doing or is it just achieving the same effect as shift-ctrl-k ?
  • 3. Re: Why does this happen - find ';', replace with ';'?
    267677 Newbie
    Currently Being Moderated
    ...actually, the really funny part is that once I'd done this, and posted the earlier message, I added an item to a block and a couple of lines of code to a trigger.

    Guess what - the fmb shot back up to 1.8Mb!

    Most strange...

    Andrew
  • 4. Re: Why does this happen - find ';', replace with ';'?
    Grant Ronald Employee ACE
    Currently Being Moderated
    Andrew, Kevin - the point is that the internals of the Forms files is just that - internal - we don't make any promises on what size they will be and how we hold (and clean out) our internal structures.

    You shouldn't worry that the file size is changing - it doesn't mean anything is wrong.
    Regards
    Grant
  • 5. Re: Why does this happen - find ';', replace with ';'?
    KevinDClarke Newbie
    Currently Being Moderated
    I don't think we are worrying - just being curious.

    I have experimented and found that shift-control-k or compiling from the menu does not shrink the fmb like replacing the semicolons does. However, it does shrink if I compile it on unix, but not quite as much as the semicolon trick.
  • 6. Re: Why does this happen - find ';', replace with ';'?
    394323 Newbie
    Currently Being Moderated
    I've had these file size changes happen when I open a form previously compiled against a database, but this time I just save it without connecting to the DB and/or(?) compiling it.

    It's probably just some internal caching of nice-to-have values, and they "go away" when you're not connected to the DB. The compiled fmx never changes in this way.

    But it's a funny thing first time you experience it :)

    --Jesper Vad                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
  • 7. Re: Why does this happen - find ';', replace with ';'?
    user346369 Expert
    Currently Being Moderated
    Grant wrote:
    By doing this you are recompiling everything and
    cleaning out all this information.
    There should be no negative impact.
    Well... it's a little bit different than that. I would change the word "recompiling" to "uncompiling". The replace ; with ; causes all the program units to become uncompiled. You can observe this on the pl/sql editor status line, as well as the Object Navigator's '+' icon next to each program unit.

    Here are links to more threads on the topic:
    FRM-10043 Cannot open file: for large fmb files
    Re: Strange compile problem
    Re: FMB size shrinks dramatically

    I really worked on the file size situation some time back because I was working over a very slow network. The fmb files had to be sent back and forth via ftp, and our connection to the Oracle server was slow, too. So the ftp file size made a difference.

    But most importantly, the time it takes to open those inflated forms was very annoying. If you pay attention, you will notice that the deflated files open in the Forms Builder in an instant, while the fat ones take a significant amount of time -- determined by how fast your network and server are.

    It appears to me that Oracle stores compiled code inside the fmb file. Whenever you open a compressed file, it always opens in a snap. (Then notice when you compile it, it takes quite a bit longer.) Just the opposite is true of the inflated files.

    So it appears that Forms Builder is finding the compiled code, and trying to re-compile (or verify its correctness) when you open the fmb. (And SINCE it does that, why on earth does it need to store the compiled code any way????)

    Storing the fat files caused us some serious headaches a while back. We found that if one developer stored the fat fmb, when another opened, compiled and ran it, the running form would get wildly incorrect results when calling stored procedures (not package procedures). We would get numbers too large to display in the expected field, and even some negative zero values. Once we determined that storing the files in compressed mode fixed the problem, that became the standard.

    Our PLL libraries also exhibit the same size-ballooning features. So we make sure they are always stored completely uncompiled. The same speed advantages are even more pronounced with them.

    So the bottom line is this: I REALLY wish Oracle would provide a Tools -> Preferences setting for: "Store source uncompiled", or "Compress fmb when saving".

    Edited by: Steve Cosner on Sep 9, 2008 9:33 AM: Fixed broken URL links
  • 8. Re: Why does this happen - find ';', replace with ';'?
    user346369 Expert
    Currently Being Moderated
    JVK wrote:
    I've had these file size changes happen when I open a
    form previously compiled against a database, but this
    time I just save it without connecting to the DB
    and/or(?) compiling it.
    When you are NOT connected, then all the program units that make database calls, or are dependent upon some that do, become uncompiled. Then when you save the form, those program units are stored in their compressed size.
  • 9. Re: Why does this happen - find ';', replace with ';'?
    Grant Ronald Employee ACE
    Currently Being Moderated
    " We found that if one developer stored the fat fmb, when another opened, compiled and ran it, the running form would get wildly incorrect results when calling stored procedures (not package procedures). We would get numbers too large to display in the expected field, and even some negative zero values. Once we determined that storing the files in compressed mode fixed the problem, that became the standard."

    Steve - what you are describing is the classic case of running the same version of a form against different versions of another form. We see this all the time in large project (usually) when somone thinks they are running against Version X of a pll (for example) but they are actually running against X-1.

    By doing the replace of ; with ; you are forcing a complete recompile which forces the correct recompilation - hence the "fix" you see.

    I'll not go into the reasons behind the scenes (its my day off and I'm still on the forums!!) but its a common problem which manifests itself in this type of behaviour

    Regards
    Grant

    p.s. when I said "this you are recompiling everything and" I was assuming you were following the search and replace of ; with a compile all - by doing the replace you are forcing the complete form to be in an upcompiled state so when you do a compile the who things gets compiled.

    Hope that clears it all up.
    G
  • 10. Re: Why does this happen - find ';', replace with ';'?
    user346369 Expert
    Currently Being Moderated
    Grant wrote:
    > Steve - what you are describing is the classic case of running the same version
    of a form against different versions of another form. We see this all the time in
    large project (usually) when somone thinks they are running against Version X
    of a pll (for example) but they are actually running against X-1.

    Not the case here. We worked long and hard to determine that the problem was due to:
    1. saving the fmb AFTER compiling.
    2. using that fmb to compile on a different windows platform.
    3. Running the new fmx would produce the problem. Both workstations were connected to the same database, and the stored procedures being called were very old--nobody had changed them in several years.

    We concluded that there was something stored in the fat fmb that was not being replaced in the compile on the second platform that was causing the problem. Since we found that saving the fmb in the uncompiled state would clear up the problem, it wasn't worth creating a TAR.

    >...I'll not go into the reasons behind the scenes... but its a common problem
    which manifests itself in this type of behaviour

    Most of all, what I would like to see addressed is what I wrote above:
    And SINCE it does that, why on earth does it need to store the compiled code any way?

    >...(its my day off and I'm still on the forums!!)
    Well, as you can see, we all work on the weekend once in a while. :-)
  • 11. Re: Why does this happen - find ';', replace with ';'?
    593130 Newbie
    Currently Being Moderated
    Evening all,

    Caught up on this thread several years too late but still: thanks for the informative thread - I've been wondering about the mechanics of the "replace semi-colon with semi-colon" procedure for a while now - especially as it appears to be closely related to incidents of forms runtime crashing out for no immediately apparent reason.

    Any chance of Oracle modifying the default compile all (shift-ctrl-k) behaviour to actually invalidate and then recompile the module so we don't have to go through this rigmarole? (Grant?)

    Hopefully,
    Lawrence
  • 12. Re: Why does this happen - find ';', replace with ';'?
    user346369 Expert
    Currently Being Moderated
    Any chance of Oracle modifying the default compile all (shift-ctrl-k) behaviour to actually invalidate and then recompile the module so we don't have to go through this rigmarole?
    Actually, "Compile All" (shift-ctrl-k) does just that: Invalidate and then recompile all modules. The problem is, though, that if you save the fmb after that, compiled code is stored inside the fmb along with the source. And when you move to another platform and do a compile (but forget to compile all), the intermittent problem is back.
  • 13. Re: Why does this happen - find ';', replace with ';'?
    164229 Newbie
    Currently Being Moderated
    This is because of PCODE stored.

    I would not recommend to use ';' as a solution.
    If you have triggers referenced they will be affected as well and they will be marked as 'overridden'

    All inheritance will be broken by doing this. Do not use this solution.

    The best way to fix it is to build a simple JDAPI program to do the exact replacement BUT not to touch any referenced code.

    Thanks,

    Michael
  • 14. Re: Why does this happen - find ';', replace with ';'?
    user346369 Expert
    Currently Being Moderated
    mhitrik wrote:
    I would not recommend to use ';' as a solution.
    If you have triggers referenced they will be affected as well and they will be marked as 'overridden'

    All inheritance will be broken by doing this. Do not use this solution.

    The best way to fix it is to build a simple JDAPI program to do the exact replacement BUT not to touch any referenced code.
    Michael, you are right about the process breaking the references. The same warning is contained in this thread:
    Re: FMB size shrinks dramatically

    Care to create that JDAPI program?

    I just wish Oracle would provide a simple "*Save without compiled code*" check box in the Builder's preferences. It would save the Oracle IT world thousands of hours of trouble.
1 2 Previous Next