ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

to extend the field length in physical file

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

  • to extend the field length in physical file

    hi all,


    i have field with 15 char in one physical file , from long back it is using with 15 char only in many screens and based on all logical files ,now i need to increse that field length to 18 char every where, can any one explain me the total process with some example!



    regards,
    Vijayr

  • #2
    Re: to extend the field length in physical file

    1) First take a backup of the file to a temporary file and then change the field length. Now get the earlier data with CPYF using FMTOPT(*MAP *DROP).

    2) Check for all the dependent logical files(use DSPDBR).
    If the same field was directly referred in any of the logical files, change its length also.

    Recompile all the logical files.

    3) Get a list of all the programs which uses the PF or the LFs.
    (you can use HAWKEYE tool for this, if this is not available look for some other method like FNDSTRPDM etc...)

    Check which variable was based on the changed field and change its length if needed(If it is defined with a LIKE keyword, then no need)
    Also look for the Display files those programs using. If any of the display file is refering this Field, change the length of DSPF field accordingly(make sure that proper positioning of the fields maintained so as to get the DSPF compiled.

    Also make proper analysis of all the programs so that the change in length of the variable is not affecting the earlier functionality.

    Finally recompile all the programs.

    Make sure that Regression test performed successfully .
    To every equation there is a solution....
    Regards
    Sai.

    Comment


    • #3
      Re: to extend the field length in physical file

      Originally posted by sai400 View Post
      1) First take a backup of the file to a temporary file and then change the field length. Now get the earlier data with CPYF using FMTOPT(*MAP *DROP).

      2) Check for all the dependent logical files(use DSPDBR).
      If the same field was directly referred in any of the logical files, change its length also.

      Recompile all the logical files.

      3) Get a list of all the programs which uses the PF or the LFs.
      (you can use HAWKEYE tool for this, if this is not available look for some other method like FNDSTRPDM etc...)

      Check which variable was based on the changed field and change its length if needed(If it is defined with a LIKE keyword, then no need)
      Also look for the Display files those programs using. If any of the display file is refering this Field, change the length of DSPF field accordingly(make sure that proper positioning of the fields maintained so as to get the DSPF compiled.

      Also make proper analysis of all the programs so that the change in length of the variable is not affecting the earlier functionality.

      Finally recompile all the programs.

      Make sure that Regression test performed successfully .



      thanks a lot Sai

      after finishing all this process how to compile that main physical file without loosing old data

      regards,
      Vijayr

      Comment


      • #4
        Re: to extend the field length in physical file

        Ref 1)

        You have to compile the PF first, Not after finishing all these process

        .initially take a back up of the file to a temporary file.
        .change the field length, compile the PF normally.
        .Get the earlier data from the Backed up file with CPYF, FMTOPT(*MAP *DROP)
        Last edited by sai400; September 25, 2008, 04:08 AM.
        To every equation there is a solution....
        Regards
        Sai.

        Comment


        • #5
          Re: to extend the field length in physical file

          Use CHGPF to handle file changes with ease.

          When the structure of a physical file changes, most AS/400
          programmers take the following steps to incorporate the change:

          a. Change the DDS to reflect the new structure.

          b. Make a copy of the data from the old structure file.

          c. Delete any logical files based on the physical file.

          d. Recompile the source and rebuild any logical files.

          e. Copy the old data back to the new structure, specifying options *DROP and *MAP.

          You can use the CHGPF command to achieve the same goal with less effort.

          When you need to recompile because of a change in file structure, follow these steps:

          a. Make the necessary changes to the DDS source.

          b. Type CHGPF and press F4 to display the screen below:

          Code:
                               Change Physical File (CHGPF)                 
                                                                                 
            Type choices, press Enter.                                            
                                                                                 
            Physical file  . . . . . .    ARETURNS   Name                 
              Library  . . . . . . . .      INVLIB   Name, *LIBL, *CURLIB
            System . . . . . . . . . .    *LCL       *LCL, *RMT, *FILETYPE
            Source file  . . . . . . .    QDDSSRC    Name, *NONE
              Library  . . . . . . . .      SRCLIB   Name, *LIBL, *CURLIB
          Enter the name of the physical file and the name of the library in which the file resides.

          Also type the source physical file name and the name of the library in which the source file resides.

          c. Press Enter to display the screen below:
          Code:
                               Change Physical File (CHGPF)                 
                                                                                 
            Type choices, press Enter.                                            
                                                                                 
            Physical file  . . . . . . .  ARETURNS   Name                 
              Library  . . . . . . . . .    INVLIB   Name, *LIBL, *CURLIB
            System . . . . . . . . . . .  *LCL       *LCL, *RMT, *FILETYPE
            Source file  . . . . . . . .  QDDSSRC    Name, *NONE
              Library  . . . . . . . . .    SRCLIB   Name, *LIBL, *CURLIB    
            Source member  . . . . . . .  *FILE      Name, *FILE             
            Source listing options . . .             *SRC, *NOSRC,*SOURCE...
                           + for more values                                         
            Generation severity level  .  20         0-30                    
            Flagging severity level  . .  0          0-30                    
            Delete dependent logical file *NO        *NO, *YES               
            Remove constraint  . . . . .  *RESTRICT  *RESTRICT, *REMOVE      
            Expiration date for member .  *NONE      Date, *SAME, *NONE
          Enter the source member name, and press Enter.

          This step recompiles the physical and logical files and copies data back.

          In fact, it does all the steps you've been doing manually.

          Note that when you change the DDS to reduce a field's size or drop a field,
          you may receive a message warning that you may lose your data.
          You can ignore the message by responding to it with I(gnore).


          The above tip was published in NEWS/400 by Vijay Yadav
          Last edited by Marc_d; September 25, 2008, 04:13 AM.

          Comment


          • #6
            Re: to extend the field length in physical file

            Does this CHGPF automatically change the Structure of LF in which the ref. for the changed field has been made?


            According to my knowledge most of the programmers follow that manual procedure,

            As we can't directly change the Structure of the production version and perform all the necessary changes and testing there itself.
            We will first get those objects into our Test environment,and only after proper testing, let the changes go into Live by Replacing the Objects.
            Last edited by sai400; September 25, 2008, 05:06 AM.
            To every equation there is a solution....
            Regards
            Sai.

            Comment


            • #7
              Re: to extend the field length in physical file

              You can just do it on your files that are in the test environment. If it works well there repeat the same steps in the production environment. Easy breezy.
              Your future President
              Bryce

              ---------------------------------------------
              http://www.bravobryce.com

              Comment


              • #8
                Re: to extend the field length in physical file

                First of all: DO NOT compile your PF ! (option 14 )
                First you can't do it anyway when there are LF referencing too !

                Yes, assumed that you have all your LF coded with PFILE

                Which is the normal way, anyway !

                Code:
                A          R RECORDLF                 PFILE(#LIB/FILE)
                And Yes, even if you made a Join with JFILE ( join file )

                And by editing your PF DDS and then CHGPF you can even ADD fields to your PF !

                The only note: Changing PF and LF is easy !
                But ! Don't forget to edit and recompile the programs, if you changed the record/field layout !

                If you want more to know about CHGPF, then I say: Google !
                There are lot of artocles/discussions of CHGPF:

                A must Read !!! :Changing Physical File Characteristics on the Fly

                The schooltextbook on PF LF Changing a PF definition with CHGPF

                "Things you *all don't know about"PF LF joins (Note: This download is in the rtf - format ! )

                Read A must Read !!!
                Last edited by Marc_d; September 25, 2008, 05:43 AM.

                Comment


                • #9
                  Re: to extend the field length in physical file

                  Originally posted by bryce4president View Post
                  You can just do it on your files that are in the test environment. If it works well there repeat the same steps in the production environment. Easy breezy.
                  Is it not pointing the nose with the index finger by turning the hand round the head.
                  To every equation there is a solution....
                  Regards
                  Sai.

                  Comment


                  • #10
                    Re: to extend the field length in physical file

                    This is exactly the kind of situation that a test environment is for. You do your changes in the test, then if it works you do it in production. That is standard fair right? If you want to put your finger on your nose, hop on one foot, have a dance off , and then put it into production without testing then you might get a magic solution.

                    But I'm not much of a dancer so I just like to test first
                    Your future President
                    Bryce

                    ---------------------------------------------
                    http://www.bravobryce.com

                    Comment


                    • #11
                      Re: to extend the field length in physical file

                      Hi vijayr:

                      Ok The above covered the "EASY" stuff.

                      You must also consider:
                      1. Modify Display screens/Prints where this field is displayed/updated/printed.
                      2. If this is a key in any of the PF/LF.... modify klist fields
                      3. If this field is passed in the LDA or defined in any DS...Change length and bump all fields after this one.
                      4. If this field gets output into another work file...That needs to be modified just like this one.
                      5. If this file is "internally defined" (you said it was old)...The I specs need to be modified and bump all fields after this one, increase the record length on the F spec.
                      6. If any file created in point 4 outputs to another work file treat the same as point 4.
                      7. Any OCL involved??? modify sort specs/lda positions etc

                      We recently went through the same issue. We used an analysis product specificly designed to do what you are asking. I'll get the contact info and post here later today.

                      HTH
                      GLS
                      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                      Comment


                      • #12
                        Re: to extend the field length in physical file

                        Originally posted by bryce4president View Post
                        If you want to put your finger on your nose, hop on one foot, have a dance off , and then put it into production without testing then you might get a magic solution.

                        That's the way to learn Dancing, Not only you can shake your hands and legs, but the entire internal system composed of mind, Heart, blood cells .....That's called a rocking performance.
                        To every equation there is a solution....
                        Regards
                        Sai.

                        Comment


                        • #13
                          Re: to extend the field length in physical file

                          Hi vijayr:

                          The product I mentioned above

                          Database Assistant
                          from EPI Software

                          caine@epi-software.com
                          (877) 374-9273

                          This product does a decent job W/I rpg programs (II/III/IV) Not sure about /Free. It does not touch CLP/CLLE (data areas)

                          Best of Luck
                          GLS
                          The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

                          Comment


                          • #14
                            Re: to extend the field length in physical file

                            Thanks for the info
                            To every equation there is a solution....
                            Regards
                            Sai.

                            Comment


                            • #15
                              Re: to extend the field length in physical file

                              Originally posted by sai400 View Post
                              Ref 1)

                              You have to compile the PF first, Not after finishing all these process

                              .initially take a back up of the file to a temporary file.
                              .change the field length, compile the PF normally.
                              .Get the earlier data from the Backed up file with CPYF, FMTOPT(*MAP *DROP)

                              hi sai ,

                              i copied that file in to my development lib with opt 3 then i changed the field length and compiled it in my lib now i dont have
                              any data in that file so i tried to copy from the production lib file with CPYF
                              while copying the data from that file i am getting the message like

                              MBROPT(*ADD) or (*REPLACE) required for existing to-file.

                              while copying i need to add any additional parameeters what

                              can u please help me out


                              regards,
                              vijay

                              Comment

                              Working...
                              X