Skip to main content

Creating XML from COBOL. Is it possible to leave out groups/items in the XML?

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

When creating an XML file from a COBOL program, how would you prevent groups/items being output to the XML file?  This may be necessary when the items or groups hold no data at all.

Resolution:

Define the groups/items in the COBOL program with the COUNT IN clause, e.g.

03 Main IDENTIFIED BY "Main".

     05 A PIC X(6) IDENTIFIED BY "A_TAG" COUNT IN A-CNT.

     05 B PIC X(6) IDENTIFIED BY "B_TAG" COUNT IN B-CNT.

          07 B-ATTR PIC X(6) IDENTIFIED BY "B1_A" IS ATTRIBUTE.

          07 B-SUB PIC X(6) IDENTIFIED BY "B_SUB_TAG" COUNT IN B-SUB-CNT.

          ...

Moving 0 (zero) to the count variables wil stop the associated elements or groups being output to the XML file.

Old KB# 5820

0 replies

Be the first to reply!