FILE SECTION.
XD XML-STREAM.
01 XML-REC IDENTIFIED BY "envelope".
02 body IDENTIFIED BY "body".
03 FILLER IDENTIFIED BY "werkgevers"
OCCURS 20 TIMES
COUNT IN werkgevers-COUNT.
04 FILLER IDENTIFIED BY "werkgever".
05 FILLER IDENTIFIED BY "identificatie".
06 FILLER IDENTIFIED BY "werkgeversnummer"
PIC X(4).
05 FILLER IDENTIFIED BY "salef".
06 FILLER IDENTIFIED BY "ingangsjaar"
pic x(4).
06 FILLER IDENTIFIED BY "ingangsmaand"
pic x(2).
06 regel IDENTIFIED BY "salefregel"
pic x(80).
WORKING-STORAGE SECTION.
01 XML-STATUS PIC S9(9) COMP.
01 WSNAAM PIC X(050).
PROCEDURE DIVISION.
MOVE 'n1772170907m.xml' TO WSNAAM.
OPEN i-o XML-STREAM.
DISPLAY 'XML-STATUS: ' XML-STATUS.
READ XML-STREAM
DISPLAY 'XML-STATUS: ' XML-STATUS.
REWrite XML-REC key body
DISPLAY 'XML-STATUS: ' XML-STATUS.
CLOSE XML-STREAM.
DISPLAY 'XML-STATUS: ' XML-STATUS.
.
GOBACK.
XML-STATUS: 000000000
XML-STATUS: 000000001
XML-STATUS: 000000000
XML-STATUS: -000000010
#VisualCOBOL#XML#COBOLA file status -10 on an xml file means:
10 The internal DOM representation is not written out to any XML stream and has been cleared after a READ statement or a CLOSE statement.
The docs for the REWRITE KEY state the following:
1. No stream I/O is performed by the REWRITE verb.
2. REWRITE KEY IS updates the in-memory representation of the elements and child elements associated with data-name-1. All other elements in the in-memory representation remain unchanged.
3. If the internal representation of the XML document is modified through the use of WRITE KEY, REWRITE KEY, or DELETE KEY, and the internal representation is cleared with either a CLOSE or READ (no key) statement, then the CLOSE or READ statement returns a status of -10, indicating the operation succeeded but no write was done.
This is telling you that the statement was successful but you haven't actually written the changes to disk yet since the REWRITE only changes the internal representation.
Use the WRITE statement without the KEY clause to actually update the file prior to closing it.
FILE SECTION.
XD XML-STREAM.
01 XML-REC IDENTIFIED BY "envelope".
02 body IDENTIFIED BY "body".
03 FILLER IDENTIFIED BY "werkgevers"
OCCURS 20 TIMES
COUNT IN werkgevers-COUNT.
04 FILLER IDENTIFIED BY "werkgever".
05 FILLER IDENTIFIED BY "identificatie".
06 FILLER IDENTIFIED BY "werkgeversnummer"
PIC X(4).
05 FILLER IDENTIFIED BY "salef".
06 FILLER IDENTIFIED BY "ingangsjaar"
pic x(4).
06 FILLER IDENTIFIED BY "ingangsmaand"
pic x(2).
06 regel IDENTIFIED BY "salefregel"
pic x(80).
WORKING-STORAGE SECTION.
01 XML-STATUS PIC S9(9) COMP.
01 WSNAAM PIC X(050).
PROCEDURE DIVISION.
MOVE 'n1772170907m.xml' TO WSNAAM.
OPEN i-o XML-STREAM.
DISPLAY 'XML-STATUS: ' XML-STATUS.
READ XML-STREAM
DISPLAY 'XML-STATUS: ' XML-STATUS.
REWrite XML-REC key body
DISPLAY 'XML-STATUS: ' XML-STATUS.
CLOSE XML-STREAM.
DISPLAY 'XML-STATUS: ' XML-STATUS.
.
GOBACK.
XML-STATUS: 000000000
XML-STATUS: 000000001
XML-STATUS: 000000000
XML-STATUS: -000000010
#VisualCOBOL#XML#COBOLThank you Chris.
it is necessary to define all tags even if you only update a few tags.
FILE SECTION.
XD XML-STREAM.
01 XML-REC IDENTIFIED BY "envelope".
02 body IDENTIFIED BY "body".
03 FILLER IDENTIFIED BY "werkgevers"
OCCURS 20 TIMES
COUNT IN werkgevers-COUNT.
04 FILLER IDENTIFIED BY "werkgever".
05 FILLER IDENTIFIED BY "identificatie".
06 FILLER IDENTIFIED BY "werkgeversnummer"
PIC X(4).
05 FILLER IDENTIFIED BY "salef".
06 FILLER IDENTIFIED BY "ingangsjaar"
pic x(4).
06 FILLER IDENTIFIED BY "ingangsmaand"
pic x(2).
06 regel IDENTIFIED BY "salefregel"
pic x(80).
WORKING-STORAGE SECTION.
01 XML-STATUS PIC S9(9) COMP.
01 WSNAAM PIC X(050).
PROCEDURE DIVISION.
MOVE 'n1772170907m.xml' TO WSNAAM.
OPEN i-o XML-STREAM.
DISPLAY 'XML-STATUS: ' XML-STATUS.
READ XML-STREAM
DISPLAY 'XML-STATUS: ' XML-STATUS.
REWrite XML-REC key body
DISPLAY 'XML-STATUS: ' XML-STATUS.
CLOSE XML-STREAM.
DISPLAY 'XML-STATUS: ' XML-STATUS.
.
GOBACK.
XML-STATUS: 000000000
XML-STATUS: 000000001
XML-STATUS: 000000000
XML-STATUS: -000000010
#VisualCOBOL#XML#COBOLThank you Chris.
it is necessary to define all tags even if you only update a few tags.