Long Strings

Hi, guys

I'm using a dll to get a xml string from a Web Service. I don't know what size has this string, but I need to store it in a cobol variable or in a file, to parse it later.

I don't want to use something like:this:

77  XML-STRING pic x(5000000)

My code:

CREATE "@Manager"
                  NAMESPACE   IS "Manager"
                  CLASS-NAME  IS "ManagerHelper"
                  CONSTRUCTOR IS CONSTRUCTOR1 (

                                                                                    M-URL,
                                                                                    M-PROPERTY,
                                                                                    M-USER-ID,
                                                                                    M-USER-PW
                                                                                   )
                  HANDLE      IS API-M.
                  MODIFY API-M "GetPendingData" (M-PROPERTY)
                                GIVING XML-STRING.

The method 'GetPendingData' returns the xml string that I need to store.

Can you help me!!!!

Thanks

  • I want to address your statement "to parse it later."  

    Rather than parse the XML data, I would encourage using XML Extensions to import the data into a COBOL data  structure.  See A Guide to Interoperating with ACUCOBOL-GT, Sections 11.2.7 through 11.2.9.

    If you were to use RMNet to invoke your web service, you could use the tutorial found here to guide your development.  But perhaps you don' have that choice...

  • Use C$XML to parse the string, then write it to a file name

                   MOVE "somefile.xml" to xml-file-name.

    *        Create a new parser and load it up with the request XML.

                  CALL "C$XML" USING CXML-PARSE-STRING, XML-STRING

                  MOVE RETURN-CODE              TO XML-FILE-HANDLE

    *        Write the XML to the file.

                  CALL "C$XML"

                      USING CXML-WRITE-FILE, XML-FILE-HANDLE, XML-FILE-NAME

         *        Release the parser.

                  CALL "C$XML"

                      USING CXML-RELEASE-PARSER, XML-FILE-HANDLE

  • Hi both,

    I receive a long string when I call the .NET Assembly:

    MODIFY API-M "GetPendingData" (M-PROPERTY)

                                   GIVING XML-STRING

    But I don't know how to define this variable in COBOL.(xml-string).

    I checked the documentation that you refer, but I have found nothing about sending or receiving strings using .Net Assemblies

    Kind regards

  • I don't think there is a way in COBOL to define an unbound string.  If you have control over the .dll, you may want to write it out from there.