Question

I am working with a Java webservice hosted on Mainframe for which, we are generating copybook files. I have an XSD with a complextype containing string fields. I want to specify the length of the string field to 1024. Currently, it is generating an element of type PIC X(255) which is 255 characters long. How can I get around changing that to 1024?

Complex type:

<xs:complexType name="GetPatientResponse">
    <xs:sequence>
        <xs:element minOccurs="1" name="message" type="xs:string"/>
    </xs:sequence>
</xs:complexType>

Generated copybook:

protected static StringField MESSAGE factory.getStringField(255);

Unfortunately, the rest of the code is in a secure network from where I am not allowed to copy it out. Any help is appreciated. Thanks!

EDIT: I tried out the solutions suggested and it works. But the text now contains a lot of whitespace. Sorry for not mentioning this before - I was the string to be between 0 - 1024 characters. I tried just maxLength but it is throwing LENGTH_TOO_LONG CICS error for me. Please let me know if more info is needed to suggest a solution. Thanks!

Was it helpful?

Solution 2

This is what you will need.

<xs:complexType name="GetPatientResponse">
  <xs:sequence>
    <xs:element name="message" minOccurs="1">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:maxLength value="1024" />
          <xs:minLength value="1024" />
        </xs:restriction>
      </xs:simpleType>
    </xs:element>
  </xs:sequence>
</xs:complexType>

OTHER TIPS

Add the attributes minLength="1024" and maxLength="1024".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top