Skip to main content
1-Visitor
December 22, 2014
Question

When implementing a new constraint, what moves into production?

  • December 22, 2014
  • 1 reply
  • 3815 views

Hello,

I have created a table in production with a primary key constraint.

I want to add a foreign key constraint.

I use a source member that gets moved and then RUNSQLSTM with a special command that adds the constraint to the file.

normally with a table change we promote the table but if it is just a constraint change, we dont just move the constraint? How do we move a constraint into production if there is no object to move?

What are the steps?

When we promote a table change we create/recreate the table in our staging area and move it into the production area. What do you move when it is just a new constraint?

    1 reply

    12-Amethyst
    December 22, 2014

    Hi Scott,

    You can use a source only object code like this and put the request special command after move to RUNSQLSTM:

    Note, you might have to change the source type and source file to match yours:

    Object code . . . . . . . . . . SQLSRC SQL source only

    Activity flag . . . . . . . . : 1 1=Active, 0=Inactive

    Object type . . . . . . . . . :

    Object attribute . . . . . . . :

    Source member type . . . . . . : SQLSRC

    Default source file . . . . . : QSQLSRC

    Creation sequence . . . . . . : 1000 1-ZZZZ

    Special characteristics . . . : *DATA, *MERGE, *MAINT, ...

    Object authority . . . . . . . : *KEEP *KEEP, *GRANT

    Remove obj in from env . . . . : N Y=Yes, N=No

    Remove src in from env . . . . : Y Y=Yes, N=No

    Creation process . . . . . . . : M C=Compile, M=Move

    Archive in PTC Source . . . . : N Y=Yes, N=No

    Creation command . . . . . . . : CPYF FROMFILE(#WRKSRCLIB/#WRKSRCFIL) TOFILE(#PGMLIB/#SRCFIL) FROMMBR(#OBJECT) TOMBR(#OBJECT) MBROPT(*REPLACE) CRTFILE(*YES)

    If you have any questions or problems, feel free to reach out to log a support case, either here online or by phoning 1-800-477-6435.

    sdamery1-VisitorAuthor
    1-Visitor
    December 22, 2014

    So will this create the constraint on the file in Production or move the file with the constraint to production? Which would also require data handling unless you use alter table statements...I just dont understand your process procedures.

    It should be as easy as running alter table over the current table.

    12-Amethyst
    December 22, 2014

    Scott,

    1. If you checkout the table, change the source to add the constaint and promote - Implementer will perform an alter table command during promotion.
    2. If you simply wanted to handle the adding of the constraint as a separate source member and performing your own RUNSQLSTM, that's when you would use the object code.

    Please let me know if you have any additional questions.