|
Rules definition |
|
|
Once the converter has been generated, the programmer must code the rules to choose the correct structure and branches for those files that requires it. These rules must be coded in COBOL and stored in a copybook that is automatically referenced, with a COPY statement, at generation time by xmlconverter. With this code the programmer must identify each record and instructs the converter on which structure to use and, within the structure itself, which branch to follow. The programmer code is invoked for each record red, and it must identify the structure to use and, within the structure itself, which branch to follow. Of course if only one record structure is defined or if there are no redefines branches there is no need to identify them. The field RECORD-TYPE identifies the structure to use: the programmer must set this filed to the correct structure number (starting from zero). Each redefines branch is identified by a field name RDFBRCH-field where field is a the redefined field name. Its value must be set to the corresponding branch to use (starting from zero). To simplify programmer's life, xmlconverter may generate a skeleton for the rules copybook: the programmer will only have to define the recognization code. Remember that, for EBCDIC to ASCII conversions, the content of the record red is code in EBCDIC. Rules samples Multiple structure without critical redefines The source copybook (employee.cpy): 01 EMPLOYEE.
The copybook after structure manual separation (employee_split.cpy): 01 EMPLOYEE-1.
Commands: # cpy2xml -o employee.xml employee_split.cpy
The rules copybook (employee_rules.cpy) obtained editing manually (bold text) the template generated by xmlconverter: *
Single structure with critical redefines The source copybook (employee.cpy): 01 EMPLOYEE.
Commands: # cpy2xml -o employee.xml employee.cpy
The rules copybook (employee_rules.cpy) obtained editing manually (bold text) the template generated by xmlconverter:
EVALUATE TRUE
Multiple structure with critical redefines The source copybook (employee.cpy): 01 EMPLOYEE.
The copybook after structure manual separation (employee_split.cpy): 01 EMPLOYEE-1. Commands: # cpy2xml -o employee.xml employee_split.cpy
The rules copybook (employee_rules.cpy) obtained editing manually (bold text) the template generated by xmlconverter:
EVALUATE TRUE
|