locked
Is there a COBOL COPYBOOK XML Serializer RRS feed

  • Question

  • I have tried to search for this using Google and the only thing I found was a COPYBOOK toolkit for Java. We need to create a serializer for COBOL Copybooks. Is there a tool/library available on the market? Or does anybody have experience on this subject?
    Give a man a fish and you feed him for a day. Teach a man to fish and you feed him a lifetime
    Thursday, January 29, 2009 1:52 PM

Answers

  • Truly, do all the COBOL vendors interface with .NET in the same way? And, if so, how would someone like me, who has never used COBOL on a PC, know what that interface is like?

    So, this is really a question for the COBOL vendor or maybe its forums. How does it permit a COPYBOOK to be passed to .NET?

    .NET obviously has no special features to support COBOL. If your COBOL has special features to support .NET, then you should use them to call the XML Serializer in the same way you use those features to call any other .NET API.


    John Saunders | Use File->New Project to create Web Service Projects
    Friday, January 30, 2009 7:33 PM
    Moderator

All replies

  • Have you asked the COBOL vendor about this?

    Are COPYBOOKs .NET objects in your COBOL (which one, by the way?)

    If they're objects, then have you tried serializing them? What happens?


    John Saunders | Use File->New Project to create Web Service Projects
    Thursday, January 29, 2009 3:27 PM
    Moderator
  • No COBOL .NET, we receive a string buffer from the mainframe through a in-house developed middleware built on top of IMS and we need a way to convert this COPYBOOK to .NET objects.
    Give a man a fish and you feed him for a day. Teach a man to fish and you feed him a lifetime
    Friday, January 30, 2009 8:32 AM
  • Since .NET doesn't even know what a COPYBOOK is, I suggest you ask your COBOL vendor.

    Also, please tell us the name of the COBOL product you are using.


    John Saunders | Use File->New Project to create Web Service Projects
    Friday, January 30, 2009 1:23 PM
    Moderator
  • It does not matter what COBOL vendor you use. A copybook is a copybook and we have it as a stream, I can't imagine that I am the only one who is trying to create a data transformation service that will convert a copybook to xml and create a copybook from xml.
    Give a man a fish and you feed him for a day. Teach a man to fish and you feed him a lifetime
    Friday, January 30, 2009 7:05 PM
  • Truly, do all the COBOL vendors interface with .NET in the same way? And, if so, how would someone like me, who has never used COBOL on a PC, know what that interface is like?

    So, this is really a question for the COBOL vendor or maybe its forums. How does it permit a COPYBOOK to be passed to .NET?

    .NET obviously has no special features to support COBOL. If your COBOL has special features to support .NET, then you should use them to call the XML Serializer in the same way you use those features to call any other .NET API.


    John Saunders | Use File->New Project to create Web Service Projects
    Friday, January 30, 2009 7:33 PM
    Moderator
  • This is like asking the World Wide Web Consortium for a XML serializer if it would not yet exist in the Base Class Library. A COBOL Copybook is nothing more than a COBOL Copybook and it does not mather where the Copybook comes from. It is just a data structure and I need a tool that will either create .NET types from the Copybook (similar to xsd.exe) or I need a way to convert it to an XSD so that I can use XSD to generate the .NET types.
    Give a man a fish and you feed him for a day. Teach a man to fish and you feed him a lifetime
    Saturday, February 14, 2009 12:50 PM
  • .NET already has an XML Serializer that works on objects. What happens if you try to use it on a COPYBOOK?
    John Saunders | Use File->New Project to create Web Service Projects
    Saturday, February 14, 2009 12:57 PM
    Moderator
  • John,

    I was wondering if you guys made any progress in finding a method to generate XSD for a copybook definitions? Please let me know if any? Because i am handling a Biztalk application where i have around 180 copybook definition files and i have to create XSD for each of these files or the only other alternative left as i know is to manually map these files which i dont want to do. So, please do let me know the information that you have. thanks.
    Sravan Kasyap
    Tuesday, June 16, 2009 3:34 PM
  • I'm sorry, I don't understand. Why would there have been any progress in updating the XML Serializer (stagnant code that's nearly obsolete) to work with COBOL (same?) from a third-party vendor?

    Now, I started my career, way back in 1975, working on COBOL, so I know what a COPYBOOK is (though I always thought that was a stupid word, and never used it). But I still have no idea what's so special about them that prevents you from just using XSD.EXE to generate schemas. Do you know?
    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of old ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects
    Tuesday, June 16, 2009 3:40 PM
    Moderator
  • I'm sorry, I don't understand. Why would there have been any progress in updating the XML Serializer (stagnant code that's nearly obsolete) to work with COBOL (same?) from a third-party vendor?

    Now, I started my career, way back in 1975, working on COBOL, so I know what a COPYBOOK is (though I always thought that was a stupid word, and never used it). But I still have no idea what's so special about them that prevents you from just using XSD.EXE to generate schemas. Do you know?
    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of old ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects

    HI

    I am working on a similar issue converting cobol copy book to xml. Did you resolve your issue? what was your solution.
    Tuesday, July 7, 2009 1:41 PM
  • Ravi, none of the previous participants in this issue were willing to work with me on it. They seemed to just assume that somehow .NET should support COBOL, and not the other way around. Can you answer some questions?

  • Which COBOL are you using, which version, and from which vendor?
  • Have you tried to use the normal .NET XmlSerializer? What problems have you had?
  • Does your COBOL allow you to access the .NET Framework?
  • Can you create a test program with just a tiny COPYBOOK (maybe just 01 TESTING PIC X(1))? I'd like the program to display the output of running TESTING.GetType().ToString() (whatever the correct .NET syntax would be for this).
  • This will help a lot.


    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of old ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects
Tuesday, July 7, 2009 2:04 PM
Moderator
  • I can see a bit of confusion in here. I believe that the original request was simply looking for functionality similar to the one found in vendor products like IBM Rational. There, a J2C wizard (e.g. "CICS/IMS Java Data Binding") has the ability to generate Java classes ("beans") capable of reading/writing data buffers (byte arrays), from a data division copybook (typically a *.cpy file). From what I know, there is no free product for the .NET platform. There are a few freely available in the Java space, but they typically tend to have some problems with encoding/decoding packed decimals, computational, etc. The complexity of the copybook (type of PIC clauses, use of REDEFINES, etc.), the generality of what one wants to build, read (flat->XML) or read/write (flat<->XML) and performance requirements are main factors in how easy would be to implement it. In retrospect, for anything other than trivial scenarios, I would rather go with something commercial. How I did it myself: flat->XML: 1) the copybook (CPY file) is parsed out as an XML file (to extract metadata like offsets based on storage required for each field, redefines, occurs, etc.) 2) a code generation utility takes the XML metadata and generates one or more CS classes. The generator was built on knowledge gained by looking at an XML Schema automatically generated from XML metadata. 2.1)XMLElementAttributes are used to facilitate marshalling to XML. 2.2) There’s no parsing, it works in a pull model. A value is determined only when the get_XXX is called, by using the offset and the storage length for that field. For the numeric PIC clauses, I've used an in-house library to un/marshall bytes<->numbers. 2.3) If I serialize to XML, there's a performance hit, since all of the fields are actually pulled. XML->flat 3) All the set_XXX are marshalling the value at the appropriate offset. The default constructor allocates a buffer with the length determined in step 1). There's a problem here related to support of multiple encodings at the same time, but that's too rare to talk about it here. One other approach, if you have licensed IBM tooling or find a free library, and requirements allow for, is to use the actual generated Java classes from .NET via IKVM, the OpenJDK class library for .NET. It'll work, since all the code involved for this type of functionality is really trivial.
    Thursday, August 27, 2009 12:03 AM
  • Thank you very much for helping to make sense out of this request. It has been frustrating to me that I haven't been able to help - I started my career developing in COBOL, and was able to guess what a COPYBOOK must be, even though we didn't call them that. I could not understand the assumption that there is only one format for a COPYBOOK, and that .NET should have had some special serializer for it.

    If you don't mind answering, could you find out the exact name, or names, of the IBM product that has the J2C wizard? If you have links to online documentation for it, that would be great. Also, if you have any links to the format of a *.cpy file, that also would be good.

    Can you say what COBOL product you're using, and what version?

    Also, if you feel there are any areas where .NET does not meet the needs of COBOL developers, then you've found someone to listen to you.



    John Saunders
    WCF is Web Services. They are not two separate things.
    Use WCF for All New Web Service Development, instead of legacy ASMX or obsolete WSE
    Use File->New Project to create Web Service Projects
    Thursday, August 27, 2009 3:33 AM
    Moderator
  • Some information about J2C tooling (which includes the one I was referencing above) can be found at http://www-01.ibm.com/support/docview.wss?uid=swg24010035 . It is not for the latest version of RAD, but I would say differences are not significant.
    The application I was referring to worked with systems developed with ILE COBOL on AS/400 and IBM COBOL on OS/390, with messages exchanged using WebSphere MQ and IMSConnect.
    For my research I've used printed Microfocus COBOL documentation years ago; a quick search online looks promising: http://docs.hp.com/cgi-bin/doc3k/BB243390047.15064/1 .
    An excerpt of a sample I use for demos follows (the formatting is odd, I could share it with you out of band if you want). 

    * Sample data structure for QTAssistant demos.
    01 SAMPLE-TRANSACTION.
        05 SAMPLE-LENGTH PIC S9(4) COMP.
        05 SAMPLE-FILLER1 PIC XX VALUE LOW-VALUES.
        05 SAMPLE-HEADER.
            10 SAMPLE-HDR-LENGTH PIC X.
            10 SAMPLE-MESSAGE-TYPE PIC X.
            10 SAMPLE-LAST-PAGE PIC X.
            10 SAMPLE-DUMMY-DATA PIC XX.
            10 SAMPLE-ECHO REDEFINES SAMPLE-DUMMY-DATA PIC S9(4) COMP.
        05 SAMPLE-REPLY-DATA PIC X(200).
        05 SAMPLE-ERROR-REPLY REDEFINES SAMPLE-REPLY-DATA.
            10 SAMPLE-ERRORCODE PIC S9(5) COMP-3.
    

    The Microsoft Host Integration Server has a lot of documentation which could be used to help understand many general technical aspects of integration with legacy hosts. There are articles, too (a quick sample here: http://msdn.microsoft.com/en-us/magazine/cc163294.aspx ).



    Saturday, August 29, 2009 2:52 AM
  • XML Thunder is a bidirectional XML-COBOL development tool by Canam Software Labs, Inc. It generates fully portable COBOL or C source code to serialize or de-serialize XML in COBOL or C. Version 4 is coming out this fall. More information can be found at www.xmlthunder.com. Please let me know if you have specific questions. All the best.
    Saturday, September 26, 2009 1:36 PM