Highlighted
Regular Contributor.
Regular Contributor.
296 views

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

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?

0 Likes
7 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Does anyone have an XML GENERATE example where the "NAME" and "TYPE" phrases

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

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: Does anyone have an XML GENERATE example where the "NAME" and "TYPE" phrases

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:

nataliemac_0-1579847485346.png

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

nataliemac_1-1579848768965.png

Would this be possible?

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Does anyone have an XML GENERATE example where the "NAME" and "TYPE" phrases

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

 

0 Likes
Highlighted
Regular Contributor.
Regular Contributor.

Re: Does anyone have an XML GENERATE example where the "NAME" and "TYPE" phrases

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.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Does anyone have an XML GENERATE example where the "NAME" and "TYPE" phrases

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"

 

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Does anyone have an XML GENERATE example where the "NAME" and "TYPE" phrases

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

---
Martin Turner
Product Support Engineer
Micro Focus
Highlighted
Regular Contributor.
Regular Contributor.

Re: Does anyone have an XML GENERATE example where the "NAME" and "TYPE" phrases

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:

nataliemac_1-1580893821743.png

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.

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.