XML handling in REXX AND JCL [duplicate]

≯℡__Kan透↙ 提交于 2019-12-11 08:24:57

问题


I have XML data in my PS dataset as below , It is in the same format as below in my PS ,here is the example:

(**<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>onlinerecharge</display-name>
<filter>
    <filter-name>struts2</filter-name>`enter code here`
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>**)

What i want is that i want whole XML to come into a single line without any breaks in between , I need do to that thing on mainframe only. Do we have any way out to do that in REXX or JCL , I want my output to be like in the PS:

(http://www.w3.org ......so on )


回答1:


This seems like a strange requirement. XML documents tend to be fairly "long" so the output record length will need to be at least as long as the largest XML document you will process. Under IBM z/os, which I presume you will be running under, there is a 32K limit to PS record size. Beware of this limit.

At any rate, try the following REXX exec. Change the ALLOCATED dataset names (HLQ.XML.IN and HLQ.XML.OUT) to suit your needs and it will concatenate all of the records from the input dataset into a single record and write it to the output dataset.

/* REXX */  
'ALLOCATE DA(''HLQ.XML.IN'') F(XMLIN) SHR'  
'ALLOCATE DA(''HLQ.XML.OUT'') F(XMLOUT) OLD'  
'EXECIO * DISKR XMLIN(FINIS STEM REC.'  
XOUT = ''  
DO I = 1 TO REC.0    
  XOUT = XOUT || STRIP(REC.I)  
END  
QUEUE XOUT  
'EXECIO * DISKW XMLOUT(FINIS'  
'FREE DDNAME(XMLIN)'  
'FREE DDNAME(XMLOUT)'  
RETURN  

Note: The output dataset needs to be created before running this exec, if not then just change the ALLOCATE statement to create it with whatever dataset attributes you need.



来源:https://stackoverflow.com/questions/18787292/xml-handling-in-rexx-and-jcl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!