Try OpenEdge Now
skip to main content
Programming Interfaces
Change Data Capture ABL references : Code examples : Delete CDC policies
 

Delete CDC policies

The following code is an example for deleting CDC table policies:
using OpenEdge.DataAdmin.Error.DataAdminErrorHandler from propath.
using OpenEdge.DataAdmin.ICdcTablePolicy from propath.
using OpenEdge.DataAdmin.ICdcTablePolicyset from propath.

define variable service as OpenEdge.DataAdmin.DataAdminService no-undo.
define variable errorHandler as DataAdminErrorHandler no-undo.
define variable tablePolicies as ICdcTablePolicyset no-undo.
define variable tablepolicy as ICdcTablePolicy no-undo.
define variable iter as OpenEdge.DataAdmin.Lang.Collections.IIterator no-undo.

service = new OpenEdge.DataAdmin.DataAdminService(ldbname(1)).

/* delete policy with policy name */
service:DeleteCdcTablePolicy("policyname").

/* get all policies to delete */
tablePolicies = service:GetCdcTablePolicies().

/* iterate between policies to delete them */
iter = tablePolicies:Iterator().
do while iter:HasNext():
tablepolicy = cast(iter:Next(), ICdcTablePolicy).
service:DeleteCdcTablePolicy(tablepolicy:Name).
end.