Skip to main content

Problem:

When running a COBOL program with working storage defined as: 30* test structure with mixed case. 31* 32 01 XML-str. 33 05 XML-nbr-comp pic 9(03) value 111. 34 05 XML-nbr-fund pic 9(05) value 22222. 35 05 XML-nbr-acct pic 9(15) value 333333333333333. The procedure division XML code OPEN OUTPUT OUTFILE. 46 XML GENERATE WS-XML-BUFFER 47 FROM XML-str 48 COUNT IN WS-XML-CNT 50 WRITE OUTFILE-REC FROM WS-XML-BUFFER The problem is that the output tags are all uppercase, rather than mixed case <XML-STR><XML-NBR-COMP>111</XML-NBR-COMP><XML-NBR-FUND>22222</XML-NBR-FUND><XML-NBR-ACCT>333333333333333</XML-NBR-ACCT></XML-STR> The problem is that their web service programs are looking for mixed case.

Resolution:

If you are using the directive DIALECT(ENTCOBOL) then it should work okay. However you are using the default dialect, then you need to specify the PRESERVECASE directive. These directives are not documented, but will be in a future release. To preserve the case of data names when XML tags are generated with XML GENERATE it is necessary to use the PRESERVECASE compiler directive, i.e. $SET PRESERVECASE This directive is not documented in Server Express 5.0 but should be documented in Server Express 5.1. After setting PRESERVECASE, the contents of myXML in the example above would be: "<myItem1><myItem2>my value</myItem1></myItem2>

Old KB# 2204