ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » Mainframe, CICS, TXSeries » Generating XML using Enterprise COBOL

Post new topic  Reply to topic
 Generating XML using Enterprise COBOL « View previous topic :: View next topic » 
Author Message
coderunner
PostPosted: Tue Mar 06, 2007 9:09 am    Post subject: Generating XML using Enterprise COBOL Reply with quote

Newbie

Joined: 21 Feb 2007
Posts: 7

We have recently installed Enterprise COBOL for z/OS and I have been investigating the XML PARSE and XML GENERATE commands that are available in this version of the language. Whilst I have been able to use the XML PARSE command successfully, I have not been able to get the XML GENERATE command to work, even on a very basic piece of data. I've read the Programming Guide over and over but am at a loss. The XML-CODE (s) being returned by the command are 0175114392 (or similar) which are outside the range of documented values.

Has anybody any ideas?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 06, 2007 10:06 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I guess more specific information would be helpful to someone. Not me, as I wouldn't begin to be able to do XML in COBOL, nor want to, and I'm not a mainframe person.

Can you show the sample data, the COBOL that calls XML GENERATE and maybe the JCL?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Mar 06, 2007 11:33 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

I know we use it and it works OK, must be something wrong with your setup somewhere.
Back to top
View user's profile Send private message
cschneid
PostPosted: Wed Mar 07, 2007 8:46 am    Post subject: Reply with quote

Novice

Joined: 22 Mar 2005
Posts: 13

This works, compiled with Enterprise COBOL 3.4.0 on z/OS 1.7.

Code:

       Identification Division.
       Program-ID.    XMLTEST0.
      *
      *
       Environment Division.
       Data Division.
       Working-Storage Section.

       01  CONSTANTS.
           05  MYNAME                  PIC X(008) VALUE 'XMLTEST0'.
           05  ABND-DUMP               PIC 9(008) COMP-5 VALUE 1.

       01  WORK-AREAS.
           05  ABND-CD                 PIC 9(008)  COMP-5 VALUE 0.
           05  NB-XML-BYTES            PIC 9(008)  COMP-5 VALUE 0.
           05  XML-CODE-OUT            PIC -9(010) VALUE ZEROES.
      *
      *    This structure will have XML generated for it.
      *
           05  MyRecord.
               10  KeyField01 PIC X(014).
               10  AssociatedValues.
                   20  AssociatedValueType PIC X(008).
                   20  AssociatedValueDate PIC X(008).
                   20  AssociatedValue01   PIC X(010).
                   20  AssociatedValue02   PIC X(010).
                   20  AssociatedValue03   PIC X(010).

      *
      *    This is the final destination of the XML output.
      *
       01  FINAL-XMLIZED-DATA.
           05  OCCURS 2000 PIC X(050).

      *
      *    The following 01 level is used in dumping storage so you
      *    can see the results.
      *
       01  LOCAL-APLC-DEBUG-AREA.
           05  CEE3DMP-TITL.
               10                       PIC X(010) VALUE '+=+=+=+=+='.
               10  CEE3DMP-TITL-SPFC    PIC X(060) VALUE SPACES.
               10                       PIC X(010) VALUE '+=+=+=+=+='.
           05  CEE3DMP-OPTIONS          PIC X(255)
               VALUE                                       'NOTRACEBACK
      -                                                'THREAD(CURRENT)
      -                                                      'VARIABLES
      -                                                       'NOBLOCKS
      -                                                      'NOSTORAGE
      -                                                  'STACKFRAME(0)
      -                                                   'PAGESIZE(60)
      -                                                    'NOCONDITION
      -                                                        'NOENTRY
      -                                               'ENCLAVE(CURRENT)
      -                                                     'REGSTOR(0)
      -                                                  'NOGENOPTS '.

       Procedure Division.

           MOVE 'AEIOU123456789' TO KeyField01
           MOVE FUNCTION CURRENT-DATE(1:8) TO AssociatedValueDate
           MOVE 'TYPE0001' TO AssociatedValueType
           MOVE '123' TO AssociatedValue01
           MOVE '456' TO AssociatedValue02
           MOVE '789' TO AssociatedValue03

           MOVE 1 TO ABND-CD
           XML GENERATE FINAL-XMLIZED-DATA
               FROM MyRecord
               COUNT IN NB-XML-BYTES
               ON EXCEPTION PERFORM 9010-XML-GEN-ERR
           END-XML

           MOVE 'State Dump at end of Processing'
             TO CEE3DMP-TITL-SPFC

           CALL 'CEE3DMP' USING
               CEE3DMP-TITL
               CEE3DMP-OPTIONS
               OMITTED
           END-CALL

           MOVE 0 TO RETURN-CODE
           GOBACK
           .


       9010-XML-GEN-ERR.
      *    An XML GENERATE went bad
           MOVE XML-CODE TO XML-CODE-OUT
           DISPLAY
             MYNAME
             ' XML GENERATE error'
             ' XML-CODE = '
             XML-CODE-OUT

           PERFORM 9999-ABEND
           .

       9999-ABEND.
      *    Abend routine in case something bad happens
           CALL 'CEE3ABD' USING
               ABND-CD
               ABND-DUMP
           END-CALL
           .

Back to top
View user's profile Send private message
coderunner
PostPosted: Thu Mar 08, 2007 4:08 am    Post subject: Problem Resolved Reply with quote

Newbie

Joined: 21 Feb 2007
Posts: 7

Thanks for your replies. The problem was caused by the JCL used to run the program using the runtime library for our previous version of COBOL instead of the Enterprise version. Doh!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » Mainframe, CICS, TXSeries » Generating XML using Enterprise COBOL
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.