Please enable JavaScript to view this site.

FLDCHG is used to check if a fields value has changed based on the before and/or after image of a record.

FLDCHG is commonly used to determine if a record or part of a records should be propagated downstream. For example, consider the case where a source IMS database stores the address of person in the person segment, and a target relational database stores addresses in a seperate table from the person table. The address record would only need to be altered if a field in the address group has changed, a new person record is created, or an old person record has been deleted on the source.

IMSCDC: Unlike CDCBEFORE, FLDCHG looks directly into the incoming data stream at field’s offset and compares for the length of the fld. This data has not been altered, converted, translated or validated in any way.

Other CDC formats: Equivalent to coding: IF (SOURCE.FIELD != CDCBEFORE(SOURCE.FIELD)) The data has been altered, converted, translated and validated according to default and user specified rules.

By default, FLDCHG will return TRUE unless there is an error or there is no change in the before and after images of the field. Non-CDC data is treated like an insert so the result of FLDCHG will always be TRUE.

Category

Boolean

Syntax

FLDCHG(column_name)

 

Parameters Descriptions

column_name  This is the name of the column who’s value needs to be checked.

Example

FLDCHG being used to conditionally set a target field.

IF FLDCHG(SOURCE.FIELD) = TRUE

{

   TARGET.CHANGE_FLAG = 1

}

ELSE

{

   TARGET.CHANGE_FLAG = 0

}

FLDCHG being used to determine if an address record should be written.

IF FLDCHG(SOURCE.ADDRESS-GROUP) = TRUE

{

   ADDRESS_TABLE.PERSON_ID = SOURCE.PERSON_ID

   ADDRESS_TABLE.ADDRESS1  = SORUCE.ADDRESS1

   ADDRESS_TABLE.ADDRESS2  = SORUCE.ADDRESS2

   ADDRESS_TABLE.CITY      = SORUCE.CITY

   ADDRESS_TABLE.STATE     = SORUCE.STATE

   ADDRESS_TABLE.ZIP       = SORUCE.ZIP

}

-- Note that FLDCHG is always TRUE for an insert or delete. If a new source person record is created, both the PERSON and ADDRESS

-- tables will have records inserted. If a source person record is deleted, the target person and address records will be deleted.