Functions
This document describes the predefined functions that are available in the Exchange module.
These functions are available:
get.xch.scheme()
get.batch()
get.batch.line()
get.default.dateformat()
qdb.search()
read.table()
read.table.once()
read.table.company()
log.mess()
do.not.log.condition()
do.not.export.record()
get.xch.scheme()
- SYNOPSYS
domain daxch.cxch get.xch.scheme()
- DESCRIPTION
- This function returns the exchange scheme code that is currently being exchanged.
get.batch()
- SYNOPSYS
domain daxch.cbat get.batch()
- DESCRIPTION
-
This function returns the batch code that is currently being exchanged.
get.batch.line()
- SYNOPSYS
domain daxch.batl get.batchline()
- DESCRIPTION
-
This function returns the batch line id that is currently being exchanged.
get.default.dateformat()
- SYNOPSYS
-
domain daxch.dfor get.default.dateformat()
- DESCRIPTION
-
This function gets the default date format of the exchange scheme of the current export/import run.
qdb.search()
- SYNOPSIS
-
qdb.search("table", index, keyfield1, ...)
Conditions of usage:
- Only spaces are permitted before
qdb.search()
, no tabs. - There should not be a space between
qdb.search
and the first parenthesis. - The format of the table is ppmmmnnn pp=package mmm=module nnn=table number The table name must be written between quotes (").
- Index must be a numeric constant.
- Values are separated by commas.
- A value should not be split over two lines. The complete construction may be split after a comma.
- Do not use comments in the construction.
- Expressions are allowed, but usage of commas in this are not allowed. For example this is NOT
allowed:
qdb.search(daxch010, 1, max(200, 300))
Therefore we recommend that you use variables or defines to avoid this problem.
- String constants may contain commas.
- If the last character on a line is the closing parenthesis character
())
. It is considered as the closing character for theqdb.search()
call. If, on the lines in the example theqdb.search()
call continues. Place the comma behind it, instead of letting it be the first character on the next line:EXAMPLE
- Incorrect:
qdb.search(daxch002, 1, get.xch.scheme() ascii.file)
- Correct:
qdb.search(daxch002, 1, get.xch.scheme(), ascii.file)
- Incorrect:
- Do not use string constants in an expression.
DESCRIPTION A
qdb.search
function call is during generation expanded into a:
db.change.order()
- Number of keyfield assignments
db.eq()
call
If all keyfields cannot be filled with the arguments supplied, the remaining keyfields are
emptied, with a set.min()
. A db.ge()
call is
executed instead of a db.eq()
.
You can test the result of the qdb.search()
call by inspecting the variable
e.
read.table()
- FUNCTION NAME READ.TABLE
-
Function for reading a table
- SYNOPSYS
-
long READ.TABLE(const string tablename, long index.no, key.field1 [, key.field2, key.field3, ...])
- DESCRIPTION
-
This function is used to read a record from a table once per batch i.s.o. once per batch line. The argument tablename is a table name and should be declared separately and NOT be preceded by the character "
t
". If the table name is given literally it must be enclosed in double quotes. Argumentindex.no
is the index number on which the table must be read. Remaining arguments are values of the key fields in respective order. At least three arguments are necessary to read the table. The function reads the table specified in the argument 'tablename' for the import or export company. For import or export data respectively. In this function a table is read with key values as defined in the arguments. If not all keyfields are filled with the arguments the remaining keyfields are left empty.
EXAMPLE:
read.ret = READ.TABLE("tiitm001", 1, item)
Where 'read.ret' is defined as a long and 'item' is a field name from the ascii file.
The return values for the function are: 0 : OK - read successful 1 : Error - read unsuccessful
read.table.once()
- FUNCTION NAME READ.TABLE.ONCE
-
Function for reading a table only once during the processing of a batch line.
- SYNOPSIS
-
long READ.TABLE.ONCE(string tablename(), long index.no, key.field1 [, key.field2, key.field3, ...])
- DESCRIPTION
-
With this function you can read a record from a table. This increases the processing speed as the table is NOT read for every record from the ascii file as in case of READ.TABLE function. The table is read only once per batch line. This can be used for parameter tables. The argument tablename is a table name and should be declared separately and should NOT be preceded by "t". If the table name is given literally it must be enclosed in double quotes. The argument
index.no
is the index number on which the table has to be read. Remaining arguments are values of the key fields in respective order. At least three arguments are necessary to read the table. The data is read for the company the import or export is being done for.
EXAMPLE:
read.ret = READ.TABLE.ONCE("tcmcs095", 1, "PUR", 5, 0, "hisp") or read.ret =
READ.TABLE.ONCE("tiitm001", 1, item)
Where 'read.ret' is defined as long and 'item' is a field name from ascii file.
The return values for the function are: 0
: OK - read successful
1
: Error - read unsuccessful
read.table.company()
- FUNCTION NAME READ.TABLE.COMPANY
-
Function for reading a table for a specific company.
- SYNOPSIS
-
long READ.TABLE.COMPANY(string tablename(), long company.no, long index.no, key.field1 [, key.field2, key.field3, ...])
- DESCRIPTION
-
With this function you can read a record from a table of a specific company. The argument tablename is a table name and should be declared separately and should NOT be preceded by "
t
". If the table name is not given literally it must be enclosed in double quotes. The argumentcompany.no
is a company table of which is required to be read. The argumentindex.no
is the index number on which the table has to be read. Remaining arguments are values of the key fields in respective order. If the argumentcompany.no
contains the current company number then this function is the same asREAD.TABLE
function. At least four arguments are necessary to read the table.
EXAMPLE:
read.ret = READ.TABLE.COMPANY("tccom000", 000, 1, comp)
Where 'read.ret' is defined as long and 'comp' is a field name from ascii file.
The return values for the function are: 0
: OK - read successful
1
: Error - read unsuccessful
log.mess()
- FUNCTION NAME
-
log.mess
- SYNOPSYS
-
void log.mess(string messcode, ...)
The arguments should be the same as for a normal call to the function
mess
except for the second argument ,mode
, which should be left out.
- DESCRIPTION
-
This function displays a message on the screen and logs a message in the log file. If the field Wait for <CR> with Messages is selected in these sessions:
- Import Data (Non-Regular) (daxch0223m000)
- Import Data (on a Regular Basis) (daxch0224m000)
- Export Data (Non-Regular) (daxch0233m000)
Or the function Wait for <Return> is selected in theExport Data (on a Regular Basis) (daxch0234m000) session.
do.not.log.condition()
- FUNCTION NAME
-
do.not.log.condition()
- SYNOPSIS
-
void do.not.log.condition()
- DESCRIPTION
-
This function can be used in conditions that are used on record level to decide whether a specific database action should be executed. For example: " Add Condition ". If such a condition returns false the action is not executed and the record is logged to the logfile. By calling this function before returning false, the action is still not executed, and not logged. If your condition rejects the record, it is not logged as
condition rejected
, but asskipped
. This means the number of records in the log file is reduced.Use this function when your Add Condition does the processing and always returns false.
do.not.export.record()
- DEFINE NAME
-
do.not.export.record()
- SYNOPSIS
-
do.not.export.record()
Conditions of usage: This function can only be called when exporting. It can be added to a condition that is specified in the Field Relations (export) (daxch0132s000) session. This function cannot be used when exporting based on audit.
- DESCRIPTION
-
This function prevents the record from being exported. The record is skipped. This limits the size of the exported file and improves performance of the import.
Note:- Although the record is not exported, for example not written to the ascii file, all conditions that are specified in the Relations (export) field are executed.
- The use of 'ranges' is more efficient, we recommend that you use these wherever possible.
- Skipped records can not be reprocessed. They are counted as 'skipped' in the log table and not written to the log file.