Using Xalan-J in JZOS

Discussions regarding Open Source Java projects under z/OS (other than Tomcat)
Post Reply
lbjerges
Posts: 8
Joined: Mon Feb 02, 2009 7:41 am
Location: Stockholm, Sweden

Using Xalan-J in JZOS

Post by lbjerges »

Hi.
I´m trying to execute a XSL transformation in JZOS but am rewarded with

Code: Select all

SystemId Unknown; Line #-1; Column #-1; Premature end of file.
in STDERR.
I can read the XML document and dump it to System.out thereby verifying that the file is accessible. The first line, by the way, is:

Code: Select all

<?xml version="1.0" encoding="ebcdic-cp-se"?>
What I am trying to do is to process a xml document generated by a set of Rexx-procs in a sequential FB/80 dataset with a stylesheet residing in USS. The result of the transformation is published as a wiki-page (on another server).
This process works allright when I´m executing on a client (windows) but when I deploy the application on z/Os I get the above error. The application ends with rc=0:

Code: Select all

JVMJZBL1015N MVS commands are DISABLED                               
JVMJZBL1023N Invoking se.swedbank.cmnbaseline.Transformbase.main()...
JVMJZBL1024N se.swedbank.cmnbaseline.Transformbase.main() completed. 
JVMJZBL1021N JZOS batch launcher completed, return code=0  

But unfortunately the wiki page is empty.
What I feed into the transformer is:

Code: Select all

Transformer transformer = tFactory.newTransformer(new StreamSource(
	"/u/s000lbj/CMN2Wiki/baseline2wiki.xsl"));
ZFile tZosFile = new ZFile("//'" + aXMLFile + "'",
	"rb,type=record,noseek");
transformer.transform(new StreamSource(tZosFile.getInputStream()),
					tOut);
Does anybody have any idea on what I´m doing wrong, it would be nice to, if possible, run this process in its entirely on z/Os.
Regards Lars
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

I'm not sure if this is your problem, but you shouldn't be opening the dataset in record mode. Try it this way:

ZFile tZosFile = new ZFile("//'" + aXMLFile + "'", "rt");
lbjerges
Posts: 8
Joined: Mon Feb 02, 2009 7:41 am
Location: Stockholm, Sweden

Post by lbjerges »

I tried the "rt" (that I didn´t see before in the C-manual, probably missed it) but the result was the same.
I also tried to do a (Java) copy of the file from MVS to USS and then trying to feed the USS-file to Xalan but that didn´t work either unfortunately.
I haven´t given up completely yet but as of now I don´t have the time to pursue the problem. If I find at solution I´ll post it here however.
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

If you would like to send me a a small sample program and test files to info@dovetail.com, I try to see if I can figure out what is wrong.
lbjerges
Posts: 8
Joined: Mon Feb 02, 2009 7:41 am
Location: Stockholm, Sweden

Post by lbjerges »

Problem solved........
Suddenly it occured to me that this might be an encoding problem and sure enough, it was.
Due to my inability to understand the intricacies of encoding I failed to see the impact of not using UTF-8 in conjunction with the wiki soap API (the resulting document).
I am not sure however which parameter that does the trick so I coded:
JZOS_OUTPUT_ENCODING=UTF-8
and
-Dfile.encoding=UTF-8 -Dos.encoding=UTF8
Suddenly everything worked..... (even the swedish national characters that are generated by the stylesheet).

Thank you for your interest and helpful comments.
mariamunir
Posts: 1
Joined: Thu Jan 08, 2015 1:39 pm

Re: Using Xalan-J in JZOS

Post by mariamunir »

I've started to run some unit tests, no problems so far. The load time is slow, but I expected that. Curiously, when I run groovy from the OMVS shell, no output is written until I press enter. If I telnet in, everything is fine.
Post Reply