Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7056233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:50:35+00:00 2026-05-28T03:50:35+00:00

We are doing xml to copybook and vice versa conversions in a middleware system,

  • 0

We are doing xml to copybook and vice versa conversions in a middleware system, using IBM Websphere transformation extender. From this link
Cobol to xsd mapping
, we realised that

PIC X(03), in copybook, has to be converted to the below xml schema

<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxlength value="3"/>
<xsd:whiteSpace value="preserve"/>
</xsd:restriction>
</xsd:simpletype>

PIC 9(03), in copybook, has to be converted to the below xml schema

<xsd:simpleType>
<xsd:restriction base="xsd:unsignedInt">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="999"/>
</xsd:restriction>
</xsd:simpletype>

However, not able to make out, directly, what xml schema to be used for the below copybook types. Could anyone please guide?

PIC S9(17) COMP-3
PIC S9(17)
PIC S9(03)
PIC S9(03) COMP-3
PIC +9(17)
PIC +9(03)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:50:36+00:00Added an answer on May 28, 2026 at 3:50 am

    The best way to understand a PICTURE clause, is to consult your COBOL documentation. I’ll follow with some “documentation”.

    One thing to note is that while I consider the XSD snippets below as correct, different tools may not match exactly mine; for sure, whatever you get from your tools, should not be more restrictive than mine.

    PIC S9(17) COMP-3

    PIC S9(17)

    PIC +9(17)

    Note: COMP-3 doesn’t matter from an XSD perspective; it affects the encoding in the COBOL world.

    <xsd:simpleType name="S9-17">
        <xsd:restriction base="xsd:integer">
            <xsd:minInclusive value="-99999999999999999"/>
            <xsd:maxInclusive value="99999999999999999"/>
        </xsd:restriction>
    </xsd:simpleType>
    

    PIC S9(03)

    PIC S9(03) COMP-3

    PIC +9(03)

    <xsd:simpleType name="S9-3">
        <xsd:restriction base="xsd:int">
            <xsd:minInclusive value="-999"/>
            <xsd:maxInclusive value="999"/>
        </xsd:restriction>
    </xsd:simpleType>
    

    Your PIC 9(03) means the number as unsigned, with an implied positive value.

    A preceding S for a numeric value, S9(17) means “signed”, with up to 17 decimal digits; the value may be positive or negative. Depending on other clauses, the sign could be separate, leading or trailing.

    Things get tricky when a COMPutational clause is present, in which case data is encoded using a “binary” format (half the size, four bits per digit, the sign using the high order, left most bit) – in the COBOL world, not XML. The COMP clause (sometimes referred to as “packed”) doesn’t change the semantics of the value, it just describes the encoding mechanism, with direct impact on the size (in bytes) required to represent that particular number. For example, a PIC 9(17) will require 17 bytes, a PIC 9(17) COMP-3 will require 9 bytes. Clauses without a COMP are represented in DISPLAY format (basically one byte per decimal digit, plus one for sign, where applicable).

    A preceding + sign is much like S; indicates that a number is signed, a + will be used for positive, a – will be used for negative numbers.

    Because of this, when representing data in XML, what gets preserved is the data, not it’s representation. Consider PIC 9(03) and a value of 1.

    A COBOL to XML transform may preserve 001, or not (i.e. get 1).
    An XML to COBOL transform must be able to take 001 or 1 and correctly convert it to 001.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse XML feeds from YouTube using jQuery (by doing $(xml).find(...)
I will be doing an occiasional import from XML into core data. I have
I'm having difficulty doing this seemingly simple task. I want to load XML files
Possible Duplicate: Converting XML to JSON using Python? I'm doing some work on App
I've been doing this all the time: result = subprocess.call(['copy', '123*.xml', 'out_folder\\.', '/y']) if
I was using jQuery doing some XML work. Then jQuery told me it can't
I am now doing a html to xml xslt transformation, pretty straigh-forward. But I
I am doing an automatic mapping from XML to NSObject while parsing if the
I have an xml file that looks like this: <!DOCTYPE ROOT SYSTEM zombie.dtd> <ROOT>
Why was it decided that using XMLHTTPRequest for doing XML calls should not do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.