MF 

XML Syntax - SELECT Clause

This extended version of the SELECT clause assigns a filename to an XML stream.

Format


XML Syntax - SELECT clause

Syntax Rules:

  1. File-name-1 is the name of the file that contains the XML stream.
  2. LINE ADVANCING specifies that line feeds are included in the output.
  3. NOT LINE ADVANCING specifies that no line feeds are included in the output.
  4. Literal-1 must be an alphanumeric literal.
  5. Literal-1 or data-name-1 must be a COBOL file specifier.
  6. Data-name-2 is an alphanumeric data item that contains XML data at run time.
  7. Pointer-name-1 is the address a memory buffer containing XML data.
  8. Data-name-3 is the length of the buffer pointed to by pointer-name-1.
  9. EXTERNAL indicates that the schema this XML stream conforms to is external. This is for documentation purposes alone and does not affect input or output.
  10. OMITTED specifies that no schema is associated with the XML file.
  11. Literal-2 or data-name-4 is a generated or external name of the schema the record conforms to. For example, for an external schema, this could be an entire URL to the file such as "http://www.microfocus.com/nx40/cobol/v2.0/foo.xsd"
  12. Data-name-5 must be declared in the data division as a PIC S9(9) (any usage) and holds the file status for the last I/O operation.

General Rules:

  1. When neither LINE ADVANCING nor NOT LINE ADVANCING is specified, line feeds are included in the output.
  2. Literal-1 or data-name-1 in an application that is not Web-based can be a COBOL file specifier as follows:
    • stdin, use ":CI:"
    • stout, use ":CO:"
    • file, use ".myxmlfile"

      where myxmlfile is the name of the file. Generally, XML files use the file extension .xml.

    • pipe, use "<myprog, ">myprog" or "|myprog"

      where myprog is the name of a program that uses stdin and/or stdout to communicate through the pipe.

  3. Literal-1 or data-name-1, in a client-side Web-based application, can be:
    • A CGI program hosted on a Web site, such as "http://www.bookdb.com:80/cgibin/xmlprog.exe"
    • An XML file, such as or "http://localhost/xmlfile.xml"
  4. Literal-1 or data-name-1, in a CGI, server-side Web application can be ":CGI:", which causes the environment variable CONTENT_LENGTH to be considered when reading the standard input stream (stdin). ":CGI:" can only be opened INPUT or OUTPUT, never I-O or EXTEND.
  5. When DOCUMENT-TYPE is not specified, no schema is associated with the XML file. For example:

    The following code:

    SELECT xml-addressdb
        ASSIGN 'address.xml'
        ORGANIZATION IS XML
        DOCUMENT-TYPE IS OMITTED
    
        FILE STATUS xml-status.
    

    Is equivalent to:

    SELECT xml-addressdb
        ASSIGN 'address.xml'
        ORGANIZATION IS XML
        FILE STATUS xml-status.
    
  6. The CHECK clause can be repeated multiple times. For example:
    SELECT foobar 
        ASSIGN TO "foobar.xml" 
        ORGANIZATION IS XML 
        DOCUMENT TYPE IS "foobar.xsd" 
        CHECK VALIDITY ON INPUT
        CHECK OUTPUT.