Skip to main content
I am trying to generate XML from cobol code. When I use 'identified by' in the code I am getting compiler error - "IDENTIFIED" was invalid.
01  myXML.
  03  NAM1  identified by "MY_NAME".
So I tried adding compiler extension as follows.
$SET PREPROCESS(PREXML) ENDP
 ID DIVISION.
 PROGRAM-ID. XMLCOBT.
But this is also giving me compiler errors.
A character other than "*", "D", "/" or "-" was found in column 7
"SET" should not begin in area "A".  It was processed as if found in area "B".
"SET" was invalid.  Scanning was resumed at the next area "A" item,
 
Could you advise what is wrong here. How should I code so that I can use 'identified by' clause for my xml.
I am trying to generate XML from cobol code. When I use 'identified by' in the code I am getting compiler error - "IDENTIFIED" was invalid.
01  myXML.
  03  NAM1  identified by "MY_NAME".
So I tried adding compiler extension as follows.
$SET PREPROCESS(PREXML) ENDP
 ID DIVISION.
 PROGRAM-ID. XMLCOBT.
But this is also giving me compiler errors.
A character other than "*", "D", "/" or "-" was found in column 7
"SET" should not begin in area "A".  It was processed as if found in area "B".
"SET" was invalid.  Scanning was resumed at the next area "A" item,
 
Could you advise what is wrong here. How should I code so that I can use 'identified by' clause for my xml.

The following complete program works for me:

$SET PREPROCESS(PREXML) ENDP
   ID DIVISION.
   PROGRAM-ID. XMLCOBT.
   environment division.
         select xml-file assign to "myxml.xml"
                                organization is xml
                                file status is xml-status.
   data division.
   file section.
   xd xml-file.
   01 myXML.
        03 NAM1 pic x(5) identified by "MY_NAME".
   working-storage section.
   01 xml-status pic s9(9).
   procedure division.

       open output xml-file
       if xml-status not = 0
           display "error"
       end-if
       move "test" to nam1
       write myXML
       if xml-status not = 0
          display "error"
       end-if
       close xml-file
       goback.


The following complete program works for me:

$SET PREPROCESS(PREXML) ENDP
   ID DIVISION.
   PROGRAM-ID. XMLCOBT.
   environment division.
         select xml-file assign to "myxml.xml"
                                organization is xml
                                file status is xml-status.
   data division.
   file section.
   xd xml-file.
   01 myXML.
        03 NAM1 pic x(5) identified by "MY_NAME".
   working-storage section.
   01 xml-status pic s9(9).
   procedure division.

       open output xml-file
       if xml-status not = 0
           display "error"
       end-if
       move "test" to nam1
       write myXML
       if xml-status not = 0
          display "error"
       end-if
       close xml-file
       goback.

Should I make any changes in the compiler JCL. Why my compiler is not detecting identified by and $SET? 


Should I make any changes in the compiler JCL. Why my compiler is not detecting identified by and $SET? 

What product and version number are you using to compile?
What does your compile command look like?
Do you have tabs in your source code that may be moving your source code lines to an invalid column?


I am trying to generate XML from cobol code. When I use 'identified by' in the code I am getting compiler error - "IDENTIFIED" was invalid.
01  myXML.
  03  NAM1  identified by "MY_NAME".
So I tried adding compiler extension as follows.
$SET PREPROCESS(PREXML) ENDP
 ID DIVISION.
 PROGRAM-ID. XMLCOBT.
But this is also giving me compiler errors.
A character other than "*", "D", "/" or "-" was found in column 7
"SET" should not begin in area "A".  It was processed as if found in area "B".
"SET" was invalid.  Scanning was resumed at the next area "A" item,
 
Could you advise what is wrong here. How should I code so that I can use 'identified by' clause for my xml.

Hi 

Your error code is clearly saying that u have coded the set command in area A(col 1-7) generally we use col 7 for comment.

Just start writing ur set command from 8th col.


Hi 

Your error code is clearly saying that u have coded the set command in area A(col 1-7) generally we use col 7 for comment.

Just start writing ur set command from 8th col.

The $SET should start in Column 7.
If you are setting the DIALECT directive to one of the mainframe dialects, like Enterprise COBOL, for example then this XML preprocessor will not work. You could use the XML PARSE and XML GENERATE statements instead which are supported by that dialect.

Are you setting the DIALECT directive?


The $SET should start in Column 7.
If you are setting the DIALECT directive to one of the mainframe dialects, like Enterprise COBOL, for example then this XML preprocessor will not work. You could use the XML PARSE and XML GENERATE statements instead which are supported by that dialect.

Are you setting the DIALECT directive?

We are using Enterprise Cobol. I am actually using XML Generate to create my XML from a copybook. But the issue is I have some special characters in my xml tags like 'com.scweb_PropRequest'.  So I need to use identified by for such tags. Also some tags are repeating. As cobol will not take same variable name for different tags here also I need to use identified by. In that case if XML preprocessor won't work with enterprise cobol then how can I define my tags with special characters and also repeating tags?

Thanks a lot for your time and advise.


We are using Enterprise Cobol. I am actually using XML Generate to create my XML from a copybook. But the issue is I have some special characters in my xml tags like 'com.scweb_PropRequest'.  So I need to use identified by for such tags. Also some tags are repeating. As cobol will not take same variable name for different tags here also I need to use identified by. In that case if XML preprocessor won't work with enterprise cobol then how can I define my tags with special characters and also repeating tags?

Thanks a lot for your time and advise.

You can do this using XML GENERATE using the NAME phrase:

01 bert.
     03    x1 pic x value 'z'.

01 fred pic x(200).

 01 c1 pic 99.

       xml generate fred from bert count in c1
            name of x1 is 'com.scweb_PropRequest'       

       display fred(1:c1)


You can do this using XML GENERATE using the NAME phrase:

01 bert.
     03    x1 pic x value 'z'.

01 fred pic x(200).

 01 c1 pic 99.

       xml generate fred from bert count in c1
            name of x1 is 'com.scweb_PropRequest'       

       display fred(1:c1)

I tried this. But now I am getting 'Name is invalid' as compiler error


I tried this. But now I am getting 'Name is invalid' as compiler error

What product and version are you using and on which platform?
What compiler options are you using?

The example that I posted works fine under Visual COBOL 6.0 with the dialect"ENTCOBOL" directive turned on.


What product and version are you using and on which platform?
What compiler options are you using?

The example that I posted works fine under Visual COBOL 6.0 with the dialect"ENTCOBOL" directive turned on.

I am using IBM Enterprise COBOL for z/OS  4.2.0

Options in effect:
NOADATA
ADV
APOST
ARITH(COMPAT)
NOAWO
NOBLOCK0
BUFSIZE(4096)
NOCICS
CODEPAGE(1140)
NOCOMPILE(S)
NOCURRENCY
DATA(24)
NODATEPROC
DBCS
NODECK
NODIAGTRUNC
NODLL
NODUMP
DYNAM
NOEXIT
NOEXPORTALL
NOFASTSRT
FLAG(I,I)
NOFLAGMIG4
NOFLAGSTD
INTDATE(ANSI)
LANGUAGE(EN)
LIB
LINECOUNT(60)
NOLIST
MAP
NOMDECK
NONAME
NSYMBOL(NATIONAL)
NONUMBER
NUMPROC(MIG)
OBJECT

OFFSET
NOOPTIMIZE
OUTDD(SYSOUT)
PGMNAME(COMPAT)
RENT
RMODE(AUTO)
NOSEQUENCE
SIZE(MAX)
SOURCE
SPACE(1)
NOSQL
SQLCCSID
NOSSRANGE
NOTERM
NOTEST
NOTHREAD
TRUNC(OPT)
NOVBREF

NOWORD
XMLPARSE(XMLSS)
XREF(FULL)
NOZONECHECK
YEARWINDOW(1900)


I am using IBM Enterprise COBOL for z/OS  4.2.0

Options in effect:
NOADATA
ADV
APOST
ARITH(COMPAT)
NOAWO
NOBLOCK0
BUFSIZE(4096)
NOCICS
CODEPAGE(1140)
NOCOMPILE(S)
NOCURRENCY
DATA(24)
NODATEPROC
DBCS
NODECK
NODIAGTRUNC
NODLL
NODUMP
DYNAM
NOEXIT
NOEXPORTALL
NOFASTSRT
FLAG(I,I)
NOFLAGMIG4
NOFLAGSTD
INTDATE(ANSI)
LANGUAGE(EN)
LIB
LINECOUNT(60)
NOLIST
MAP
NOMDECK
NONAME
NSYMBOL(NATIONAL)
NONUMBER
NUMPROC(MIG)
OBJECT

OFFSET
NOOPTIMIZE
OUTDD(SYSOUT)
PGMNAME(COMPAT)
RENT
RMODE(AUTO)
NOSEQUENCE
SIZE(MAX)
SOURCE
SPACE(1)
NOSQL
SQLCCSID
NOSSRANGE
NOTERM
NOTEST
NOTHREAD
TRUNC(OPT)
NOVBREF

NOWORD
XMLPARSE(XMLSS)
XREF(FULL)
NOZONECHECK
YEARWINDOW(1900)

Some of these directives are not supported in Micro Focus COBOL. Are you actually using the IBM Enterprise COBOL for z/OS  4.2.0 compiler and not one of the Micro Focus products? 

If you are then you should be asking these questions of IBM and not in this forum.

Thanks.