ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Add new columns to AS400 files (linked to a Journal)

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

  • Add new columns to AS400 files (linked to a Journal)

    We have to add some columns to an AS400 file counting some million of records.
    This file is under journal, from which we get file updates to fill them into other target systems.
    The current procedure we adopt is:
    1) Copy the file on line to a backup file with same structure (CPYF ....... MBROPT(*ADD) *CRTFILE(*YES) FMTOPT(*NONE));
    2) Change file DDS (new columns on bottom of structure);
    3) ENDJRNPF of the file;
    4) Compilation of the file on line by changed DDS;
    5) Copy the backup file on new file on line (CPYF ................ MBROPT(*ADD) *CRTFILE(*NO) FMTOPT (*MAP *DROP));
    6) STRJRNPF of the file;

    But this procedure makes us loosing journal updates between last retrieve of updates and the compilation time.

    Could you show us an alternative road to follow that allows us to mantain what we are loosing today ?

    thanks.

    regards,

  • #2
    Re: Add new columns to AS400 files (linked to a Journal)

    Hi,

    IMHO, today the best way is SQL :
    Code:
    ALTER TABLE mytable ADD COLUMN newcol ...
    Otherwise, there is a not well know capability of the CHGPF command : use the parameter SRCFILE.
    Instead of deleting your PF and recreating it via CRTPF you can do :

    1) Save the file !!
    2) Change file DDS (new columns on bottom of structure);
    3) CHGPF yourlib/yourpf SRCFILE(SRCLIB/QDDSSRC)

    That's it

    And futhermore, as the PF object has not been destroyed, you don't have to specify again authorities on the newly created one
    Jean-Michel

    Comment

    Working...
    X