<?xml version='1.0' encoding='iso8859-1'?>
<!DOCTYPE  PCase-XML-Output-152>
<?xml-stylesheet type='text/xsl' href='pcase.xsl'?>
<PROJECT>
  <project-name> "Progress Dynamics 2.1" </project-name>
  <Db-name> ? </Db-name>
  <version> "2.1A01" </version>
  <aview> 1 </aview>
  <tview> 2 </tview>
  <x> 0 </x>
  <y> 0 </y>
  <gridx> ? </gridx>
  <gridy> ? </gridy>
  <size> 40 </size>
  <zoom> 4 </zoom>
  <pprop> "portrait" </pprop>
  <SEQUENCE>
    <Seq-Name> "seq_obj1" </Seq-Name>
    <Seq-Num>  1 </Seq-Num>
    <Seq-Init> 0 </Seq-Init>
    <Seq-Incr> 1 </Seq-Incr>
    <Seq-Min>  0 </Seq-Min>
    <Seq-Max>  999999999 </Seq-Max>
    <Cycle-Ok> YES </Cycle-Ok>
  </SEQUENCE>
  <SEQUENCE>
    <Seq-Name> "seq_obj2" </Seq-Name>
    <Seq-Num>  2 </Seq-Num>
    <Seq-Init> 0 </Seq-Init>
    <Seq-Incr> 1 </Seq-Incr>
    <Seq-Min>  0 </Seq-Min>
    <Seq-Max>  999999999 </Seq-Max>
    <Cycle-Ok> YES </Cycle-Ok>
  </SEQUENCE>
  <SEQUENCE>
    <Seq-Name> "seq_site_reverse" </Seq-Name>
    <Seq-Num>  3 </Seq-Num>
    <Seq-Init> 0 </Seq-Init>
    <Seq-Incr> 1 </Seq-Incr>
    <Seq-Min>  0 </Seq-Min>
    <Seq-Max>  999999999 </Seq-Max>
    <Cycle-Ok> YES </Cycle-Ok>
  </SEQUENCE>
  <SEQUENCE>
    <Seq-Name> "seq_site_division" </Seq-Name>
    <Seq-Num>  4 </Seq-Num>
    <Seq-Init> 0 </Seq-Init>
    <Seq-Incr> 1 </Seq-Incr>
    <Seq-Min>  0 </Seq-Min>
    <Seq-Max>  999999999 </Seq-Max>
    <Cycle-Ok> YES </Cycle-Ok>
  </SEQUENCE>
  <SEQUENCE>
    <Seq-Name> "seq_session_id" </Seq-Name>
    <Seq-Num>  5 </Seq-Num>
    <Seq-Init> 1 </Seq-Init>
    <Seq-Incr> 1 </Seq-Incr>
    <Seq-Min>  1 </Seq-Min>
    <Seq-Max>  999999999 </Seq-Max>
    <Cycle-Ok> YES </Cycle-Ok>
  </SEQUENCE>
  <SEQUENCE>
    <Seq-Name> "seq_ICFDB_DBVersion" </Seq-Name>
    <Seq-Num>  6 </Seq-Num>
    <Seq-Init> 20023 </Seq-Init>
    <Seq-Incr> 1 </Seq-Incr>
    <Seq-Min>  0 </Seq-Min>
    <Seq-Max>  20023 </Seq-Max>
    <Cycle-Ok> YES </Cycle-Ok>
  </SEQUENCE>
  <AREA>
    <Area-Name> "Primary Recovery Area" </Area-Name>
    <Area-Number> 3 </Area-Number>
    <Area-Type> 3 </Area-Type>
    <Area-BlockSize> 8192 </Area-BlockSize>
    <AREA-EXTENT>
      <Area-Number> 3 </Area-Number>
      <Extent-Number> 1 </Extent-Number>
      <Extent-Type> 0 </Extent-Type>
      <Extent-Size> 0 </Extent-Size>
      <Extent-Path> ".\" </Extent-Path>
    </AREA-EXTENT>
  </AREA>
  <AREA>
    <Area-Name> "Schema Area" </Area-Name>
    <Area-Number> 6 </Area-Number>
    <Area-Type> 6 </Area-Type>
    <Area-BlockSize> 4096 </Area-BlockSize>
    <AREA-EXTENT>
      <Area-Number> 6 </Area-Number>
      <Extent-Number> 1 </Extent-Number>
      <Extent-Type> 0 </Extent-Type>
      <Extent-Size> 0 </Extent-Size>
      <Extent-Path> ".\" </Extent-Path>
    </AREA-EXTENT>
  </AREA>
  <FILE>
    <File-Name> "gsc_custom_procedure" </File-Name>
    <Dump-name> "gsccp" </Dump-name>
    <Area-Name> "Schema Area" </Area-Name>
    <Frozen> NO </Frozen>
    <Desc> "This table is contained in Dynamics for backward compatibility and will likely be dropped at a later stage. It will be replaced with flows and events when these are fully implemented.

The purpose of this table is to provide a mechanism to define alternate procedures for custom specific business logic.

This table contains a list of all the system supported procedures that satisfy these business rules, categorised by entity and procedure type. A number of variations for each process may exist - the procedure to use in each case must be selected from this list.

The programs that these procedures exist in will run persistently when required." </Desc>
    <File-Label> ? </File-Label>
    <File-Label-SA> ? </File-Label-SA>
    <Hidden> NO </Hidden>
    <Valexp> ? </Valexp>
    <Valmsg> "" </Valmsg>
    <Valmsg-SA> ? </Valmsg-SA>
    <Fil-misc26> ? </Fil-misc26>
    <ianum> 6 </ianum>
    <grid> no </grid>
    <X> 2 </X>
    <Y> 4 </Y>
    <Xsize> 10 </Xsize>
    <Ysize> 11 </Ysize>
    <FILE-TRIG>
      <Event> "CREATE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR CREATE OF gsc_custom_procedure .

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_custom_procedure           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_custom_procedure
&amp;SCOPED-DEFINE TRIGGER_FLA gsccp
&amp;SCOPED-DEFINE TRIGGER_OBJ custom_procedure_obj


DEFINE BUFFER lb_table FOR gsc_custom_procedure.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_custom_procedure.     /* Used for lock upgrades */

DEFINE BUFFER o_gsc_custom_procedure FOR gsc_custom_procedure.

/* Standard top of CREATE trigger code */
{af/sup/aftrigtopc.i}

  



/* Generated by ICF ERwin Template */
/* gsm_category of gsc_custom_procedure ON CHILD INSERT RESTRICT */
IF 
    ( gsc_custom_procedure.category_obj &lt;&gt; 0 ) THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsm_category WHERE
        gsc_custom_procedure.category_obj = gsm_category.category_obj)) THEN
        DO:
          /* Cannot create child because parent does not exist ! */
          ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 102 lv-include = &quot;gsc_custom_procedure|gsm_category&quot;:U.
          RUN error-message (lv-errgrp, lv-errnum, lv-include).
        END.
    
    
  END.






ASSIGN gsc_custom_procedure.{&amp;TRIGGER_OBJ} = getNextObj() NO-ERROR.
IF ERROR-STATUS:ERROR THEN 
DO:
    ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 31 lv-include = &quot;gsc_custom_procedure|the specified object number.  Please ensure your database sequences have been set correctly&quot;:U.
    RUN error-message (lv-errgrp, lv-errnum, lv-include).
END.







/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gsccp':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;CREATE&quot;:U, INPUT &quot;gsccp&quot;:U, INPUT BUFFER gsc_custom_procedure:HANDLE, INPUT BUFFER o_gsc_custom_procedure:HANDLE).

/* Standard bottom of CREATE trigger code */
{af/sup/aftrigendc.i}


/* Place any specific CREATE trigger customisations here */



" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gsccptrigc.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "DELETE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR DELETE OF gsc_custom_procedure .

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_custom_procedure           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_custom_procedure
&amp;SCOPED-DEFINE TRIGGER_FLA gsccp
&amp;SCOPED-DEFINE TRIGGER_OBJ custom_procedure_obj


DEFINE BUFFER lb_table FOR gsc_custom_procedure.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_custom_procedure.     /* Used for lock upgrades */

DEFINE BUFFER o_gsc_custom_procedure FOR gsc_custom_procedure.

/* Standard top of DELETE trigger code */
{af/sup/aftrigtopd.i}

  




/* Generated by ICF ERwin Template */
/* gsc_custom_procedure is used by gsc_entity_mnemonic_procedure ON PARENT DELETE RESTRICT */
IF CAN-FIND(FIRST gsc_entity_mnemonic_procedure WHERE
    gsc_entity_mnemonic_procedure.custom_procedure_obj = gsc_custom_procedure.custom_procedure_obj) THEN
    DO:
      /* Cannot delete parent because child exists! */
      ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 101 lv-include = &quot;gsc_custom_procedure|gsc_entity_mnemonic_procedure&quot;:U.
      RUN error-message (lv-errgrp, lv-errnum, lv-include).
    END.





/* Generic comments deletion */
DEFINE BUFFER lbx_gsm_comment FOR gsm_comment.
DEFINE BUFFER lby_gsm_comment FOR gsm_comment.
IF CAN-FIND(FIRST lbx_gsm_comment 
            WHERE lbx_gsm_comment.owning_obj = gsc_custom_procedure.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_comment NO-LOCK
       WHERE lbx_gsm_comment.owning_obj = gsc_custom_procedure.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gsccptrigd.p^delete gsm_comment&quot;:U:
        FIND FIRST lby_gsm_comment EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_comment) = ROWID(lbx_gsm_comment)
             NO-ERROR.
        IF AVAILABLE lby_gsm_comment THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_comment&quot;}
          END.
    END.
/* Generic security allocation deletion */
DEFINE BUFFER lbx_gsm_user_allocation FOR gsm_user_allocation.
DEFINE BUFFER lby_gsm_user_allocation FOR gsm_user_allocation.
IF CAN-FIND(FIRST lbx_gsm_user_allocation 
            WHERE lbx_gsm_user_allocation.owning_obj = gsc_custom_procedure.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_user_allocation NO-LOCK
       WHERE lbx_gsm_user_allocation.owning_obj = gsc_custom_procedure.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gsccptrigd.p^delete gsm_user_allocation&quot;:U:
        FIND FIRST lby_gsm_user_allocation EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_user_allocation) = ROWID(lbx_gsm_user_allocation)
             NO-ERROR.
        IF AVAILABLE lby_gsm_user_allocation THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_user_allocation&quot;}
          END.
    END.
/* Generic multi-media deletion */
DEFINE BUFFER lbx_gsm_multi_media FOR gsm_multi_media.
DEFINE BUFFER lby_gsm_multi_media FOR gsm_multi_media.
IF CAN-FIND(FIRST lbx_gsm_multi_media 
            WHERE lbx_gsm_multi_media.owning_obj = gsc_custom_procedure.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_multi_media NO-LOCK
       WHERE lbx_gsm_multi_media.owning_obj = gsc_custom_procedure.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gsccptrigd.p^delete gsm_multi_media&quot;:U:
        FIND FIRST lby_gsm_multi_media EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_multi_media) = ROWID(lbx_gsm_multi_media)
             NO-ERROR.
        IF AVAILABLE lby_gsm_multi_media THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_multi_media&quot;}
          END.
    END.










/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gsccp':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;DELETE&quot;:U, INPUT &quot;gsccp&quot;:U, INPUT BUFFER gsc_custom_procedure:HANDLE, INPUT BUFFER o_gsc_custom_procedure:HANDLE).

/* Standard bottom of DELETE trigger code */
{af/sup/aftrigendd.i}


/* Place any specific DELETE trigger customisations here */
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gsccptrigd.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-CREATE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-CREATE OF gsc_custom_procedure.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_custom_procedure&quot;
                      &amp;TABLE-FLA    = &quot;gsccp&quot;
                      &amp;TABLE-PK     = &quot;custom_procedure_obj&quot;
                      &amp;ACTION       = &quot;CREATE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gsccpreplc.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-DELETE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-DELETE OF gsc_custom_procedure.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_custom_procedure&quot;
                      &amp;TABLE-FLA    = &quot;gsccp&quot;
                      &amp;TABLE-PK     = &quot;custom_procedure_obj&quot;
                      &amp;ACTION       = &quot;DELETE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gsccprepld.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-WRITE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-WRITE OF gsc_custom_procedure OLD BUFFER lb_old.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_custom_procedure&quot;
                      &amp;TABLE-FLA    = &quot;gsccp&quot;
                      &amp;TABLE-PK     = &quot;custom_procedure_obj&quot;
                      &amp;OLD-BUFFER   = &quot;lb_old&quot;
                      &amp;ACTION       = &quot;WRITE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}


" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gsccpreplw.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "WRITE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR WRITE OF gsc_custom_procedure OLD BUFFER o_gsc_custom_procedure.

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_custom_procedure           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_custom_procedure
&amp;SCOPED-DEFINE TRIGGER_FLA gsccp
&amp;SCOPED-DEFINE TRIGGER_OBJ custom_procedure_obj


DEFINE BUFFER lb_table FOR gsc_custom_procedure.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_custom_procedure.     /* Used for lock upgrades */



/* Standard top of WRITE trigger code */
{af/sup/aftrigtopw.i}

/* properform fields if enabled for table */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gsccp':U
              AND gsc_entity_mnemonic.auto_properform_strings = YES) THEN
  RUN af/app/afpropfrmp.p (INPUT BUFFER gsc_custom_procedure:HANDLE).
  



/* Generated by ICF ERwin Template */
/* gsm_category of gsc_custom_procedure ON CHILD UPDATE RESTRICT */
IF NEW gsc_custom_procedure OR  gsc_custom_procedure.category_obj &lt;&gt; o_gsc_custom_procedure.category_obj  THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsm_category WHERE
        gsc_custom_procedure.category_obj = gsm_category.category_obj)) THEN
              DO:
                /* Cannot update child because parent does not exist ! */
                ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 103 lv-include = &quot;gsc_custom_procedure|gsm_category&quot;:U.
                RUN error-message (lv-errgrp, lv-errnum, lv-include).
              END.
    
    
  END.








IF NOT NEW gsc_custom_procedure AND gsc_custom_procedure.{&amp;TRIGGER_OBJ} &lt;&gt; o_gsc_custom_procedure.{&amp;TRIGGER_OBJ} THEN
    DO:
        ASSIGN lv-error = YES lv-errgrp = &quot;AF&quot;:U lv-errnum = 13 lv-include = &quot;table object number&quot;:U.
        RUN error-message (lv-errgrp,lv-errnum,lv-include).
    END.

/* Customisations to WRITE trigger */
{icf/trg/gsccptrigw.i}



/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gsccp':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;WRITE&quot;:U, INPUT &quot;gsccp&quot;:U, INPUT BUFFER gsc_custom_procedure:HANDLE, INPUT BUFFER o_gsc_custom_procedure:HANDLE).

/* Standard bottom of WRITE trigger code */
{af/sup/aftrigendw.i}



" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gsccptrigw.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FIELD>
      <Field-Name> "category_obj" </Field-Name>
      <Data-Type> "decimal" </Data-Type>
      <Format> "-&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;9.999999999" </Format>
      <Label> "Category obj" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "0" </Initial>
      <Order> 20 </Order>
      <Decimals> 9 </Decimals>
      <Desc> "" </Desc>
      <Help> "Category obj" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "o_obj" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 24 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "custom_procedure_description" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(70)" </Format>
      <Label> "Custom procedure description" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 40 </Order>
      <Decimals> ? </Decimals>
      <Desc> "A description of the customised business process procedure. This will be presented to the user and so should be adequately described." </Desc>
      <Help> "Custom procedure description" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_big_description" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 140 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "custom_procedure_notes" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(3000)" </Format>
      <Label> "Custom procedure notes" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 50 </Order>
      <Decimals> ? </Decimals>
      <Desc> "Notes on how to use the custom procedure, details of the API, etc." </Desc>
      <Help> "Custom procedure notes" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS EDITOR SIZE 70 BY 8 SCROLLBAR-VERTICAL LARGE MAX-CHARS 3000" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_big_text_block" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 6000 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "custom_procedure_obj" </Field-Name>
      <Data-Type> "decimal" </Data-Type>
      <Format> "-&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;9.999999999" </Format>
      <Label> "Custom procedure obj" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "0" </Initial>
      <Order> 10 </Order>
      <Decimals> 9 </Decimals>
      <Desc> "" </Desc>
      <Help> "Custom procedure obj" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "o_obj" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 24 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "custom_procedure_short_desc" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(15)" </Format>
      <Label> "Custom procedure short desc." </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 30 </Order>
      <Decimals> ? </Decimals>
      <Desc> "A brief description of the customised business process procedure - to display in browsers, etc." </Desc>
      <Help> "Custom procedure short description" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_short_desc" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 30 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "procedure_name" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(35)" </Format>
      <Label> "Procedure name" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 60 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The actual internal procedure name as used in the program." </Desc>
      <Help> "Procedure name" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_program_procedure" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 70 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "run_this_procedure" </Field-Name>
      <Data-Type> "logical" </Data-Type>
      <Format> "YES/NO" </Format>
      <Label> "Run this procedure" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "YES" </Initial>
      <Order> 70 </Order>
      <Decimals> ? </Decimals>
      <Desc> "If set to NO, the running of this procedure will be disabled." </Desc>
      <Help> "Run this procedure" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS TOGGLE-BOX" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "l_yesno" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 1 </Width>
    </FIELD>
    <INDEX>
      <Index-Name> "XPKgsc_custom_procedure" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> YES </Prim>
      <Active> YES </Active>
      <Unique> YES </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "custom_procedure_obj" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XAK1gsc_custom_procedure" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> YES </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "procedure_name" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XIE1gsc_custom_procedure" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> NO </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "category_obj" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "custom_procedure_description" </Field-Name>
        <Index-Seq> 2 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XIE2gsc_custom_procedure" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> NO </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "category_obj" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "custom_procedure_short_desc" </Field-Name>
        <Index-Seq> 2 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <REFERENCE>
      <ReferenceID> 32813 </ReferenceID>
      <Ref-Name> "is used by" </Ref-Name>
      <mandatory> NO </mandatory>
      <cardinal> 1 </cardinal>
      <side> 2 </side>
      <pos> ? </pos>
      <REF-FIELD>
        <Field-Name> "custom_procedure_obj" </Field-Name>
        <order> 1 </order>
      </REF-FIELD>
    </REFERENCE>
    <REFERENCE>
      <ReferenceID> 32814 </ReferenceID>
      <Ref-Name> "" </Ref-Name>
      <mandatory> YES </mandatory>
      <cardinal> 1 </cardinal>
      <side> 2 </side>
      <pos> ? </pos>
      <REF-FIELD>
        <Field-Name> "category_obj" </Field-Name>
        <order> 1 </order>
      </REF-FIELD>
    </REFERENCE>
  </FILE>
  <FILE>
    <File-Name> "gsc_dataset_entity" </File-Name>
    <Dump-name> "gscde" </Dump-name>
    <Area-Name> "Schema Area" </Area-Name>
    <Frozen> NO </Frozen>
    <Desc> "This table contains a complete list of tables that need to be deployed with the  dataset.

One of the tables in the dataset must be marked as primary, i.e. the main table in the dataset. The join information between the tables must also be specified.

The data in this table can be filtered using the filter where clause." </Desc>
    <File-Label> ? </File-Label>
    <File-Label-SA> ? </File-Label-SA>
    <Hidden> NO </Hidden>
    <Valexp> ? </Valexp>
    <Valmsg> "" </Valmsg>
    <Valmsg-SA> ? </Valmsg-SA>
    <Fil-misc26> ? </Fil-misc26>
    <ianum> 6 </ianum>
    <grid> no </grid>
    <X> 8 </X>
    <Y> 4 </Y>
    <Xsize> 10 </Xsize>
    <Ysize> 20 </Ysize>
    <FILE-TRIG>
      <Event> "CREATE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR CREATE OF gsc_dataset_entity .

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_dataset_entity           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_dataset_entity
&amp;SCOPED-DEFINE TRIGGER_FLA gscde
&amp;SCOPED-DEFINE TRIGGER_OBJ dataset_entity_obj


DEFINE BUFFER lb_table FOR gsc_dataset_entity.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_dataset_entity.     /* Used for lock upgrades */

DEFINE BUFFER o_gsc_dataset_entity FOR gsc_dataset_entity.

/* Standard top of CREATE trigger code */
{af/sup/aftrigtopc.i}

  



/* Generated by ICF ERwin Template */
/* ryc_relationship is the join for gsc_dataset_entity ON CHILD INSERT SET NULL */
IF NOT(CAN-FIND(FIRST ryc_relationship WHERE
    gsc_dataset_entity.relationship_obj = ryc_relationship.relationship_obj)) THEN
  DO:
    
    ASSIGN gsc_dataset_entity.relationship_obj = 0 .
  END.



/* Generated by ICF ERwin Template */
/* gsc_entity_mnemonic is the join partner for gsc_dataset_entity ON CHILD INSERT SET NULL */
IF NOT(CAN-FIND(FIRST gsc_entity_mnemonic WHERE
    gsc_dataset_entity.join_entity_mnemonic = gsc_entity_mnemonic.entity_mnemonic)) THEN
  DO:
    
    ASSIGN gsc_dataset_entity.join_entity_mnemonic = &quot;&quot;:U .
  END.



/* Generated by ICF ERwin Template */
/* gsc_entity_mnemonic is included in gsc_dataset_entity ON CHILD INSERT RESTRICT */
IF 
    ( gsc_dataset_entity.entity_mnemonic &lt;&gt; &quot;&quot;:U ) THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_entity_mnemonic WHERE
        gsc_dataset_entity.entity_mnemonic = gsc_entity_mnemonic.entity_mnemonic)) THEN
        DO:
          /* Cannot create child because parent does not exist ! */
          ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 102 lv-include = &quot;gsc_dataset_entity|gsc_entity_mnemonic&quot;:U.
          RUN error-message (lv-errgrp, lv-errnum, lv-include).
        END.
    
    
  END.

/* Generated by ICF ERwin Template */
/* gsc_deploy_dataset includes gsc_dataset_entity ON CHILD INSERT RESTRICT */
IF 
    ( gsc_dataset_entity.deploy_dataset_obj &lt;&gt; 0 ) THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_deploy_dataset WHERE
        gsc_dataset_entity.deploy_dataset_obj = gsc_deploy_dataset.deploy_dataset_obj)) THEN
        DO:
          /* Cannot create child because parent does not exist ! */
          ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 102 lv-include = &quot;gsc_dataset_entity|gsc_deploy_dataset&quot;:U.
          RUN error-message (lv-errgrp, lv-errnum, lv-include).
        END.
    
    
  END.






ASSIGN gsc_dataset_entity.{&amp;TRIGGER_OBJ} = getNextObj() NO-ERROR.
IF ERROR-STATUS:ERROR THEN 
DO:
    ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 31 lv-include = &quot;gsc_dataset_entity|the specified object number.  Please ensure your database sequences have been set correctly&quot;:U.
    RUN error-message (lv-errgrp, lv-errnum, lv-include).
END.







/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gscde':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;CREATE&quot;:U, INPUT &quot;gscde&quot;:U, INPUT BUFFER gsc_dataset_entity:HANDLE, INPUT BUFFER o_gsc_dataset_entity:HANDLE).

/* Standard bottom of CREATE trigger code */
{af/sup/aftrigendc.i}


/* Place any specific CREATE trigger customisations here */



" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdetrigc.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "DELETE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR DELETE OF gsc_dataset_entity .

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_dataset_entity           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_dataset_entity
&amp;SCOPED-DEFINE TRIGGER_FLA gscde
&amp;SCOPED-DEFINE TRIGGER_OBJ dataset_entity_obj


DEFINE BUFFER lb_table FOR gsc_dataset_entity.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_dataset_entity.     /* Used for lock upgrades */

DEFINE BUFFER o_gsc_dataset_entity FOR gsc_dataset_entity.

/* Standard top of DELETE trigger code */
{af/sup/aftrigtopd.i}

  






/* Generic comments deletion */
DEFINE BUFFER lbx_gsm_comment FOR gsm_comment.
DEFINE BUFFER lby_gsm_comment FOR gsm_comment.
IF CAN-FIND(FIRST lbx_gsm_comment 
            WHERE lbx_gsm_comment.owning_obj = gsc_dataset_entity.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_comment NO-LOCK
       WHERE lbx_gsm_comment.owning_obj = gsc_dataset_entity.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gscdetrigd.p^delete gsm_comment&quot;:U:
        FIND FIRST lby_gsm_comment EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_comment) = ROWID(lbx_gsm_comment)
             NO-ERROR.
        IF AVAILABLE lby_gsm_comment THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_comment&quot;}
          END.
    END.
/* Generic security allocation deletion */
DEFINE BUFFER lbx_gsm_user_allocation FOR gsm_user_allocation.
DEFINE BUFFER lby_gsm_user_allocation FOR gsm_user_allocation.
IF CAN-FIND(FIRST lbx_gsm_user_allocation 
            WHERE lbx_gsm_user_allocation.owning_obj = gsc_dataset_entity.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_user_allocation NO-LOCK
       WHERE lbx_gsm_user_allocation.owning_obj = gsc_dataset_entity.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gscdetrigd.p^delete gsm_user_allocation&quot;:U:
        FIND FIRST lby_gsm_user_allocation EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_user_allocation) = ROWID(lbx_gsm_user_allocation)
             NO-ERROR.
        IF AVAILABLE lby_gsm_user_allocation THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_user_allocation&quot;}
          END.
    END.
/* Generic multi-media deletion */
DEFINE BUFFER lbx_gsm_multi_media FOR gsm_multi_media.
DEFINE BUFFER lby_gsm_multi_media FOR gsm_multi_media.
IF CAN-FIND(FIRST lbx_gsm_multi_media 
            WHERE lbx_gsm_multi_media.owning_obj = gsc_dataset_entity.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_multi_media NO-LOCK
       WHERE lbx_gsm_multi_media.owning_obj = gsc_dataset_entity.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gscdetrigd.p^delete gsm_multi_media&quot;:U:
        FIND FIRST lby_gsm_multi_media EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_multi_media) = ROWID(lbx_gsm_multi_media)
             NO-ERROR.
        IF AVAILABLE lby_gsm_multi_media THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_multi_media&quot;}
          END.
    END.










/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gscde':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;DELETE&quot;:U, INPUT &quot;gscde&quot;:U, INPUT BUFFER gsc_dataset_entity:HANDLE, INPUT BUFFER o_gsc_dataset_entity:HANDLE).

/* Standard bottom of DELETE trigger code */
{af/sup/aftrigendd.i}


/* Place any specific DELETE trigger customisations here */
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdetrigd.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-CREATE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-CREATE OF gsc_dataset_entity.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_dataset_entity&quot;
                      &amp;TABLE-FLA    = &quot;gscde&quot;
                      &amp;TABLE-PK     = &quot;dataset_entity_obj&quot;
                      &amp;ACTION       = &quot;CREATE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdereplc.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-DELETE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-DELETE OF gsc_dataset_entity.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_dataset_entity&quot;
                      &amp;TABLE-FLA    = &quot;gscde&quot;
                      &amp;TABLE-PK     = &quot;dataset_entity_obj&quot;
                      &amp;ACTION       = &quot;DELETE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscderepld.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-WRITE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-WRITE OF gsc_dataset_entity OLD BUFFER lb_old.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_dataset_entity&quot;
                      &amp;TABLE-FLA    = &quot;gscde&quot;
                      &amp;TABLE-PK     = &quot;dataset_entity_obj&quot;
                      &amp;OLD-BUFFER   = &quot;lb_old&quot;
                      &amp;ACTION       = &quot;WRITE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}


" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdereplw.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "WRITE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR WRITE OF gsc_dataset_entity OLD BUFFER o_gsc_dataset_entity.

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_dataset_entity           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_dataset_entity
&amp;SCOPED-DEFINE TRIGGER_FLA gscde
&amp;SCOPED-DEFINE TRIGGER_OBJ dataset_entity_obj


DEFINE BUFFER lb_table FOR gsc_dataset_entity.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_dataset_entity.     /* Used for lock upgrades */



/* Standard top of WRITE trigger code */
{af/sup/aftrigtopw.i}

/* properform fields if enabled for table */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gscde':U
              AND gsc_entity_mnemonic.auto_properform_strings = YES) THEN
  RUN af/app/afpropfrmp.p (INPUT BUFFER gsc_dataset_entity:HANDLE).
  



/* Generated by ICF ERwin Template */
/* ryc_relationship is the join for gsc_dataset_entity ON CHILD UPDATE SET NULL */
IF NEW gsc_dataset_entity OR  gsc_dataset_entity.relationship_obj &lt;&gt; o_gsc_dataset_entity.relationship_obj  THEN
  DO:
    IF NOT(CAN-FIND(FIRST ryc_relationship WHERE
        gsc_dataset_entity.relationship_obj = ryc_relationship.relationship_obj)) THEN DO:
        
        ASSIGN gsc_dataset_entity.relationship_obj = 0 .
    END.
    
    
  END.

/* Generated by ICF ERwin Template */
/* gsc_entity_mnemonic is the join partner for gsc_dataset_entity ON CHILD UPDATE SET NULL */
IF NEW gsc_dataset_entity OR  gsc_dataset_entity.join_entity_mnemonic &lt;&gt; o_gsc_dataset_entity.join_entity_mnemonic  THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_entity_mnemonic WHERE
        gsc_dataset_entity.join_entity_mnemonic = gsc_entity_mnemonic.entity_mnemonic)) THEN DO:
        
        ASSIGN gsc_dataset_entity.join_entity_mnemonic = &quot;&quot;:U .
    END.
    
    
  END.

/* Generated by ICF ERwin Template */
/* gsc_entity_mnemonic is included in gsc_dataset_entity ON CHILD UPDATE RESTRICT */
IF NEW gsc_dataset_entity OR  gsc_dataset_entity.entity_mnemonic &lt;&gt; o_gsc_dataset_entity.entity_mnemonic  THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_entity_mnemonic WHERE
        gsc_dataset_entity.entity_mnemonic = gsc_entity_mnemonic.entity_mnemonic)) THEN
              DO:
                /* Cannot update child because parent does not exist ! */
                ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 103 lv-include = &quot;gsc_dataset_entity|gsc_entity_mnemonic&quot;:U.
                RUN error-message (lv-errgrp, lv-errnum, lv-include).
              END.
    
    
  END.

/* Generated by ICF ERwin Template */
/* gsc_deploy_dataset includes gsc_dataset_entity ON CHILD UPDATE RESTRICT */
IF NEW gsc_dataset_entity OR  gsc_dataset_entity.deploy_dataset_obj &lt;&gt; o_gsc_dataset_entity.deploy_dataset_obj  THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_deploy_dataset WHERE
        gsc_dataset_entity.deploy_dataset_obj = gsc_deploy_dataset.deploy_dataset_obj)) THEN
              DO:
                /* Cannot update child because parent does not exist ! */
                ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 103 lv-include = &quot;gsc_dataset_entity|gsc_deploy_dataset&quot;:U.
                RUN error-message (lv-errgrp, lv-errnum, lv-include).
              END.
    
    
  END.








IF NOT NEW gsc_dataset_entity AND gsc_dataset_entity.{&amp;TRIGGER_OBJ} &lt;&gt; o_gsc_dataset_entity.{&amp;TRIGGER_OBJ} THEN
    DO:
        ASSIGN lv-error = YES lv-errgrp = &quot;AF&quot;:U lv-errnum = 13 lv-include = &quot;table object number&quot;:U.
        RUN error-message (lv-errgrp,lv-errnum,lv-include).
    END.

/* Customisations to WRITE trigger */
{icf/trg/gscdetrigw.i}



/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gscde':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;WRITE&quot;:U, INPUT &quot;gscde&quot;:U, INPUT BUFFER gsc_dataset_entity:HANDLE, INPUT BUFFER o_gsc_dataset_entity:HANDLE).

/* Standard bottom of WRITE trigger code */
{af/sup/aftrigendw.i}



" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdetrigw.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FIELD>
      <Field-Name> "dataset_entity_obj" </Field-Name>
      <Data-Type> "decimal" </Data-Type>
      <Format> "-&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;9.999999999" </Format>
      <Label> "Dataset entity obj" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "0" </Initial>
      <Order> 10 </Order>
      <Decimals> 9 </Decimals>
      <Desc> "" </Desc>
      <Help> "Dataset entity obj" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "o_obj" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 24 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "delete_related_records" </Field-Name>
      <Data-Type> "logical" </Data-Type>
      <Format> "YES/NO" </Format>
      <Label> "Delete related records" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "YES" </Initial>
      <Order> 90 </Order>
      <Decimals> ? </Decimals>
      <Desc> "If set to YES, any records for this dataset entity related to the parent entity will be deleted. If set to NO, records in this entity will not be deleted before applying the new dataset records.

For example, a dataset linking objects and menu items would typically not want to first delete the menu item records so that user defined menu items are preserved, whereas a dataset relating entity mnemonics to entity display fields would require the deletion of existing data first before applying the new set.

If delete_related_records is YES then overwrite_records must also be YES.

This flag is specifically related to data updates, when new information is coming in from an ADO.

When deploying out a deletion, the deletion_action field is used to determine what and how to delete the related data. What to delete could be different between deployments of updates and deployments of deletions.


" </Desc>
      <Help> "Delete related records" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS TOGGLE-BOX" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "l_yesno" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 1 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "deletion_action" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(1)" </Format>
      <Label> "Deletion action" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 140 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The deletion action decides the action to be taken when a record is deleted as a result of a deployed deletion. Valid values are:

C - CASCADE 
When a record in the parent entity is deleted, each related record in the child entity is also deleted.

S - SET NULL
When a record in the parent entity is deleted, the foreign key attributes or columns in each related record of the child entity are set to Null.

N = NONE
No deletion action is required.

This flag is specifically related to deployment of data deletion - and is different in meaning to the delete_related_records flag which is used when doing updates of new information coming in from an ADO.

When deploying out an update the delete_related_records flag is used to determine what to delete before bringing in the new data. What to delete could be different between deployments of updates and deployments of deletions.


" </Desc>
      <Help> "Deletion action" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_string_1" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 2 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "deploy_dataset_obj" </Field-Name>
      <Data-Type> "decimal" </Data-Type>
      <Format> "-&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;9.999999999" </Format>
      <Label> "Deploy dataset obj" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "0" </Initial>
      <Order> 20 </Order>
      <Decimals> 9 </Decimals>
      <Desc> "" </Desc>
      <Help> "Deploy dataset obj" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "o_obj" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 24 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "entity_mnemonic" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(8)" </Format>
      <Label> "Entity" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 40 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The code allocated to every table in the database that uniquely identifies the database table. This code is used when generically joining to tables, as the basis for naming conventions (e.g. a prefix to all objects that maintain this table), etc.

This code is usually stored in the dump name of the table.
" </Desc>
      <Help> "Entity" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_entity_mnemonic" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 16 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "entity_sequence" </Field-Name>
      <Data-Type> "integer" </Data-Type>
      <Format> "-&gt;&gt;9" </Format>
      <Label> "Entity sequence" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "0" </Initial>
      <Order> 30 </Order>
      <Decimals> ? </Decimals>
      <Desc> "This field specifies the order in which the tables are dumped/loaded to or from the XML file." </Desc>
      <Help> "Entity sequence" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "n_integer_3" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 4 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "exclude_field_list" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(500)" </Format>
      <Label> "Exclude field list" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 150 </Order>
      <Decimals> ? </Decimals>
      <Desc> "This is a comma delimited list of fields for the entity that should not be updated during a deployment so as to not use customizations. 

An example of where this is relevant is for the extends_object_type_obj on gsc_object_type. 

Customers may modify this to point at a different object type so that they can customize in the middle of the class hierarchy. 

For example, they may change the SDO class to extend mySDO to that the custom behavior applies to all existing SDOs without changing the object type. With the extends_object_type_obj field in the exclude field list, this would not be overwritten at deployment, thus preserving the customizations.

If this is a new record, then fields in the exclude field list will be ignored. This just applies to updates.
" </Desc>
      <Help> "Exclude field list" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS EDITOR SIZE 70 BY 8 SCROLLBAR-VERTICAL MAX-CHARS 500" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_small_text_block" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 1000 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "filter_where_clause" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(500)" </Format>
      <Label> "Filter where clause" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 80 </Order>
      <Decimals> ? </Decimals>
      <Desc> "This field contains a WHERE clause that can be applied to a QUERY-PREPARE method that filters the data in this table.

eg: Only deploying data specific to a site, product, or product module." </Desc>
      <Help> "Filter where clause" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS EDITOR SIZE 70 BY 8 SCROLLBAR-VERTICAL MAX-CHARS 500" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_small_text_block" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 1000 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "join_entity_mnemonic" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(8)" </Format>
      <Label> "Join entity" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 60 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The code allocated to every table in the database that uniquely identifies the database table. This code is used when generically joining to tables, as the basis for naming conventions (e.g. a prefix to all objects that maintain this table), etc.

This code is usually stored in the dump name of the table.
" </Desc>
      <Help> "Join entity" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_entity_mnemonic" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 16 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "join_field_list" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(70)" </Format>
      <Label> "Join field list" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 70 </Order>
      <Decimals> ? </Decimals>
      <Desc> "If this record has the primary_entity flag switched on, this field contains a list of fields on the table whose values will be provided as an input parameter to the procedure that writes out the XML file. 

For example, if the primary table name were gsc_entity_mnemonic and the intention was to deploy datasets for specific entity_mnemonics only, this field would contain the entity_mnemonic field and the input parameter would be the value of the entity_mnemonic field. 

If this record is not the primary entity, this field contains a comma-separated list of field name pairs made as follows:

The first entry in each pair contains the name of the field on this table with no prefix.

The second entry in each pair contains a field on the join partner specified by the join_entity_mnemonic with no table prefix.
" </Desc>
      <Help> "Join field list" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_big_description" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 140 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "keep_own_site_data" </Field-Name>
      <Data-Type> "logical" </Data-Type>
      <Format> "YES/NO" </Format>
      <Label> "Keep own site data" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "NO" </Initial>
      <Order> 110 </Order>
      <Decimals> ? </Decimals>
      <Desc> "This is used in conjunction with the delete_related_records flag and is only applicable if this is set to YES.

If set to YES, then any data for the current site number will not be deleted, e.g. to preserve own menu items.
" </Desc>
      <Help> "Keep own site data" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS TOGGLE-BOX" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "l_noyes" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 1 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "overwrite_records" </Field-Name>
      <Data-Type> "logical" </Data-Type>
      <Format> "YES/NO" </Format>
      <Label> "Overwrite records" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "YES" </Initial>
      <Order> 100 </Order>
      <Decimals> ? </Decimals>
      <Desc> "If set to YES and a record corresponding to a record in the dataset is found in the target repository, then the contents of the record will be overwritten with the contents of the dataset.

If set to NO, the repository record will be left intact if it already exists. 

Typically this flag would be set to YES, but in the case of sequences for example, it would be set to NO so as not to overwrite sequence current values in the target repository.

If delete_related_records is YES then overwrite_records must also be YES.

" </Desc>
      <Help> "Overwrite records" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS TOGGLE-BOX" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "l_yesno" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 1 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "primary_entity" </Field-Name>
      <Data-Type> "logical" </Data-Type>
      <Format> "YES/NO" </Format>
      <Label> "Primary entity" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "NO" </Initial>
      <Order> 50 </Order>
      <Decimals> ? </Decimals>
      <Desc> "If set to YES this is the primary entity in the dataset. Each dataset must have at least 1 primary entity." </Desc>
      <Help> "Primary entity" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS TOGGLE-BOX" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "l_noyes" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 1 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "relationship_obj" </Field-Name>
      <Data-Type> "decimal" </Data-Type>
      <Format> "-&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;9.999999999" </Format>
      <Label> "Relationship obj" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "0" </Initial>
      <Order> 130 </Order>
      <Decimals> 9 </Decimals>
      <Desc> "" </Desc>
      <Help> "Relationship obj" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "o_obj" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 24 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "use_relationship" </Field-Name>
      <Data-Type> "logical" </Data-Type>
      <Format> "YES/NO" </Format>
      <Label> "Use relationship" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "NO" </Initial>
      <Order> 120 </Order>
      <Decimals> ? </Decimals>
      <Desc> "IF this is set to YES, then the relationship information between the entity_mnemonmic and join_entity_mnemonic fields is derived from the ryc_relationship record specified by the relationship_obj.

If this is set to NO, the relationship information is derived from a combination of join_field_list and filter_where_clause." </Desc>
      <Help> "Use relationship" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> "VIEW-AS TOGGLE-BOX" </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "l_noyes" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 1 </Width>
    </FIELD>
    <INDEX>
      <Index-Name> "XPKgsc_dataset_entity" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> YES </Prim>
      <Active> YES </Active>
      <Unique> YES </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "dataset_entity_obj" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XAK1gsc_dataset_entity" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> YES </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "deploy_dataset_obj" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "entity_sequence" </Field-Name>
        <Index-Seq> 2 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XIE1gsc_dataset_entity" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> NO </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "entity_mnemonic" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XIE3gsc_dataset_entity" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> NO </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "deploy_dataset_obj" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "primary_entity" </Field-Name>
        <Index-Seq> 2 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "entity_mnemonic" </Field-Name>
        <Index-Seq> 3 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XIE4gsc_dataset_entity" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> NO </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "join_entity_mnemonic" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "dataset_entity_obj" </Field-Name>
        <Index-Seq> 2 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XIE5gsc_dataset_entity" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> NO </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "relationship_obj" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <REFERENCE>
      <ReferenceID> 32837 </ReferenceID>
      <Ref-Name> "" </Ref-Name>
      <mandatory> YES </mandatory>
      <cardinal> 1 </cardinal>
      <side> 2 </side>
      <pos> ? </pos>
      <REF-FIELD>
        <Field-Name> "relationship_obj" </Field-Name>
        <order> 1 </order>
      </REF-FIELD>
    </REFERENCE>
    <REFERENCE>
      <ReferenceID> 32838 </ReferenceID>
      <Ref-Name> "" </Ref-Name>
      <mandatory> YES </mandatory>
      <cardinal> 1 </cardinal>
      <side> 2 </side>
      <pos> ? </pos>
      <REF-FIELD>
        <Field-Name> "join_entity_mnemonic" </Field-Name>
        <order> 1 </order>
      </REF-FIELD>
    </REFERENCE>
    <REFERENCE>
      <ReferenceID> 32839 </ReferenceID>
      <Ref-Name> "" </Ref-Name>
      <mandatory> YES </mandatory>
      <cardinal> 1 </cardinal>
      <side> 2 </side>
      <pos> ? </pos>
      <REF-FIELD>
        <Field-Name> "entity_mnemonic" </Field-Name>
        <order> 1 </order>
      </REF-FIELD>
    </REFERENCE>
    <REFERENCE>
      <ReferenceID> 32840 </ReferenceID>
      <Ref-Name> "" </Ref-Name>
      <mandatory> YES </mandatory>
      <cardinal> 1 </cardinal>
      <side> 2 </side>
      <pos> ? </pos>
      <REF-FIELD>
        <Field-Name> "deploy_dataset_obj" </Field-Name>
        <order> 1 </order>
      </REF-FIELD>
    </REFERENCE>
  </FILE>
  <FILE>
    <File-Name> "gsc_default_code" </File-Name>
    <Dump-name> "gscdc" </Dump-name>
    <Area-Name> "Schema Area" </Area-Name>
    <Frozen> NO </Frozen>
    <Desc> "This table makes provision for any number of parameters or system defaults that need be specified to the system, without neccessitating structural database changes.

How these parameters / defaults are used needs to be hard coded into the application.

These records can be grouped into sets under gsc_default_set, to facilitate different parameter / defaults sets. Again, the selection of a default set would be coded into the application.

An example would be different parameter sets for warehouse control, different controls per administration group etc." </Desc>
    <File-Label> ? </File-Label>
    <File-Label-SA> ? </File-Label-SA>
    <Hidden> NO </Hidden>
    <Valexp> ? </Valexp>
    <Valmsg> "" </Valmsg>
    <Valmsg-SA> ? </Valmsg-SA>
    <Fil-misc26> ? </Fil-misc26>
    <ianum> 6 </ianum>
    <grid> no </grid>
    <X> 14 </X>
    <Y> 4 </Y>
    <Xsize> 10 </Xsize>
    <Ysize> 11 </Ysize>
    <FILE-TRIG>
      <Event> "CREATE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR CREATE OF gsc_default_code .

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_default_code           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_default_code
&amp;SCOPED-DEFINE TRIGGER_FLA gscdc
&amp;SCOPED-DEFINE TRIGGER_OBJ default_code_obj


DEFINE BUFFER lb_table FOR gsc_default_code.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_default_code.     /* Used for lock upgrades */

DEFINE BUFFER o_gsc_default_code FOR gsc_default_code.

/* Standard top of CREATE trigger code */
{af/sup/aftrigtopc.i}

  



/* Generated by ICF ERwin Template */
/* gsc_entity_mnemonic  gsc_default_code ON CHILD INSERT RESTRICT */
IF 
    ( gsc_default_code.owning_entity_mnemonic &lt;&gt; &quot;&quot;:U ) THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_entity_mnemonic WHERE
        gsc_default_code.owning_entity_mnemonic = gsc_entity_mnemonic.entity_mnemonic)) THEN
        DO:
          /* Cannot create child because parent does not exist ! */
          ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 102 lv-include = &quot;gsc_default_code|gsc_entity_mnemonic&quot;:U.
          RUN error-message (lv-errgrp, lv-errnum, lv-include).
        END.
    
    
  END.

/* Generated by ICF ERwin Template */
/* gsc_default_set has gsc_default_code ON CHILD INSERT RESTRICT */
IF 
    ( gsc_default_code.default_set_code &lt;&gt; &quot;&quot;:U ) THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_default_set WHERE
        gsc_default_code.default_set_code = gsc_default_set.default_set_code)) THEN
        DO:
          /* Cannot create child because parent does not exist ! */
          ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 102 lv-include = &quot;gsc_default_code|gsc_default_set&quot;:U.
          RUN error-message (lv-errgrp, lv-errnum, lv-include).
        END.
    
    
  END.






ASSIGN gsc_default_code.{&amp;TRIGGER_OBJ} = getNextObj() NO-ERROR.
IF ERROR-STATUS:ERROR THEN 
DO:
    ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 31 lv-include = &quot;gsc_default_code|the specified object number.  Please ensure your database sequences have been set correctly&quot;:U.
    RUN error-message (lv-errgrp, lv-errnum, lv-include).
END.







/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gscdc':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;CREATE&quot;:U, INPUT &quot;gscdc&quot;:U, INPUT BUFFER gsc_default_code:HANDLE, INPUT BUFFER o_gsc_default_code:HANDLE).

/* Standard bottom of CREATE trigger code */
{af/sup/aftrigendc.i}


/* Place any specific CREATE trigger customisations here */
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdctrigc.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "DELETE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR DELETE OF gsc_default_code .

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_default_code           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_default_code
&amp;SCOPED-DEFINE TRIGGER_FLA gscdc
&amp;SCOPED-DEFINE TRIGGER_OBJ default_code_obj


DEFINE BUFFER lb_table FOR gsc_default_code.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_default_code.     /* Used for lock upgrades */

DEFINE BUFFER o_gsc_default_code FOR gsc_default_code.

/* Standard top of DELETE trigger code */
{af/sup/aftrigtopd.i}

  






/* Generic comments deletion */
DEFINE BUFFER lbx_gsm_comment FOR gsm_comment.
DEFINE BUFFER lby_gsm_comment FOR gsm_comment.
IF CAN-FIND(FIRST lbx_gsm_comment 
            WHERE lbx_gsm_comment.owning_obj = gsc_default_code.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_comment NO-LOCK
       WHERE lbx_gsm_comment.owning_obj = gsc_default_code.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gscdctrigd.p^delete gsm_comment&quot;:U:
        FIND FIRST lby_gsm_comment EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_comment) = ROWID(lbx_gsm_comment)
             NO-ERROR.
        IF AVAILABLE lby_gsm_comment THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_comment&quot;}
          END.
    END.
/* Generic security allocation deletion */
DEFINE BUFFER lbx_gsm_user_allocation FOR gsm_user_allocation.
DEFINE BUFFER lby_gsm_user_allocation FOR gsm_user_allocation.
IF CAN-FIND(FIRST lbx_gsm_user_allocation 
            WHERE lbx_gsm_user_allocation.owning_obj = gsc_default_code.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_user_allocation NO-LOCK
       WHERE lbx_gsm_user_allocation.owning_obj = gsc_default_code.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gscdctrigd.p^delete gsm_user_allocation&quot;:U:
        FIND FIRST lby_gsm_user_allocation EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_user_allocation) = ROWID(lbx_gsm_user_allocation)
             NO-ERROR.
        IF AVAILABLE lby_gsm_user_allocation THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_user_allocation&quot;}
          END.
    END.
/* Generic multi-media deletion */
DEFINE BUFFER lbx_gsm_multi_media FOR gsm_multi_media.
DEFINE BUFFER lby_gsm_multi_media FOR gsm_multi_media.
IF CAN-FIND(FIRST lbx_gsm_multi_media 
            WHERE lbx_gsm_multi_media.owning_obj = gsc_default_code.{&amp;TRIGGER_OBJ}) THEN
    FOR EACH lbx_gsm_multi_media NO-LOCK
       WHERE lbx_gsm_multi_media.owning_obj = gsc_default_code.{&amp;TRIGGER_OBJ}
       ON STOP UNDO, RETURN ERROR &quot;AF^104^gscdctrigd.p^delete gsm_multi_media&quot;:U:
        FIND FIRST lby_gsm_multi_media EXCLUSIVE-LOCK
             WHERE ROWID(lby_gsm_multi_media) = ROWID(lbx_gsm_multi_media)
             NO-ERROR.
        IF AVAILABLE lby_gsm_multi_media THEN
          DO:
            {af/sup/afvalidtrg.i &amp;action = &quot;DELETE&quot; &amp;table = &quot;lby_gsm_multi_media&quot;}
          END.
    END.










/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gscdc':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;DELETE&quot;:U, INPUT &quot;gscdc&quot;:U, INPUT BUFFER gsc_default_code:HANDLE, INPUT BUFFER o_gsc_default_code:HANDLE).

/* Standard bottom of DELETE trigger code */
{af/sup/aftrigendd.i}


/* Place any specific DELETE trigger customisations here */
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdctrigd.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-CREATE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-CREATE OF gsc_default_code.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_default_code&quot;
                      &amp;TABLE-FLA    = &quot;gscdc&quot;
                      &amp;TABLE-PK     = &quot;default_set_code,
                                       owning_entity_mnemonic,
                                       field_name,
                                       effective_date&quot;
                      &amp;ACTION       = &quot;CREATE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdcreplc.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-DELETE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-DELETE OF gsc_default_code.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_default_code&quot;
                      &amp;TABLE-FLA    = &quot;gscdc&quot;
                      &amp;TABLE-PK     = &quot;default_set_code,
                                       owning_entity_mnemonic,
                                       field_name,
                                       effective_date&quot;
                      &amp;ACTION       = &quot;DELETE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}
" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdcrepld.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "REPLICATION-WRITE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/
TRIGGER PROCEDURE FOR REPLICATION-WRITE OF gsc_default_code OLD BUFFER lb_old.

{af/sup/afreplicat.i  &amp;TABLE-NAME   = &quot;gsc_default_code&quot;
                      &amp;TABLE-FLA    = &quot;gscdc&quot;
                      &amp;TABLE-PK     = &quot;default_set_code,
                                       owning_entity_mnemonic,
                                       field_name,
                                       effective_date&quot;
                      &amp;OLD-BUFFER   = &quot;lb_old&quot;
                      &amp;ACTION       = &quot;WRITE&quot;
                      
                      
                      &amp;VERSION-DATA = &quot;YES&quot;
}


" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdcreplw.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FILE-TRIG>
      <Event> "WRITE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR WRITE OF gsc_default_code OLD BUFFER o_gsc_default_code.

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_default_code           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_default_code
&amp;SCOPED-DEFINE TRIGGER_FLA gscdc
&amp;SCOPED-DEFINE TRIGGER_OBJ default_code_obj


DEFINE BUFFER lb_table FOR gsc_default_code.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_default_code.     /* Used for lock upgrades */



/* Standard top of WRITE trigger code */
{af/sup/aftrigtopw.i}

/* properform fields if enabled for table */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gscdc':U
              AND gsc_entity_mnemonic.auto_properform_strings = YES) THEN
  RUN af/app/afpropfrmp.p (INPUT BUFFER gsc_default_code:HANDLE).
  



/* Generated by ICF ERwin Template */
/* gsc_entity_mnemonic  gsc_default_code ON CHILD UPDATE RESTRICT */
IF NEW gsc_default_code OR  gsc_default_code.owning_entity_mnemonic &lt;&gt; o_gsc_default_code.owning_entity_mnemonic  THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_entity_mnemonic WHERE
        gsc_default_code.owning_entity_mnemonic = gsc_entity_mnemonic.entity_mnemonic)) THEN
              DO:
                /* Cannot update child because parent does not exist ! */
                ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 103 lv-include = &quot;gsc_default_code|gsc_entity_mnemonic&quot;:U.
                RUN error-message (lv-errgrp, lv-errnum, lv-include).
              END.
    
    
  END.

/* Generated by ICF ERwin Template */
/* gsc_default_set has gsc_default_code ON CHILD UPDATE RESTRICT */
IF NEW gsc_default_code OR  gsc_default_code.default_set_code &lt;&gt; o_gsc_default_code.default_set_code  THEN
  DO:
    IF NOT(CAN-FIND(FIRST gsc_default_set WHERE
        gsc_default_code.default_set_code = gsc_default_set.default_set_code)) THEN
              DO:
                /* Cannot update child because parent does not exist ! */
                ASSIGN lv-error = YES lv-errgrp = &quot;AF &quot;:U lv-errnum = 103 lv-include = &quot;gsc_default_code|gsc_default_set&quot;:U.
                RUN error-message (lv-errgrp, lv-errnum, lv-include).
              END.
    
    
  END.








IF NOT NEW gsc_default_code AND gsc_default_code.{&amp;TRIGGER_OBJ} &lt;&gt; o_gsc_default_code.{&amp;TRIGGER_OBJ} THEN
    DO:
        ASSIGN lv-error = YES lv-errgrp = &quot;AF&quot;:U lv-errnum = 13 lv-include = &quot;table object number&quot;:U.
        RUN error-message (lv-errgrp,lv-errnum,lv-include).
    END.

/* Customisations to WRITE trigger */
{icf/trg/gscdctrigw.i}



/* Update Audit Log */
IF CAN-FIND(FIRST gsc_entity_mnemonic
            WHERE gsc_entity_mnemonic.entity_mnemonic = 'gscdc':U
              AND gsc_entity_mnemonic.auditing_enabled = YES) THEN
  RUN af/app/afauditlgp.p (INPUT &quot;WRITE&quot;:U, INPUT &quot;gscdc&quot;:U, INPUT BUFFER gsc_default_code:HANDLE, INPUT BUFFER o_gsc_default_code:HANDLE).

/* Standard bottom of WRITE trigger code */
{af/sup/aftrigendw.i}



" </Src>
      <Override> YES </Override>
      <Proc-Name> "icf/trg/gscdctrigw.p" </Proc-Name>
      <Trig-Crc> ? </Trig-Crc>
    </FILE-TRIG>
    <FIELD>
      <Field-Name> "data_type" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(10)" </Format>
      <Label> "Data type" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 50 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The PROGRESS data type of this profile code as follows:
CHR = CHARACTER
INT =  INTEGER
DEC = DECIMAL
DAT = DATE" </Desc>
      <Help> "Data type" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_data_type" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 20 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "default_code_obj" </Field-Name>
      <Data-Type> "decimal" </Data-Type>
      <Format> "-&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;9.999999999" </Format>
      <Label> "Default code obj" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "0" </Initial>
      <Order> 70 </Order>
      <Decimals> 9 </Decimals>
      <Desc> "" </Desc>
      <Help> "Default code obj" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "o_obj" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 24 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "default_set_code" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(10)" </Format>
      <Label> "Default set code" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 10 </Order>
      <Decimals> ? </Decimals>
      <Desc> "A code to uniquely identify this default set code." </Desc>
      <Help> "Default set code" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_code" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 20 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "effective_date" </Field-Name>
      <Data-Type> "date" </Data-Type>
      <Format> "99/99/9999" </Format>
      <Label> "Effective date" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> ? </Initial>
      <Order> 40 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The date this default code became effective. This rate is effective until a new effective date is entered." </Desc>
      <Help> "Effective date" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "d_start_date" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 4 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "field_name" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(70)" </Format>
      <Label> "Field name" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 30 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The field name used to uniquely identify the default code within the default set." </Desc>
      <Help> "Field name" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_big_name" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 140 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "field_value" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(70)" </Format>
      <Label> "Field value" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 60 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The value for the default, always in character format.

Where this is not character, it would need to be converted to the appropriate data_type before being used by the application.

The update program should set this value using a field type of the data_type to force a level of input validation, and then convert this to character to store in this field." </Desc>
      <Help> "Field value" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_big_description" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 140 </Width>
    </FIELD>
    <FIELD>
      <Field-Name> "owning_entity_mnemonic" </Field-Name>
      <Data-Type> "character" </Data-Type>
      <Format> "X(8)" </Format>
      <Label> "Owning entity" </Label>
      <Col-Label> ? </Col-Label>
      <Initial> "" </Initial>
      <Order> 20 </Order>
      <Decimals> ? </Decimals>
      <Desc> "The code allocated to every table in the database that uniquely identifies the database table. This code is used when generically joining to tables, as the basis for naming conventions (e.g. a prefix to all objects that maintain this table), etc.

This code is usually stored in the dump name of the table.
" </Desc>
      <Help> "Owning entity" </Help>
      <Mandatory> NO </Mandatory>
      <Fld-case> NO </Fld-case>
      <Extent> 0 </Extent>
      <View-As> ? </View-As>
      <ValExp> ? </ValExp>
      <ValMsg> "s_entity_mnemonic" </ValMsg>
      <Label-SA> ? </Label-SA>
      <Col-label-SA> ? </Col-label-SA>
      <Format-SA> ? </Format-SA>
      <Initial-SA> ? </Initial-SA>
      <Help-SA> "" </Help-SA>
      <ValMsg-SA> "" </ValMsg-SA>
      <Width> 16 </Width>
    </FIELD>
    <INDEX>
      <Index-Name> "XPKgsc_default_code" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> YES </Prim>
      <Active> YES </Active>
      <Unique> YES </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "default_set_code" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "owning_entity_mnemonic" </Field-Name>
        <Index-Seq> 2 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "field_name" </Field-Name>
        <Index-Seq> 3 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
      <INDEX-FIELD> 
        <Field-Name> "effective_date" </Field-Name>
        <Index-Seq> 4 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <INDEX>
      <Index-Name> "XAK1gsc_default_code" </Index-Name>
      <Area-Name> "Schema Area" </Area-Name>
      <Desc> ? </Desc>
      <Prim> NO </Prim>
      <Active> YES </Active>
      <Unique> YES </Unique>
      <WordIdx> ? </WordIdx>
      <ianum> 6 </ianum>
      <INDEX-FIELD> 
        <Field-Name> "default_code_obj" </Field-Name>
        <Index-Seq> 1 </Index-Seq>
        <Ascending> YES </Ascending>
        <Abbreviate> NO </Abbreviate>
      </INDEX-FIELD>
    </INDEX>
    <REFERENCE>
      <ReferenceID> 32851 </ReferenceID>
      <Ref-Name> "Is for" </Ref-Name>
      <mandatory> YES </mandatory>
      <cardinal> 1 </cardinal>
      <side> 2 </side>
      <pos> ? </pos>
      <REF-FIELD>
        <Field-Name> "owning_entity_mnemonic" </Field-Name>
        <order> 1 </order>
      </REF-FIELD>
    </REFERENCE>
    <REFERENCE>
      <ReferenceID> 32852 </ReferenceID>
      <Ref-Name> "" </Ref-Name>
      <mandatory> YES </mandatory>
      <cardinal> 1 </cardinal>
      <side> 2 </side>
      <pos> ? </pos>
      <REF-FIELD>
        <Field-Name> "default_set_code" </Field-Name>
        <order> 1 </order>
      </REF-FIELD>
    </REFERENCE>
  </FILE>
  <FILE>
    <File-Name> "gsc_default_set" </File-Name>
    <Dump-name> "gscds" </Dump-name>
    <Area-Name> "Schema Area" </Area-Name>
    <Frozen> NO </Frozen>
    <Desc> "This table is used to associate a set of parameters / defaults i.e. a set of gsc_default_code records.

For example, there could be a general set of defaults applicable to the system in general, and other sets of defaults to be used in certain circumstances e.g. for a specific department.

The way these sets are used must be hard coded into the application." </Desc>
    <File-Label> ? </File-Label>
    <File-Label-SA> ? </File-Label-SA>
    <Hidden> NO </Hidden>
    <Valexp> ? </Valexp>
    <Valmsg> "" </Valmsg>
    <Valmsg-SA> ? </Valmsg-SA>
    <Fil-misc26> ? </Fil-misc26>
    <ianum> 6 </ianum>
    <grid> no </grid>
    <X> 20 </X>
    <Y> 4 </Y>
    <Xsize> 10 </Xsize>
    <Ysize> 7 </Ysize>
    <FILE-TRIG>
      <Event> "CREATE" </Event>
      <Src> "/*********************************************************************
* Copyright (C) 2000 by Progress Software Corporation (&quot;PSC&quot;),       *
* 14 Oak Park, Bedford, MA 01730, and other contributors as listed   *
* below.  All Rights Reserved.                                       *
*                                                                    *
* The Initial Developer of the Original Code is PSC.  The Original   *
* Code is Progress IDE code released to open source December 1, 2000.*
*                                                                    *
* The contents of this file are subject to the Possenet Public       *
* License Version 1.0 (the &quot;License&quot;); you may not use this file     *
* except in compliance with the License.  A copy of the License is   *
* available as of the date of this notice at                         *
* http://www.possenet.org/license.html                               *
*                                                                    *
* Software distributed under the License is distributed on an &quot;AS IS&quot;*
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. You*
* should refer to the License for the specific language governing    *
* rights and limitations under the License.                          *
*                                                                    *
* Contributors: MIP Holdings (Pty) Ltd (&quot;MIP&quot;)                       *
*               PSC                                                  *
*                                                                    *
*********************************************************************/

TRIGGER PROCEDURE FOR CREATE OF gsc_default_set .

/* Created automatically using ERwin ICF Trigger template db/af/erw/afercustrg.i
   Do not change manually. Customisations to triggers should be placed in separate
   include files pulled into the trigger. ICF auto generates write trigger custom
   include files. Delete or create customisation include files need to be created
   manually. Be sure to put the hook in ERwin directly so as not to have you changes
   overwritten.
   User defined Macro (UDP) Summary (case sensitive)
   gsc_default_set           Expands to full table name, e.g. gsm_user
   %TableFLA            Expands to table unique code, e.g. gsmus
   %TableObj            If blank or not defined expands to table_obj with no prefix (framework standard)
                        If defined, uses this field as the object field
                        If set to &quot;none&quot; then indicates table does not have an object field
   XYZ                  Do not define so we can compare against an empty string

   See docs for explanation of replication macros 
*/   

&amp;SCOPED-DEFINE TRIGGER_TABLE gsc_default_set
&amp;SCOPED-DEFINE TRIGGER_FLA gscds
&amp;SCOPED-DEFINE TRIGGER_OBJ default_set_obj


DEFINE BUFFER lb_table FOR gsc_default_set.      /* Used for recursive relationships */
DEFINE BUFFER lb1_table FOR gsc_default_set.     /* Used for lock upgrades */

DEFINE BUFFER o_gsc_default_set FOR gsc_default_set.

/* Standard top of CREATE trigger code */
{