z/OS ISPF Planning and Customizing
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Passing requests to the gateway

z/OS ISPF Planning and Customizing
GC19-3623-00

TSO/ISPF service and command requests are passed to the gateway in XML format. The XML schema shown here, which is supplied in member ISPZXSDI in the ISPF samples data set ISP.SISPSAMP, describes the format and can be used to validate the XML for a service request:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="ISPF-INPUT">
 <xs:complexType>
  <xs:all>

   <xs:element name="SERVICE-REQUEST">
    <xs:complexType>
     <xs:all>

   <xs:element name="service">
    <xs:simpleType>
     <xs:restriction base="xs:string">
      <!-- Specifies native TSO or ISPF service call -->
      <xs:enumeration value="ISPF"/>
      <xs:enumeration value="TSO"/>
     </xs:restriction>
    </xs:simpleType>
   </xs:element>

   <xs:element name="session" minOccurs="0">
    <xs:simpleType>
     <xs:restriction base="xs:string">
      <!-- Default NONE : Session terminates after service call -->
      <xs:enumeration value="NONE"/>
      <!-- Reusable ISPF session stays active between calls -->
      <xs:enumeration value="REUSE"/>
     </xs:restriction>
    </xs:simpleType>
   </xs:element>

    <!-- Use existing ISPF profile in call -->
   <xs:element name="ispprof" type="xs:string" minOccurs="0"/>

    <!-- Free form TSO/ISPF command -->
   <xs:element name="command" type="xs:string"/>

     </xs:all>
    </xs:complexType>
   </xs:element>

  </xs:all>
 </xs:complexType>
</xs:element>

</xs:schema>
This is an example of the XML to request a TSO LISTCAT command:
<?xml version=\"1.0\"?>
<ISPF-INPUT>
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:noNamespaceSchemaLocation=\"ispf.xsd\">
<SERVICE-REQUEST>
<service>TSO</service>
<session>NONE</session>
<command>LISTC ENT('SYS1.LINKLIB')</command>
</SERVICE-REQUEST>
</ISPF-INPUT>
This is an example of the XML to request to run REXX program DINFO in a "reusable" ISPF session which remains active to run subsequent commands for this user:
<?xml version=\"1.0\"?>
<ISPF-INPUT>
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:noNamespaceSchemaLocation=\"ispf.xsd\">
<SERVICE-REQUEST>
<service>ISPF/service>
<session>REUSE</session>
<command>TSO DINFO sys1.linklib</command>
<ispprof>USER.ISPPROF</ispprof>
</SERVICE-REQUEST>
</ISPF-INPUT>
This shows the REXX program DINFO:
/* REXX */
parse upper arg dsn .
address "ISPEXEC" "dsinfo dataset('"dsn"')"
if rc = 0 then do
  say 'Volume              = ' zdsvol
  say 'Primary allocation  = ' strip(zds1ex) zdsspc
  say 'Secondary allocation = ' strip(zds2ex) zds2spc
end
else do
  say 'DSINFO rc = ' rc
  say 'ZERRMSG   = ' zerrmsg
end
exit rc
The Java™ program shown here, which is supplied in member ISPZXJAV in the ISPF samples data set ISP.SISPSAMP, shows an example of invoking the interface through a HTTP server and passing XML to request running the TSO PROFILE command:
package com.ibm.ispfcall;

import java.io.*;
import java.net.*;
import java.util.*;

public class XmlIspf {

 public static void main(String[] args) {

  try {

   BufferedReader in = new BufferedReader(new FileReader("C:\\logon.txt"));
   String logon = in.readLine();
   in.close();

   Date d = new Date() ;
   System.out.println("START Transfer DATE/TIME is :" + d.toString()  );

   // URL details for CGI POST
   URL url = new URL("http", "SITE.COM", 1234, "/ISPZXML");
   HttpURLConnection con = (HttpURLConnection) url.openConnection();

   con.setUseCaches(false);
   con.setDoInput(true);
   con.setDoOutput(true);
   con.setRequestMethod("POST");
   con.setRequestProperty( "Authorization", "Basic "
                          + Base64Encoder.encode( logon ));

   System.out.println("At url openConnection.. ");

   // POST CGI routines
   doPut(url, con, "POST", "");
   doGet(url, con);

   Date c = new Date() ;
   System.out.println("TOTAL Completion DATE/TIME is :" + c.toString()  );

  }
  catch (IOException exception)
  {
   System.out.println("Error: " + exception);
  }
 }

 public static void doPut(URL url, HttpURLConnection con, String ISPFFUNC,
                          String fileIn) throws IOException
 {
  if (ISPFFUNC.equals("POST"))
  {
   PrintWriter out = new PrintWriter(con.getOutputStream());
   // Below is a sample inline XML input for an ISPF service request
   // This could alternatively be read from an external file
   out.println( "<?xml version=\"1.0\"?>"          );
   out.println( "<ISPF-INPUT>"            );
   out.println( "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" );
   out.println( "xsi:noNamespaceSchemaLocation=\"ispf.xsd\">"    );
   out.println( "<SERVICE-REQUEST>"          );
   out.println( "<service>ISPF</service>"         );
   out.println( "<session>NONE</session>"         );
   out.println( "<command>TSO PROFILE</command>"    );
   out.println( "<ispprof>USERID.ISPPROF</ispprof>"     );
   out.println( "</SERVICE-REQUEST>"          );
   out.println( "</ISPF-INPUT>"           );
   out.flush();
   out.close();
  }
 }

 public static void doGet(URL url, HttpURLConnection con) throws IOException
 {
  BufferedReader in;
  try
  {
   System.out.println("About to accept response from Server");
   in = new BufferedReader(new InputStreamReader(con.getInputStream()));
   System.out.println("Response from Server received");
  }
  catch (FileNotFoundException exception)
  {
   InputStream err = ((HttpURLConnection)con).getErrorStream();
   if (err == null) throw exception ;
   in = new BufferedReader(new InputStreamReader(err));
  }

  String line;
  while ((line = in.readLine()) != null)
   System.out.println(line);

  in.close();
 }
}
Note: System symbols &SYSUID and &SYSPREF can be used as the high-level qualifier for the ISPF profile data set name specified with the <ispprof> tag.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014