Hi David,

1) I changed a little bit the code you send, so it worked for me (I need
to run it under ccsid 037) because my CCSID=870 is not supported by XML
GENERATE/PARSE.)

PROCESS CCSID(037)

IDENTIFICATION DIVISION.
PROGRAM-ID. XMLGEN.
AUTHOR. ROMANAPS.
ENVIRONMENT DIVISION.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 EMPLOYEE-REC.
03 NAME PIC X(25).
03 MAILADDRESS.
05 STREET PIC X(20).
05 CITY PIC X(12).
05 STATE PIC X(2).
03 PERSONAL.
05 MARITALSTATUS PIC X.
05 BIRTHDATE PIC X(8).

01 XML-CHAR-COUNT PIC 9(9) COMP-3.
01 IFS-FILE PIC x(50)
VALUE '/home/ROMANAPS/xmlcbl/test.xml'.
01 XML-VAR PIC X(999).

PROCEDURE DIVISION.

POPULATE-EMPLOYEE-REC.
MOVE 'John Doe' TO NAME.
MOVE '5th Avenue' TO STREET.
MOVE 'Manhattan' TO CITY.
MOVE 'NY' TO STATE.
MOVE 'Y' TO MARITALSTATUS.
MOVE '19651231' TO BIRTHDATE.

* Generate into Variable
* XML GENERATE XML-VAR FROM EMPLOYEE-REC
* Generate into IFS Stream-File
XML GENERATE FILE-STREAM IFS-FILE FROM EMPLOYEE-REC
COUNT IN XML-CHAR-COUNT
ON EXCEPTION
DISPLAY 'XML generation error ' XML-CODE
STOP RUN
NOT ON EXCEPTION
DISPLAY 'XML document was successfully generated.'
END-XML

GOBACK.

2) Then I created with iSeries Navigator on my iSeries from the IFS folder
/home/ROMANAPS/xmlcbl/
the new share named xmlcbl and had set the text conversion on it (for
filetypes *.xml) as showed here:




3) Then I mapped the above share as a network drive to my PC.

4) Now after calling the program on iSeries I found the converted output
test.xml on the mapped network drive and can view it on my PC with an
texteditor - see here:

<EMPLOYEE-REC><NAME>John Doe</NAME><MAILADDRESS><STREET>5th Avenue
</STREET><CITY>Manhattan</CITY><STATE>NY
</STATE></MAILADDRESS><PERSONAL><MARITALSTATUS>Y
</MARITALSTATUS><BIRTHDATE>19651231</BIRTHDATE></PERSONAL></EMPLOYEE-REC>

More info about XML GENERATE can be found in:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/sc092540.pdf
S.293 ff
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/sc092539.pdf
S 521 ff.

Regards

Roman



From:
David FOXWELL <David.FOXWELL@xxxxxxxxx>
To:
"cobol400-l@xxxxxxxxxxxx" <cobol400-l@xxxxxxxxxxxx>
Date:
26.11.2008 11:02
Subject:
[COBOL400-L] GENERATE XML
Sent by:
cobol400-l-bounces@xxxxxxxxxxxx



Hi,

I'm trying to make GENERATE XML work.
I am not a COBOL programmer. I have studied it for about 3 months but 10
years ago.
Please could someone tell me how to get the XML generated visible on a PC.

Shouldn't there be a line like <?xml version="1.0" encoding="UTF-8"?>

Thanks.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 EmployeeRec.
03 Name pic X(25).
03 MailAddress.
05 Street pic X(20).
05 City pic X(12).
05 State pic X(2).
03 Personal.
05 MaritalStatus pic X.
05 BirthDate pic X(8).

01 XMLMsg pic x(1000).
01 IFSFile pic x(50) value "/home/FOXWELL/test.xml".

PROCEDURE DIVISION.
POPULATE-EmployeeRec.
MOVE 'John Doe' TO Name.
MOVE '5th Avenue' TO Street.
MOVE 'Manhattan' TO City.
MOVE 'NY' TO State.
MOVE 'Y' TO MaritalStatus.
MOVE '19651231' TO BirthDate.
XML GENERATE FILE-STREAM IFSFile
FROM EmployeeRec
END-XML.
STOP RUN.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.