| Functions |  |
| This document describes the predefined functions that are available in the Exchange module. The following 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; however 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. So, the following example is NOT allowed: qdb.search(daxch010, 1, max(200, 300)) For that reason it is advisable to 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 will be seen as the closing character for the qdb.search() call. If however, on the following lines the qdb.search() call continues, place the comma behind it, instead of letting it be the first character on the next line: Example Wrong: qdb.search(daxch002, 1, get.xch.scheme() ascii.file) OK: qdb.search(daxch002, 1, get.xch.scheme(), ascii.file) String constants should not be used in an expression. DESCRIPTION A qdb.search function call is during generation expanded into a: db.change.order() a number of keyfield assignments a db.eq() call If it is not possible to fill all keyfields with the arguments supplied, will the remaining keyfields be emptied (with a set.min()) and will a db.ge() call be 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 should NOT be preceded by the character "t". If the table name is given literally it must be enclosed in double quotes. 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. Hence 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 are the remaining keyfields 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 it is possible to read a record from a table. This will increase the processing speed as the table will NOT be read for every record from the ascii file (like in case of READ.TABLE function). The table will be 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. Hence at least three arguments are necessary to read the table. The data will be 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 it is possible to 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 argument company.no is a company table of which is required to be read. 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. If the argument company.no contains the current company number then this function is the same as READ.TABLE function. Hence 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 in the sessions Import Data (Non-Regular) (daxch0223m000), Import Data (on a Regular Basis) (daxch0224m000), Export Data (Non-Regular) (daxch0233m000) or Export Data (on a Regular Basis) (daxch0234m000) is selected this function waits for <Return>. 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 (e.g. " Add Condition "). If such a condition returns false the action is not executed and the record will be logged to the logfile. By calling this function just before returning false, the action will still not be executed, but it will also not be logged. So if your condition rejects the record, it will not be logged as 'condition rejected', but as 'skipped'. 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 specified in daxch0132m000. 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 (i.e. not written to the ascii file), all conditions that have been specified in the field relations (export) are executed. The use of 'ranges' is more efficient, so it is advisable to use these wherever possible. Skipped records can not be reprocessed; they will be counted as 'skipped' in the log table, but they will not be written to the log file. Related topics Libraries Variables |