dadllcommon

DLL Usage description

Library: dadllcommon

This library contains common functionality that does not belong to any other, more specific library.

Unless specified otherwise the following formats should be used for passing parameters/can be expected as return value:

table     : ppmmmnnn tablefield: ppmmmnnn.ccccccccc domain    :
ppcccccccccccc

DLL Prototypes

function extern convert.char.to.new.line(ref string text.line())
 pre  : true post : in text.line all ASCII characters 255 are replaced with new
line
       characters.
 function extern convert.new.line.to.char(ref string text.line())
 pre   : true post  : in text.line all new line characters are replaced with
ASCII
       character 255.
 function extern display.mess(const string msg())
 pre   : true post  : msg is displayed in the user_message part of the 'progress
        window'. The user_messagepart of the window can contain 72
        characters at most. desc  : see dllusage of function
display.xch.progress()
 function extern display.xch.progress(
                domain daxch.txch xch.type,
                const domain daxch.cxch xch.scheme,
                const domain daxch.cbat batch,
                domain daxch.batl batchline,
                const domain daxch.ttbl triton.table,
                const domain daxch.casf ASCII.file,
                long run.num,
                long try.num,
                const string filename(),
                long no.read,
                long no.processed,
                long no.error.rejected,
                long no.cond.rejected,
                long no.skipped)
 pre   : true post  : Information passed as parameters is displayed in a window
desc  : Window should look like:

+------------------------FFFFFFxch_typeFFFFFF-------------------+
| Exchange Scheme: FFFF  Records read                           |
| Batch          : FFFF  Records processed             : FFFF   |
|                                                               |
| Batchline      : FF    Records rejected due to errors: FFFF   |
|                                                               |
| Table   : FFFF  Records rejected due to conds.       : FFFF   |
|                                                               |
| ASCII File     : FFFF  Records skipped without action: FFFF   |
|                                                               |
| Run-/trynumber : FF/FF                                        |
|                                                               |
| File           : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF          |
|                                                               |
|           FFFFFFFFFFFFFFuser_messageFFFFFFFFFFFFFF            |
+---------------------------------------------------------------+

 function extern long domain.exists(const string domain.name())
 pre   : true return: whether <domain.name> is an existing domain
 function extern long field.exists(
                const domain daxch.ttbl table.name,
                const domain daxch.tfld field.name,
                [ ref string domain.name() ],
                [ ref long field.type ],
                [ ref long field.flag ],
                [ ref long field.depth ])
 pre   : format of field.name is without table return: whether <field.name> is
an existing field of table <table.name>
        (if it is a combined field false will be returned) post  : if true is
returned and one or more of the optional parameters
        are specified they will be given their proper value
 function extern long generate.unique.key()
 pre   : true return: a unique value is returned by this function which will
never be
        returned again.
 function extern string get.index.field.name(
                const string tble(),
                long index.no,
                long part.no )
 pre   : index.no > 0 return: the name of the <part.no>th field in index
<index.no> of table
        <tble>. IF either <tble> does not exist or <tble> does not have
        an index <index.no> or index <index.no> does not have at least
        <part.no> fields THEN the empty string is returned.
        Note that the data dictionary is read using the rdi functions,
        thus according to the current package combination of the user.
 function extern string get.separator(
                const domain daxch.cxch xch.scheme )
 pre   : true return: xch.scheme exists ==> sepa.to.sepa.char
        (daxch001.ctrl,daxch001.sepa) otherwise ==> "" state : current record of
daxch001 will not be changed
 function extern long index.exists(
                const domain daxch.ttbl table.name,
                long index.no,
                [ ref long no.parts ],
                [ ref long duplicate ] )
 pre   : true return: whether <table.name> has an index with number <index.no>.
post  : if true is returned the no.parts contains (if provided) the
        number of fields belonging to the index and duplicate,
        if provided, tells whether duplicates are allowed.
 function extern long is.index.field(
                const string tble(),
                long index.no,
                string field.name(18) fixed )
 pre   : index.no > 0 return: whether field <field.name> belongs to index
<index.no> of
        table <tble>
 function extern long is.numeric.constant(const string str())
 return: true if and only if str contains a long or float constant
        (possibly in scientific notation)
 function extern long is.text.buffer.field(const string field.name())
 pre   : true return: whether <field.name> is "tttxt010.text" or "tttxt015.text"
desc  : this function is used to determine whether the field contains
        new line characters (table field tttxt010.text usually does).
 function extern long is.text.field(const string field.name())
 pre   : true return: whether field <field.name> is a tttxt???.ctxt field
 function extern justify.and.convert.string(
                ref string string.value() mb,
                const string string.domain())
 pre   : string.domain is an existing string domain post  : string.value is:
        - justified to left, right or center
        - converted to upper or lower case
        - truncated to the domain length according to the definition of
          the domain string.domain
 function extern long language.exists(string lang(1))
 pre   : true return: whether <lang> is an existing language
 function extern string make.string.const(const string str())
 pre    : true return : str converted to a string constant as can be used in
literal
         code such as dynamic sql or generated scripts).
         For example: - double quotes (") have been placed around str
                      - double quotes within str have been replaced
                        with 2 double quotes ("")
                      - leading or trailing spaces are NOT removed
                        from str
 function extern remove.xch.progress()
 pre   : display.xch.progress() or display.mess() must have been called
       before. post  : window used by display.xch.progress and display.mess has
been
       removed.
 function extern string replace(
                domain daxch.str stri,
                const string pattern(),
                const string repl() )
 pre   : pattern <> "" return: stri with all occurences of pattern replaced with
repl return
        string should not exceed length of domain daxch.str
 function extern sepa.string.to.sepa(
                const string sepa.string(),
                ref domain daxch.yesno ctrl,
                ref domain daxch.sepa sepa )
 pre   : valid.separator.string(sepa.string) post  : if isspace(sepa.string):
ctrl = no  and sepa = ""
        if len(sepa.string) = 1: ctrl = no and sepa = sepa.string
        if len(sepa.string) = 2: ctrl = yes and sepa = sepa.string(2)
 function extern string sepa.to.sepa.char(
               domain daxch.yesno ctrl,
               domain daxch.sepa sepa )
 pre   : valid.separator(ctrl, sepa) return: if ctrl = no: sepa
        if ctrl = yes: the ASCII character for <Ctrl> sepa
 function extern long size.of(const string domain.name())
 pre   : domain.name is a domain of type string return: the length of the domain
 function extern long table.exists(const domain daxch.ttbl table.name)
 pre   : true return: whether <table.name> is an existing table.
 function extern long valid.separator(
                domain daxch.yesno ctrl,
                domain daxch.sepa sepa )
 pre:    true return: true if and only if ctrl and sepa make up a valid
separator.
        For example:- ctrl = no  and sepa not in {, 0--9, A--Z}
                    - ctrl = yes and sepa     in {A--Z, [, \, ], ^}
 function extern long valid.separator.string(const string sepa.string())
 pre   : true return: true if and only if sepa.string is a valid separator.
        For example:- isspace(sepa.string)
                    - len(sepa.string) = 1 and valid.separator
                      (no, sepa.string)
                    - len(sepa.string) = 2 and sepa.string(1;1)
                      = "^" and valid.separator (yes, sepa.string(2)