[Info-vax] Weird Cobol alignment issue.
David Froble
davef at tsoft-inc.com
Tue Apr 2 12:24:16 EDT 2013
Jan-Erik Soderholm wrote:
> Envir:
> Compaq COBOL V2.8-1286
> VMS 8.2 Alpha.
>
>
> In a current project, an XML structure broke.
>
> One element of XML data looks like :
>
> ...
> <TreatmentCode>05</TreatmentCode>
> ...
>
> There are a number of XML elements with similar
> declarations before and after that one.
>
> The data declaration was first like :
>
> 05 filler pic x(15) value '<TreatmentCode>'.
> 05 mem101-xml-treat-code pic 9(2).
> 05 filler pic x(16) value '</TreatmentCode>'.
>
> This is in line with all other XML elements and
> it worked "as expected" for a months of development
> and created correct XML data.
>
> Now, suddenly this produced XML code like :
>
> ...
> <TreatmentCode05</TreatmentCode>
> ...
>
> Note the missing closing ">" before the value "05"!
>
> Currently I have to declare this specific element like :
>
> 05 filler pic x(16) value '<TreatmentCode> '.
> 05 mem101-xml-treat-code pic 9(2).
> 05 filler pic x(16) value '</TreatmentCode>'.
>
> Note the extra space character at the end of first filler!
> This produces the correct XML element, that is, the extra
> space character is not included in the XML structure. Weird...
>
> I have not tried to create a reproducer, but has anyone
> seen anything like this from the Cobol compiler?
>
> This doesn't feel particular stable, and I'm prepared to
> backout this "fix" at any moment...
>
> Jan-Erik.
>
If you want to test this, set the trailing tag to 15 length and take out
a letter.
Is this the only tag with an odd number of characters ????
More information about the Info-vax
mailing list