ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

New record format in PRTF

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

  • New record format in PRTF

    Hi,

    When we add new record format to printer file, does new program require recompilation when we don't use this record format in program?
    I just need to be sure (I've checked it on some test program and there wasn't level check).

    Thanks for help

  • #2
    If you do DSPPGMREF for your program, you will see the format-level information for the record formats that were in the file when your program was compiled. Since the level-check is for the record formats, and not for the whole file, then adding a new record format shouldn't cause a level check.

    Comment


    • #3
      Although Barbara's reply is entirely correct for the OP's specific question...

      I would believe that recompiling the RPG program the OP asks about is a good idea, after creating a new PRTF .

      Yea, indeed the OP original program will work, under the given circumstances. However, it is to note that should the OP program need to use the changed PRTF record (at some point in the future) need to be used, the "evil scenario" could become evident when dealing with "patches upon patches" over time, that could become a pain in the @#%@#%@#%. I'm sure we've all seen this.

      So, as Barbara says it will work in this single instance (and she is correct)... I would recommend that you recompile the program in question, even though the new PRTF format is not used in the specific program the OP asks about. Doing this makes your future programming effort much easier.

      Obviously, recompiling every program after any change is merely foolish... just keep in mind that after time, accepting that "yes, this shortcut works", can create development problems in the long term.

      Best Regards,
      Fred Williams

      Comment


      • #4
        I just thought of a scenario where it would definitely be a good idea to recompile programs if a file changes even if you don't get a level check. If you change the keys for a file, the level identifier doesn't change, so you don't get a level check, but your program (probably) wouldn't work.

        I don't disagree with Whitecat27 about recompiling programs that use printer files with new records added. One possible issue is tht the new records might have fields with the same names as unrelated fields in your programs, but different data types. It's best to find out about that kind of issue earlier than later. Although if you don't actually write to a printer file record, the fields for that record wouldn't be brought into your program unless you have subprocedures in the module.

        One way to make it so your program would not be affected by having additional formats added to a printer file (or any kind of file) is to use the INCLUDE keyword on the F spec. If you list the formats that you're going to use, then if you add more formats to the file and recompile, the compiler will ignore any formats that aren't listed in the INCLUDE keyword. If you have the INCLUDE keyword, I don't think you would have any need to recompile your program even if you add additional formats to the file.

        Comment

        Working...
        X