ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to create the DDS of a PF from its given parameters

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

  • How to create the DDS of a PF from its given parameters

    Hi All,

    I need help from you guys,

    How can I create the DDS of a PF from given parameters,
    The parameters are.Library name,Object name and Source file name.

    Output: DDS of PF in any assigned library/Source file.

    For this create a Command with will accept all the above parameter and finally create a DDS of PF.

    Note: Don't suggest to do in CRTPF command, It will create only Flat PF. I want DDS Like record format name and fields..

    Kindly advise me,
    Thanks in advance
    Syed Arif M

  • #2
    Re: How to create the DDS of a PF from its given parameters

    I think a better solution for creating a table on the fly would be SQL.

    If you already know the file has DDS then create all the "work" tables into another library.
    Then do a crtdupobj of the table into QTEMP or wherever else you are trying to create them.

    The overhead to do this could affect system performance depending on the amount you use it.

    jamie
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: How to create the DDS of a PF from its given parameters

      Hi arifg2005:

      I agree with jamie.

      If the result of your request is to recover DDS...
      DSPFFD FILE(MYLIB/MYFILE) OUTPUT(*OUTFILE) OUTFILE(QTEMP/JUNKO)
      will create qtemp/junko which contains all the field level detail.

      Key information can be retireved using
      DSPFD FILE(QS36F/RDRCOV) TYPE(*ACCPTH) OUTPUT(*OUTFILE) OUTFILE(QTEMP/JUNK2)
      Between the 2 files you can create the source specs (which also can be used to create your sql ddl specs)

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

      Comment


      • #4
        Re: How to create the DDS of a PF from its given parameters

        Originally posted by arifg2005
        Hi All,

        I need help from you guys,

        How can I create the DDS of a PF from given parameters,
        The parameters are.Library name,Object name and Source file name.

        Output: DDS of PF in any assigned library/Source file.

        For this create a Command with will accept all the above parameter and finally create a DDS of PF.

        Note: Don't suggest to do in CRTPF command, It will create only Flat PF. I want DDS Like record format name and fields..

        Kindly advise me,
        Thanks in advance
        Syed Arif M
        CRTPF will create a DDS defined file as well as a flat file. it's the parameters you are using on the command!

        this is a flat file:
        Code:
        CRTPF FILE(MYLIB/MYFILE) RCDLEN(1)
        this is a DDS defined file:
        Code:
        CRTPF FILE(QTEMP/MYFILE) SRCFILE(TTLIB/QDDSSRC) SRCMBR(ACPDCCL0)
        if you specify a RCDLEN it will always generate a flat file...
        I'm not anti-social, I just don't like people -Tommy Holden

        Comment


        • #5
          Re: How to create the DDS of a PF from its given parameters

          Thanks for your replies guys,

          Jamie and Tom holden what your saying that will work for already existing file.. I need to create a fresh PF with DDS by passing those parameters, How to do that?

          Kindly tell me
          Thanks and regards,
          Syed Arif M

          Comment


          • #6
            Re: How to create the DDS of a PF from its given parameters

            You can use the same principle as used here: http://www.code400.com/forum/showthr...ll=1#post69703

            1. You would need to retrieve a little more info than column_name from qsys2/syscolumns, e.g. length, type, etc.
            2.
            You would first do an OVRDBF to the whatever your SRCPF member is. Instead of doing the "MySqlStmt = 'update mytable set';", then do an "insert into..." whatever your SRCPF is. Remember to keep proper formating as per DDS specs...
            Code:
            '      A       ' concat column_name concat '  ' concat length concat '  ' concat '  ' type concat '  ' concat text... etc
            I have not used proper spacing, field names or all of the fields that you may need. You can check it out yourself.

            Lastly, why do you need the DDS? Why not retrieve the SQL statement for the file(s) and create DDL from that? Much simpler!!

            Regards

            Kit
            http://www.ecofitonline.com
            DeskfIT - ChangefIT - XrefIT
            ___________________________________
            There are only 3 kinds of people -
            Those that can count and those that can't.

            Comment


            • #7
              Re: How to create the DDS of a PF from its given parameters

              Originally posted by arifg2005 View Post
              I need to create a fresh PF with DDS by passing those parameters, How to do that?
              If all you expect to pass is the qualified name of the file that you want to create plus the qualified name of a source file to store the DDS in, you can't do it. You also need to pass in all of the field attributes that are needed to create the DDS source statements from... unless the DDS definitions will always be the same for every file that you create with this programming.

              And in that case, you can code them as constants in your program. But it doesn't make much sense yet. Does any of the DDS exist or not?

              Can you explain more about the business problem that you're trying to solve? What are you trying to accomplish?

              Tom
              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

              Working...
              X