# EssPartitionReadOtlChangeFile

Description

EssPartitionReadOtlChangeFile() reads changes from a change file (`*.CHG`) on the target database into memory. This function is designed to be used interactively with EssPartitionApplyOtlChangeRecs() after a call to EssPartitionGetOtlChanges(). This function can be used with filters.

Syntax

    ESS_FUNC_M EssPartitionReadOtlChangeFile (hCtx, pSelectMetaRecords, pMetaChangeRead);

ESS_HCTX_T | hCtx
ESS_PPARTOTL_SELECT_CHG_T | pSelectMetaRecords
ESS_PREAD_T | pMetaChangeRead

Parameters

hCtx | Essbase API context handle.
pSelectMetaRecords | Criteria to select records to read.
pMetaChangeRead | Pointer to meta change records read from the file.

Return Value

Returns zero if successful; error code if unsuccessful.

Notes

This routine returns a time in pMetaChangeRead. It's the same time stamp you should pass to EssXXApplyRecords() to update the timestamp at target database. It's also the same time stamp you should use for EssStampPurge() to purge applied records.

Access

A call to this function requires database designer access privileges.

Example

    ESS_FUNC_M ESS_PartitionReadOtlChangeFile(ESS_HCTX_T hCtx, ESS_HINST_T hInst)
    {
       ESS_FUNC_M          sts;
       ESS_STR_T          chgfilename;
       ESS_TIME_T         time;
       ESS_PARTOTL_CHANGE_API_T   OtlChg;
       ESS_ULONG_T        uldimfilter=0,ulmbrfilter=0,ulmbrattrfilter=0;
       ESS_PARTOTL_SELECT_CHG_T SelectMetaRecords;
       ESS_PARTOTL_READ_T          MetaChangeRead;

       memset(&OtlChg, 0, sizeof(ESS_PARTOTL_CHANGE_API_T));
       memset(&SelectMetaRecords, 0, sizeof(ESS_PARTOTL_SELECT_CHG_T));
       memset(&MetaChangeRead, 0, sizeof(ESS_PARTOTL_READ_T));

       chgfilename = "d:\\essbase5\\app\\app1\\trg1\\ess00001.chg";
       time = 0;

       uldimfilter     = ESS_DIMCHG_ALL;
       ulmbrfilter     = ESS_PARTITION_OTLMBR_ALL;
       ulmbrattrfilter = ESS_PARTITION_OTLMBRATTR_ALL;
       SelectMetaRecords.pszFileName             = chgfilename;
       SelectMetaRecords.QueryFilter.TimeStamp   = time;
       SelectMetaRecords.QueryFilter.ulDimFilter = uldimfilter;
       SelectMetaRecords.QueryFilter.ulMbrFilter = ulmbrfilter;
       SelectMetaRecords.QueryFilter.ulMbrAttrFilter = ulmbrattrfilter;

       MetaChangeRead.pOtlChg = &OtlChg;
       sts = EssPartitionReadOtlChangeFile (hCtx, &SelectMetaRecords, &MetaChangeRead);
       printf("EssPartitionReadOtlChangeFile   sts:  %ld\n",sts);
       sts = EssPartitionFreeOtlChanges(hCtx);
       printf("\tEssPartitionFreeOtlChanges   sts:  %ld\n",sts);

       return(sts);
    }

See Also

Constant and Structure Definitions for Partitions
EssPartitionApplyOtlChangeFile()
EssPartitionApplyOtlChangeRecs()
EssPartitionCloseDefFile()
EssPartitionFreeDefCtx()
EssPartitionFreeOtlChanges()
EssPartitionGetAreaCellCount()
EssPartitionGetList()
EssPartitionGetOtlChanges()
EssPartitionGetReplCells()
EssPartitionNewDefFile()
EssPartitionOpenDefFile()
EssPartitionPurgeOtlChangeFile()
EssPartitionPutReplCells()
EssPartitionReadDefFile()
EssPartitionReplaceDefFile()
EssPartitionResetOtlChangeTime()
EssPartitionValidateDefinition()
EssPartitionWriteDefFile()