# File Replication

## C Functions for File Replication

- xfile_lgv_cko_fil_lst
- xfile_lgv_cko_fil_one
- xfile_lgv_del_cax_tmp
- xfile_lgv_loa_cax_str
- xfile_lgv_ord_fil_rep
- xfile_lgv_rea_cax_fil

### xfile_lgv_cko_fil_lst

int xfile_lgv_cko_fil_lst ( DtvLong t_StructureId, const char * const cp_ServerOrClient, const char * const cp_DiscPath)

Input arguments

t_StructureId | structure identification in temporary table
cp_ServerOrClient | check out on server [S|s] or on client [C|c]
cp_DiscPath | disc+path to check out the file.

Return codes

FILE_NO_ERROR = o.k.

Description

Check out all files to the given disc+path on server or client from the list (T_CAX_FIL_TMP) which corresponds with the structure identification.

### xfile_lgv_cko_fil_one

int xfile_lgv_cko_fil_one (const char * const cp_ServerOrClient, const char * const cp_DiscPath, DtvLong t_FileCid, const char * const cp_FileName, const char * const cp_FileStatus, const char * const cp_CryptName, const char * const cp_StorageArea, const char * const cp_StoreType, const char * const cp_StoreKind, const char * const cp_StoreNode, const char * const cp_StoreDiscPath, const char * const cp_NetProtocol, const char * const cp_StepId)

Input arguments

cp_ServerOrClient | check out on server [S|s] or on client [C|c]
cp_DiscPath | disc+path to check out the file
t_FileCid | internal identification of the file
cp_FileName | name of the file (T_FILE_DAT.C_ID)
cp_FileStatus | status of the file (T_FIL_STORE.FILE_STATUS)
cp_CryptName | crypt name (T_FIL_STORE.FILE_NAME)
cp_StorageArea | name of the vault
cp_StoreType | type of the vault (IN, BCK, EXT, ...)
cp_StoreKind | storage type of the vault (FMS, EIF, PUB, ...)
cp_StoreNode | node on which the file server runs
cp_StoreDiscPath | disc+path of the vault
cp_NetProtocol | reference number of the file server
cp_StepId | identification of a file.

Return codes

FILE_NO_ERROR = o.k.
Description

Check out one file to the given disc+path on server or client.

##

### xfile_lgv_del_cax_tmp

int xfile_lgv_del_cax_tmp (DtvLong t_StructureId)

Input arguments

t_StructureId | structure identification in temporary table.

Return codes

FILE_NO_ERROR = o.k.
FILE_DIS_MEMORY_ALLOC_ERROR = memory allocate error
FILE_DIS_EPQ_ERROR = error from epq

Description

Delete entries in the temporary tables T_CAX_STR_TMP and T_CAX_FIL_TMP which corresponds with the structure identification.
SQL statement:
delete T_CAX_XXX_TMP where STRUCTURE_ID = t_StructureId;

### xfile_lgv_loa_cax_str

int xfile_lgv_loa_cax_str ( DtvLong t_DocumentCid, const char * const cp_CreSystem, const char * const cp_LogicType, const char * const cp_Structure, const char * const cp_Function, char * cp_FileAllLocal, DtvLong * tp_NumberCaxFile, DtvLong * tp_NumberCaxStructure, DtvLong * tp_StructureId, DtvLong * tp_SPReturnCode)

Input arguments

t_DocumentCid | internal identification of the current document
cp_CreSystem | cax creating system
cp_LogicType | logic type (e.g. NORMAL, PRO/E, ...)
cp_Structure | go through document structure ('Y'es/'N'o)
cp_Function | function name of the indented structure.

Output arguments

cp_FileAllLocal | parameter if all files are local
tp_NumberCaxFile | number of the CAX files in T_CAX_FIL_TMP
tp_NumberCaxStructure | number of the CAX structure in T_CAX_STR_TMP
tp_StructureId | identification of the structure
tp_SPReturnCode | return code from stored procedure.

Return codes

FILE_NO_ERROR = o.k.
FILE_DIS_CFG_ERROR = error reading configuration parameter
FILE_DIS_MEMORY_ALLOC_ERROR = memory allocate error
FILE_DIS_NO_STORED_PROCEDURE = stored procedure not available
FILE_EPQ_NO_VIEW_SET = no view is set
FILE_DIS_STORED_PROCEDURE_ERROR = error from epq stored procedure call

Description

Call the stored procedure to load the CAX structure in the temporary tables T_CAX_STR_TMP and T_CAX_FIL_TMP.

### xfile_lgv_ord_fil_rep

int xfile_lgv_ord_fil_rep (const char * const cp_Mode, DtvLong t_StructureId, const char * const cp_StepId, const char * const cp_TargetSite)

Input arguments

cp_Mode | replication mode 'GET' or 'PUT' the file
t_StructureId | structure identification in temporary table
cp_StepId | identification of a file
cp_TargetSite | site identification.

Return codes

FILE_NO_ERROR = o.k.

Description

Replicate the file in another vault. Get the file and vault parameters from the table T_CAX_FIL_TMP. When the parameters not exits in this table get it from the original tables (T_FILE_DAT, T_FIL_STORE, T_STORE_AREA).

### xfile_lgv_rea_cax_fil

int xfile_lgv_rea_cax_fil (DtvLong t_StructureId, int i_Position, DtvLong * tp_Number, char * cp_StepId, char * cp_FileName, char * cp_DfmLocal)

Input arguments

t_StructureId | structure identification in temporary table
i_Position | position flag (0 = first record; 1 = next record).

Output arguments

tp_Number | number of records
cp_StepId | identification of the file
cp_FileName | name of the file
cp_DfmLocal | file is local "Y" or not "N".

Return codes

FILE_NO_ERROR = o.k.

Description

Read the values step identification, filename and the flag if the file is local or not from the temporary file table T_CAX_FIL_TMP which corresponds with the structure identification.
With the first call (position = 0) the function reads all records and returns the first one and the total number of records.
With the next call (position = 1) the function returns the next record and the total number of records.