XML and Mixed Case



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

XML and Mixed Case

Postby dekberg » Fri Mar 16, 2012 10:48 pm

I am trying to output XML from a COBOL program and even though I define my variables as Mixed Case when the XML is created using the generate XML statement the label names are changed to all Upper Case. I have tried different compiler options with no luck.

Has anyone ran into this and know of a solution to this?

I am using IBM Enterprise COBOL for z/OS 3.4.1
dekberg
 
Posts: 8
Joined: Tue Mar 13, 2012 11:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: XML and Mixed Case

Postby Robert Sample » Fri Mar 16, 2012 11:50 pm

What is your COBOL compiler LANGUAGE option? From the COBOL Language Reference manua (emphasis added)l:
6.2.41.5 XML element name formation

In the XML documents that are generated from identifier-2, the XML element tag names are derived from the name of the data item specified by identifier-2 and from any eligible data-names that are subordinate to identifier-2 as follows:
The exact mixed-case spelling of data-names from the data description entry is retained. The spellings from any references to that data item (for example, in an OCCURS DEPENDING ON clause) are not used.
Data-names that start with a digit are prefixed by an underscore. For example, the data-name '3D' becomes XML tag name '_3D'.
| Data-names that start with the characters 'xml', in any combination of | uppercase and lowercase, are prefixed by an underscore. For example, | the data-name 'Xml' becomes XML tag name '_Xml'.
Names of data items that are found at run time to contain characters that are illegal in XML version 1.0 content are prefixed by 'hex.', and the content itself is expressed in hexadecimal.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: XML and Mixed Case

Postby dekberg » Mon Mar 19, 2012 11:28 pm

it is set to (EN). But everything for my tagnames are still changed to all uppercase.
dekberg
 
Posts: 8
Joined: Tue Mar 13, 2012 11:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: XML and Mixed Case

Postby Ed Goodman » Mon Mar 19, 2012 11:58 pm

If you look at the compiled listing for the program, are the names still mixed case? (Maybe you're pulling the wrong copybooks)

How are you looking at the generated XML? I'm thinking there may be a program in the middle somewhere being 'helpful' and converting things to uppercase. (Some terminal emulators have a "show all caps" switch buried in their settings)

Try putting some lowercase DATA in the fields and see if that is getting changed too. Also, try some DISPLAY statements immediately after the generate call. (Hard code some lower case letters in the displays to be double-sure)

It's all about isolating the problem. Chances are really good that the IBM COBOL GENERATE statement is working as designed. So there must be something else going on.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: XML and Mixed Case

Postby dekberg » Tue Mar 20, 2012 6:38 pm

In the compile listing the names are changed to upper case.

I am not using copybooks, everything is defined within my working storage.

I call a program that writes the data to a datacom program. I am also using display statements after the XML Generate statement to show the contents.

The data itself is not getting changed to uppercase and also my display statement with mixed case does not get changed to upper case. Just the variable names that XML uses as the TAGS are getting converted.
dekberg
 
Posts: 8
Joined: Tue Mar 13, 2012 11:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: XML and Mixed Case

Postby Ed Goodman » Tue Mar 20, 2012 7:20 pm

OK then, we have isolated the problem a little bit. If the listing shows the fields as upper case, then you know it's happening during the compile. You can pretty much ignore the XML workings until you figure the compile part out.

If you look at your source code, are the fields still lower case? (Nothing in your editor changed them) If you are moving the source code before the compile, check there too.

If you compile a small, simple program with mixed case field names, do they also get converted to upper? (remove all XML calls)
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: XML and Mixed Case

Postby dekberg » Tue Mar 20, 2012 7:52 pm

OK I tried a smaller program and the same thing happens. If the lower case is a comment or within quotes then it stays lower case. it seems like it is jsut my field names and keywords that get converted. I changed the Identification to lower case and it converted it to upper case also.

There are 3 steps in my compile.

the first step is the META COBOL TRANSLATOR, this listing shows everything as I have it in my program (No converting of the lower-case to upper-case)

the second step is the COBOL COMPILE step, this is where the listing shows the converting of lower to upper and it is uses the IGYCRCTL program.

the third step is the Link Edit Step.
dekberg
 
Posts: 8
Joined: Tue Mar 13, 2012 11:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: XML and Mixed Case

Postby dekberg » Tue Mar 20, 2012 9:16 pm

OK - I switched my layouts to a copybook and it works OK using it that way. But I would still think that you should be able to define it within your program and it would work the same way, (Not using copybooks).
dekberg
 
Posts: 8
Joined: Tue Mar 13, 2012 11:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: XML and Mixed Case

Postby BillyBoyo » Tue Mar 20, 2012 10:02 pm

Can you show us the compile options and the compiler version from the output listing, please. I'm not sure how using a copybook would make it different either, so it is interesting...
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: XML and Mixed Case

Postby dekberg » Wed Mar 21, 2012 5:15 pm

PP 5655-G53 IBM Enterprise COBOL for z/OS 3.4.1

Options in effect:     
    NOADATA             
    NOADV               
      APOST             
      ARITH(COMPAT)     
    NOAWO               
      BUFSIZE(4096)     
    NOCICS             
      CODEPAGE(1140)   
    NOCOMPILE(S)       
    NOCURRENCY         
      DATA(31)         
    NODATEPROC         
      DBCS             
    NODECK             
    NODIAGTRUNC         
    NODLL               
    NODUMP             
     DYNAM             
   NOEXIT               
   NOEXPORTALL         
   NOFASTSRT           
     FLAG(I,I)         
   NOFLAGSTD           
     INTDATE(LILIAN)   
     LANGUAGE(EN)       
     LIB               
     LINECOUNT(60)     
   NOLIST               
   NOMAP               
   NOMDECK             
   NONAME               
     NSYMBOL(NATIONAL) 
   NONUMBER             
     NUMPROC(NOPFD)     
     OBJECT                 
     OFFSET                 
   NOOPTIMIZE               
     OUTDD(SYSOUT)         
     PGMNAME(COMPAT)       
   NORENT                   
     RMODE(AUTO)           
   NOSEQUENCE               
     SIZE(MAX)             
     SOURCE                 
     SPACE(1)               
   NOSQL                   
   NOSSRANGE               
   NOTERM                   
   NOTEST                   
   NOTHREAD                 
     TRUNC(STD)             
    NOVBREF           
    NOWORD           
      XREF(FULL)     
      YEARWINDOW(1900) 
      ZWB               
dekberg
 
Posts: 8
Joined: Tue Mar 13, 2012 11:55 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post