Skip to main content

Does anyone have an XML GENERATE example where the "NAME" and "TYPE" phrases compile (ACUCOBOL)?

  • January 23, 2020
  • 7 replies
  • 0 views

I have managed to generate an XML file using the XML GENERATE statement but for some reason when I try use the NAME or TYPE phrases, the program doesn't compile.  I get an "Verb expected, NAME found" error.  Am I missing a copycode or definition?  Or do these only work on mainframe?

7 replies

Stephen Hjerpe
  • Participating Frequently
  • January 23, 2020

I have managed to generate an XML file using the XML GENERATE statement but for some reason when I try use the NAME or TYPE phrases, the program doesn't compile.  I get an "Verb expected, NAME found" error.  Am I missing a copycode or definition?  Or do these only work on mainframe?

Can you provide the XML GENERATE statement that you are attempting to use?


  • January 24, 2020

Can you provide the XML GENERATE statement that you are attempting to use?

Variable definition:

01 EDMS-REC-TEMP PIC X(5000).
01 CNT-TMP PIC 9(4).

01 ADASystem.
      02 Document.
             05 Fields.
                   10 F_POLICY_NO                     PIC X(20).
                   10 F_ID_PASSPORT               PIC X(20).
                   10 F_MEMBER_ID                    PIC 9(6).
                   10 F_FIRST_NAME                  PIC X(100).
                   10 F_MIDDLE_NAME              PIC X(100).
                   10 F_LAST_NAME                   PIC X(100).

 01 XML-DECLARATION
       VALUE '<?xml version="1.0" encoding="iso-8859-8"?>'          PIC X(43).

 

XML GENERATE EDMS-REC-TEMP FROM ADASystem
           COUNT IN CNT-TMP.

STRING XML-DECLARATION DELIMITED BY SIZE,
                 EDMS-REC-TEMP
                 DELIMITED BY ' '
                 INTO EDMS-REC-DISK
                 WITH POINTER TXT-LEN.

WRITE EDMS-REC-DISK.

This works great but I have to hard-code and string the declaration in as the "WITH XML-DECLARATION" clause doesn't compile. 

The XML generated looks like this:

But I wanted to try use the NAME and TYPE statements in order to achieve this:

Would this be possible?

 


Stephen Hjerpe
  • Participating Frequently
  • January 24, 2020

Variable definition:

01 EDMS-REC-TEMP PIC X(5000).
01 CNT-TMP PIC 9(4).

01 ADASystem.
      02 Document.
             05 Fields.
                   10 F_POLICY_NO                     PIC X(20).
                   10 F_ID_PASSPORT               PIC X(20).
                   10 F_MEMBER_ID                    PIC 9(6).
                   10 F_FIRST_NAME                  PIC X(100).
                   10 F_MIDDLE_NAME              PIC X(100).
                   10 F_LAST_NAME                   PIC X(100).

 01 XML-DECLARATION
       VALUE '<?xml version="1.0" encoding="iso-8859-8"?>'          PIC X(43).

 

XML GENERATE EDMS-REC-TEMP FROM ADASystem
           COUNT IN CNT-TMP.

STRING XML-DECLARATION DELIMITED BY SIZE,
                 EDMS-REC-TEMP
                 DELIMITED BY ' '
                 INTO EDMS-REC-DISK
                 WITH POINTER TXT-LEN.

WRITE EDMS-REC-DISK.

This works great but I have to hard-code and string the declaration in as the "WITH XML-DECLARATION" clause doesn't compile. 

The XML generated looks like this:

But I wanted to try use the NAME and TYPE statements in order to achieve this:

Would this be possible?

 

NAME isn't a reserved word, you could compile using  -Rw TYPE  and see if that helps.

 


  • January 31, 2020

NAME isn't a reserved word, you could compile using  -Rw TYPE  and see if that helps.

 

I am not able to change the compile config.

Does this mean that the XML GENERATE does not work in ACUCOBOL?  As I am unable to specify element names and types.


Stephen Hjerpe
  • Participating Frequently
  • January 31, 2020

I am not able to change the compile config.

Does this mean that the XML GENERATE does not work in ACUCOBOL?  As I am unable to specify element names and types.

The original post showed that compiling using  F_POLICY_NO  did work. I cannot think of how to make an FD where you use FIELD NAME=" F_POLICY_NO"

 


Martin Turner

I am not able to change the compile config.

Does this mean that the XML GENERATE does not work in ACUCOBOL?  As I am unable to specify element names and types.

I'm sure you could transform the output using XSLT. There are plenty of guides online on how to use XSLT.


  • February 5, 2020

I'm sure you could transform the output using XSLT. There are plenty of guides online on how to use XSLT.

Thank you so much for the feedback.  I will try get it working using C$XML rather.  The XML GENERATE is such a nifty tool, it would've been great if I could've got it to work.

For info, this is what I was referring to wrt the NAME and TYPE statements:

This was from the IBM docs (https://www.ibm.com/support/knowledgecenter/en/SS6SG3_6.2.0/lr/ref/rlpsxmlg.html)

Thanks again for your assistance.