tag:blogger.com,1999:blog-21191480294548131342024-03-04T20:56:45.190-08:00WebSphere Application ServerJayhttp://www.blogger.com/profile/10562244767926464299noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-2119148029454813134.post-61946462208222505682015-02-22T12:59:00.002-08:002015-02-22T12:59:56.018-08:00Making an Asynchronous JavaScript and XML (AJAX) call to a servlet from a Java Server Page.Now, let me start by saying that this post is not specific to WebSphere Application Server, but I just recently was working on a project where we were deploying in a z/OS WebSphere Application Server cell....and had the need for an asynchronous call from a Java Server Page using JavaScript....so I thought I would detail how it was done on this blog.<br />
<br />
What I was doing in this particular application was reading data from a VSAM file, and letting the users update, delete, modify...or add new records. These records were very large records with a lot of individual fields to be updated. One of the fields was actually a reference to another record...and the users want the business name of the record displayed on the Java Server Page they were currently working on. Instead of sending the entire form to a servlet just to get this data and then to repopulate the JSP with all of the data they had already entered, I decided to make this an AJAX call to a servlet...just to get this specific data field and display it on the currently active JSP.<br />
<br />
The idea behind an AJAX call is that the call is made from the JSP to some javascript, and then off to a servlet, where some work is done and then the return area is sent back, all while staying on on the same page and letting the user keep working while the call is made.<br />
<br />
This is a very simplistic example of a JSP, making an "onClick" call to a Java Script (AjaxJS.js), that sets up an AJAX call to a Java Servlet (AjaxServlet), and then having the Java Script display the return data in the "span id" testReply on the Java Server Page.<br />
<br />
This servlet has an input field called "testVAR", where a user can enter 6 numeric characters. In our instance...if the enter 123456 or 234567 they will get Customer #1 or #2. If they enter any other 6 numeric values....they will get "Customer not found.". Any other input will have a pop up box tell them that 6 numeric values must be entered.<br />
<br />
When the "Validate" button is clicked.....off we go to the Java Script...AjaxJS.js (see below)<br />
<br />
<b>Sample Java Server Page:</b><br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><%@ page language="java" contentType="text/html; charset=ISO-8859-1"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> pageEncoding="ISO-8859-1"%></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><html></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><head></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><title>Insert title here</title></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><script type="text/javascript" src="/AjaxTesting/AjaxJS.js"></script></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"></head></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><body></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><form NAME=theForm METHOD="post" ACTION="/AjaxTesting/AjaxServlet" ></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><P></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><PRE></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Jay Lang</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Distributed Computing professionals inc.</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">jay@tpmq-experts.com</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">This is a test jsp that will demonstrate an AJAX (Asynchronous JavaScript and XML) call to a servlet</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">without send the form from the jsp to the WebSphere Application Server. The call is made and data is</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">retrieved, while the form remains in tact.</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">For this testing, 6 numerics need to be input and the results will be retrieved.</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> 123456 will get "Customer #1"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> 234567 will get "Customer #2"</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> any other 6 numerics will return "Customer not found."</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"></PRE></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"></P></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><table></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <tr></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> <td><b>Test Ajax:&nbsp;</b> <input TYPE="text" NAME="testVAR" ID="testVAR" SIZE="6" MAXLENGTH="6"><button type="button" onClick="getVarAjax()">Validate</button>&nbsp;&nbsp;&nbsp;<font color="red" size="2"><span id="testReply"></span></font></td></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </tr></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"></table></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </form></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"></body></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"></html></span><br />
<br />
So the validate button has been clicked, and we are now in the Java Script below. We blank out a msg variable and assign the variable "tv" that value of what the user entered in the text box. Then we set-up a url to the servlet, "AjaxServlet" preparing the Selection as getAjaxVar and also sending in the "tv" variable value.<br />
<br />
If "tv" has a value...and it is 6 numerics, we will set-up and ActiveXObject and open a URL to call the AjaxServlet.<br />
<br />
Now the call to the servlet has been made....so we will check the readyState and the status...and if they are good, we will set the document element "testReply" to the responseText we got back from the servlet.<br />
<br />
So now, on to the servlet code.<br />
<br />
<b>Sample Java Script:</b><br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">function getVarAjax() </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">{</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> var msg = "";</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> var tv = theForm.testVAR.value;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> var xmlhttp;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> var url = "/AjaxTesting/AjaxServlet?Selection=getAjaxVar&testVAR="+tv;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> if(tv == "")</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> ;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> else if(tv.match(/^\d{6}$/)) </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> xmlhttp.open("POST",url,true);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span> </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> xmlhttp.onreadystatechange = function() </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> if(xmlhttp.readyState == 4)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> if(xmlhttp.status == 200)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> document.getElementById("testReply").innerHTML = xmlhttp.responseText; </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> } </span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> }</span><span class="Apple-tab-span" style="font-family: 'Courier New', Courier, monospace; font-size: x-small; white-space: pre;"> </span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> xmlhttp.send();</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> }</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> else</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> msg="Test VAR # must be 6 numerics"; </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> if(msg != "")</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> alert(msg);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">} // end of getVarAjax</span><br />
<br />
In the servlet, we set the function value to what the "Selection" set in the servlet string was, and if it is "getAjaxVar", we will assign the <span style="font-family: inherit;">variable</span> "inKey" to the "testVAR" value sent in on the servlet call string.<br />
<br />
If the inKey value is "123456" we will set the replyData to "Customer #1"...if the inKey value is "234567" we will set the replyData to "Customer #2"...if any other 6 numbers...we will set the replyData to "Customer not found."<br />
<br />
Now we prepare a response, setting the header fields and the content type, and then performing an out.println, flush and close of our replyData.<br />
<br />
<b>Sample Servlet:</b><br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">package dcp.ajax;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import java.io.IOException;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import java.io.PrintWriter;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import javax.servlet.ServletException;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import javax.servlet.http.HttpServlet;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import javax.servlet.http.HttpServletRequest;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">import javax.servlet.http.HttpServletResponse;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/**</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> * Servlet implementation class AjaxServlet</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> */</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">public class AjaxServlet extends HttpServlet {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> private static final long serialVersionUID = 1L;</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span><span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> public AjaxServlet() {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> super();</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> String function = request.getParameter("Selection");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> String inKey = request.getParameter("testVAR");</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> if(function.compareTo("getAjaxVar") == 0)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> StringBuffer replyData = new StringBuffer("");<span class="Apple-tab-span" style="white-space: pre;"> </span> </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> try</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> if(inKey.compareTo("123456")==0)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> replyData.append("Customer #1");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> else if(inKey.compareTo("234567")==0)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> replyData.append("Customer #2");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> else</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> replyData.append("Customer not found.");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> catch(Exception e)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> // Here you would take the appropriate action based on your needs..</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> response.setHeader("Cache-Control", "no-cache");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> response.setHeader("Pragma", "no-cache");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> response.setContentType("text/html");</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> PrintWriter out = response.getWriter();</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> out.println(replyData.toString());</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> out.flush();</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> out.close();</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> } // end of if</span><br />
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;"> }</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> doGet(request, response);</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">} // end of servlet</span><br />
<span style="font-family: inherit; font-size: x-small;"><br /></span>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><b>Screen Shots:</b></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">The initial JSP....waiting for some input.</span><br />
<span style="font-family: inherit;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Z3kVA0q98kxwx9ZzHKsBdepTgV7fRKZ_5iQeEaUfRZK3_2skb1pp70VyvCM9RDtbHg6Myv21nSuNZV24l2pUNnyM4WYX71-hUvt53CqloHNGrXMGAbBHG7HjtZ5ZyhYqDuCDY898Ab9V/s1600/Ajax1.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_Z3kVA0q98kxwx9ZzHKsBdepTgV7fRKZ_5iQeEaUfRZK3_2skb1pp70VyvCM9RDtbHg6Myv21nSuNZV24l2pUNnyM4WYX71-hUvt53CqloHNGrXMGAbBHG7HjtZ5ZyhYqDuCDY898Ab9V/s1600/Ajax1.jpg" height="300" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
The user has entered "123456" and has clicked the Validate button. You can see the return area in <span style="color: red;">red..."Customer #1"</span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOM3dzQrNJpaBOOdzi4niztAWYN2GWLbCVbsI_flivzVVYZN-DqnBGj9C_odAEjdM1WYe6n8CGUx54ztpA-4ZUY84meSMrXDgmz1lMBf3JIJ52D6-uKFp8M0nv8UUEUdYI0SdquK6hrcWL/s1600/Ajax2.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOM3dzQrNJpaBOOdzi4niztAWYN2GWLbCVbsI_flivzVVYZN-DqnBGj9C_odAEjdM1WYe6n8CGUx54ztpA-4ZUY84meSMrXDgmz1lMBf3JIJ52D6-uKFp8M0nv8UUEUdYI0SdquK6hrcWL/s1600/Ajax2.jpg" height="296" width="640" /></a></div>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
The user has entered "234567" and has clicked the Validate button. You can see the return area in <span style="color: red;">red..."Customer #2"</span><br />
<span style="color: red;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG-LNmGGGuETUz6o-GQZSgA6hUoHrrue4Cd9n5lHWpLhvu1KSC2I-vhKzri6ri7OHll67s0iKt-mt4U4EeRLasvLb9RWqstmLQIBKkQI8X5_QLi1rPFj9iVVdph9SseWROoLUrbIAt8RNH/s1600/Ajax3.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG-LNmGGGuETUz6o-GQZSgA6hUoHrrue4Cd9n5lHWpLhvu1KSC2I-vhKzri6ri7OHll67s0iKt-mt4U4EeRLasvLb9RWqstmLQIBKkQI8X5_QLi1rPFj9iVVdph9SseWROoLUrbIAt8RNH/s1600/Ajax3.jpg" height="296" width="640" /></a></div>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
The user has entered "345678" and has clicked the Validate button. You can see the return area in <span style="color: red;">red..."Customer not found."</span><br />
<span style="color: red;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBCp3nEB2yEXjfjsK-220kwgxegF-LuRhfgsa6IZnF8baijkeMiYmQftsly5loAHLRJnub_KCIm7e9FIA0QLJKt_FnhAUZRog4A53niVGNLUp5i7V-kGgVl8Pt8hEtEkPAm4_cnH8Kdet2/s1600/Ajax4.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBCp3nEB2yEXjfjsK-220kwgxegF-LuRhfgsa6IZnF8baijkeMiYmQftsly5loAHLRJnub_KCIm7e9FIA0QLJKt_FnhAUZRog4A53niVGNLUp5i7V-kGgVl8Pt8hEtEkPAm4_cnH8Kdet2/s1600/Ajax4.jpg" height="298" width="640" /></a></div>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
<span style="color: red;"><br /></span>
Give yourself some flexibility in your designs by using Ajax calls to communicate with the server and servlets while maintaining your position and current values in your Java server pages.<br />
<br />
If you have trouble implementing an Ajax call...don't hesitate to contact me.<br />
<br />
Jay Lang - jay@tpmq-experts.com<br />
<br />
Happy programming!!!!Jayhttp://www.blogger.com/profile/10562244767926464299noreply@blogger.com0tag:blogger.com,1999:blog-2119148029454813134.post-74673458041594941242014-12-30T03:15:00.000-08:002014-12-30T03:15:28.057-08:00Using system symbols to back-up your HFS or ZFS files on z/OSOn z/OS, your WebSphere Application Server cells, node agents and server information is stored in HFS (Hierarchical File Systems) or ZFS (z/OS File Systems). ZFS is the new direction that IBM is wanting users to go with, but a lot of folks are still using HFS.<br />
<br />
On my systems, I use the ADRDSSU utility to back-up my file systems daily, and I put a date in the output file name. Now, putting the current date or time in an output dataset name is not an intuitive option on a z/OS system....but there is a TCP/IP installation and configuration utility that can be used for system symbol substitution, EZACFSM1.<br />
<br />
This utility, EZACFSM1, can be placed as a surrounding job for your backup JCL<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//STEP0100 EXEC PGM=EZACFSM1</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSOUT DD SYSOUT=(A,INTRDR),DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSIN DD DATA,DLM=@@</span><br />
<br />
<br />
all your ADRDSSU jobs can go between STEP0100 and the end delimiter of @@<br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">@@</span><br />
<br />
So what we have is basically a shell where we can enter our backup JCL. I put every file system to be backed up in a separate job so that they all run at the same time. The jobs entered between the SYSIN DD DATA,DLM=@@ and the ending @@ will have system symbols substituted for variables in the JCL. See example below:<br />
<br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">//BUSYSAS JOB (XXXX,9350),'J LANG',</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">// CLASS=S,</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">// MSGCLASS=G,SCHENV=SYSA,</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;"></span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">// NOTIFY=JLANG1</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">//STEP0100 EXEC PGM=EZACFSM1</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSOUT DD SYSOUT=(A,INTRDR),DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSIN DD DATA,DLM=@@</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//BUSYSAD JOB (DDC06),'JLANG1 ',CLASS=S,MSGCLASS=G,NOTIFY=&SYSUID,</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">// SCHENV=SYSA</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//DUMP1 EXEC PGM=ADRDSSU</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSPRINT DD SYSOUT=*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//OUT DD DSN=&&TEMP,DISP=(,PASS),</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">// SPACE=(CYL,(800,10),RLSE)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> DUMP OUTDD(OUT) ALLDATA(*) SHARE OPT(4) TOL(ENQF) -</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> DATASET (INCLUDE(OMVS.SYSA.WAS71.SYSADM.CONFIG.HFS))</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//REST1 EXEC PGM=ADRDSSU</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSPRINT DD SYSOUT=*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//IN DD DSN=&&TEMP,DISP=(OLD,DELETE)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> RESTORE DATASET (INCLUDE(OMVS.SYSA.WAS71.SYSADM.CONFIG.HFS)) INDD(IN) -</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> TOL(ENQF) -</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> RENAMEU(OMVS.SYSA.WAS71.SYSADM.CONFIG.HFS, -</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> OMVS.SYSA.WAS71.SYSADM.CONFIG.HFS.D<span style="color: red;">&LYYMMDD</span>)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//DUMP2 EXEC PGM=ADRDSSU</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSPRINT DD SYSOUT=*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//OUT DD DSN=&&TEMP,DISP=(,PASS),</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">// SPACE=(CYL,(800,10),RLSE)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> DUMP OUTDD(OUT) ALLDATA(*) SHARE OPT(4) TOL(ENQF) -</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> DATASET (INCLUDE(OMVS.SYSA.WAS71.SYSADM.CONFIG.HFS.D<span style="color: red;">&LYYMMDD</span>))</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//* DELETE THE 'COPYTO' (NEWNAMED) FILE</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//DELETE1 EXEC PGM=IDCAMS</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSPRINT DD SYSOUT=*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSIN DD *</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> DELETE OMVS.SYSA.WAS71.SYSADM.CONFIG.HFS.D<span style="color: red;">&LYYMMDD</span></span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//REST2 EXEC PGM=ADRDSSU</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//SYSPRINT DD SYSOUT=*</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//IN DD DSN=&&TEMP,DISP=(OLD,DELETE)</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">//OUT DD DSN=OMVS.SYSA.WAS71.SYSADM.CONFIG.HFS.D<span style="color: red;">&LYYMMDD</span>,</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">// SPACE=(CYL,(800,10,1),RLSE,CONTIG),DISP=(,CATLG),</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">// DSNTYPE=HFS</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> RESTORE -</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> DATASET (INCLUDE(OMVS.SYSA.WAS71.SYSADM.CONFIG.HFS.D<span style="color: red;">&LYYMMDD</span>)) -</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> INDD(IN) TOL(ENQF) REPLACE</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/*</span><br />
<span style="color: blue; font-family: Courier New, Courier, monospace; font-size: x-small;">@@</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"><br /></span>
<span style="font-family: inherit;">In the JCL listed above......2 jobs will be submitted.....the first, <span style="color: blue;">BUSYSAS</span> (In Blue) will prepare the JCL for BUSYSAD by replacing the <span style="color: red;">&LYYMMDD</span> symbol with the current local date. The symbols table can be displayed so you can see what options you have available for use. In order to display the system symbols....you can add a REXX script, SYMDEF to your system REXX library (see below)</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">SYMDEF:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/* REXX *** */ </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'JOBNAME = 'MVSVAR('SYMDEF','JOBNAME') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/* GMT TIME */ </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'YYMMDD = 'MVSVAR('SYMDEF','YYMMDD') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'DAY = 'MVSVAR('SYMDEF','DAY') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'HR = 'MVSVAR('SYMDEF','HR') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'JDAY = 'MVSVAR('SYMDEF','JDAY') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'MIN = 'MVSVAR('SYMDEF','MIN') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'MON = 'MVSVAR('SYMDEF','MON') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'SEC = 'MVSVAR('SYMDEF','SEC') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'HHMMSS = 'MVSVAR('SYMDEF','HHMMSS') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'WDAY = 'MVSVAR('SYMDEF','WDAY') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'YR2 = 'MVSVAR('SYMDEF','YR2') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'YR4 = 'MVSVAR('SYMDEF','YR4') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/* LOCAL TIME */ </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LYYMMDD = 'MVSVAR('SYMDEF','LYYMMDD') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LDAY = 'MVSVAR('SYMDEF','LDAY') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LHR = 'MVSVAR('SYMDEF','LHR') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LJDAY = 'MVSVAR('SYMDEF','LJDAY') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LMIN = 'MVSVAR('SYMDEF','LMIN') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LMON = 'MVSVAR('SYMDEF','LMON') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LSEC = 'MVSVAR('SYMDEF','LSEC') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LHHMMSS = 'MVSVAR('SYMDEF','LHHMMSS') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LWDAY = 'MVSVAR('SYMDEF','LWDAY') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LYR2 = 'MVSVAR('SYMDEF','LYR2') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'LYR4 = 'MVSVAR('SYMDEF','LYR4') </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/* ADD YOUR OWN SYMBOLIC VARIABLES HERE */ </span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">SAY 'SYSR2 = 'MVSVAR('SYMDEF','SYSR2') </span><br />
<br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">EXIT 0 </span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">Now, executing the SYMDEF REXX script will produce a symbols report:</span><br />
<span style="font-family: inherit;"><br /></span>
<br />
<div class="MsoNormal">
<span style="font-size: 11pt;">Note: If local date and time are needed,
these are preceded by an āLā.<o:p></o:p></span></div>
<span style="font-family: inherit;"><br /></span>
<br />
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">JOBNAME = JLANG1<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">YYMMDD =
070627<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">DAY = 27 <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">HR = 14<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">JDAY = 178<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">MIN = 12<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">MON = 06<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">SEC = 52<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">HHMMSS = 141252<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">WDAY = WED<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">YR2 = 07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">YR4 = 2007<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LYYMMDD = 070627<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LDAY = 27<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LHR = 09<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LJDAY = 178<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LMIN = 12<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LMON = 06<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LSEC = 52<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LHHMMSS = 091252<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LWDAY = WED<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LYR2 = 07<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: 'Courier New'; font-size: 11pt;">LYR4 = 2007<o:p></o:p></span></div>
<span style="font-family: 'Courier New'; font-size: 11pt;">SYSR2 = T7YTA2</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">This technique can be used for any job where you would like to have a date/time included in the output dataset name without having to change it every time......the substitution is done automatically by the </span>EZACFSM1 utility.<br />
<br />
Happy programming!!!<br />
<span style="font-family: inherit;"><br /></span>Jayhttp://www.blogger.com/profile/10562244767926464299noreply@blogger.com0tag:blogger.com,1999:blog-2119148029454813134.post-42306349426521597832014-09-20T20:00:00.000-07:002014-09-20T20:00:49.653-07:00WebSphere z/OS - Clearing JSP cache......Sometimes during development.....I have found the need to use an embedded java server page...in several java server pages....to have a consistent look and feel. (see below)<br />
<br />
<html><br />
<head><br />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><br />
<meta http-equiv="Cache-control" content="no-cache"><br />
<meta http-equiv="pragma" content="no-cache"><br />
<meta http-equiv="Expires" content="-1"><br />
<title>A Java Server Page</title><br />
</script><br />
</head><br />
<body><br />
<b><%@ include file="Header.jsp" %> </b><br />
<br />
So let's say that this include file (Header.jsp) is in a java server page named NewCust.jsp. If we were to make a change to the Header.jsp file...and only the Header.jsp file.......WebSphere V7.1 currently would not realize that this file has been changed. Since we want NewCust.jsp to be recompiled......its data has not changed..so WebSphere will use is currently compiled copy. This will result in the changes made to Header.jsp not showing up in the NewCust.jsp.<br />
<br />
There are two things that we can do in this instance:<br />
<br />
1) Make a benign change to all of the java server pages that include the Header.jsp...so that their changed dates will be updated....this will force a compile in WebSphere Application Server.<br />
<br />
2) Clear the WebSphere java server pages compiled cache. This too will force WebSphere to re-compile all of the java server pages when they are accessed...at least the ones we remove from the cache.<br />
<br />
To find the cache folder.....you will need to go to the OMVS, Unix System Services....and locate the cache folder.<br />
<br />
/<i><b><span style="color: red;">cellRoot</span></b></i>/AppServer/profiles/default/temp/<b><i><span style="color: red;">appNodeName</span></i></b>/<b><i><span style="color: red;">serverName</span></i></b>/<b><i><span style="color: red;">applicationName</span></i></b>/<b><i><span style="color: red;">applicationWARFileName</span></i></b>/_NewCust.class<br />
<br />
The portion of this path that will be specific to your particular installation, node, application and war file name....they are highlighted in red above.<br />
<br />
In this directory....you will see your particular jsp compile class...preceded with an underscore. In our example _NewCust.class. You can simply remove this file to force a recompile.<br />
<br />
Happy coding!!!!Jayhttp://www.blogger.com/profile/10562244767926464299noreply@blogger.com0tag:blogger.com,1999:blog-2119148029454813134.post-91391945140263380072011-03-05T15:38:00.000-08:002015-09-16T11:24:32.102-07:00Manually turning off Global Security - z/OSSecurity is a tricky item. Having created hundreds of application servers and Deployment Manager cells, occasionally it has been necessary to manually turn off security. Normally, this happens when first setting up security, whether it be the local z/OS security system, or connecting to an LDAP server...sometimes the set-up has an error and your cell/server will not start, or you are unable to login. This article will cover what is needed to manually turn off security so you can start your cell or server and login to correct the situation.<br />
<br />
WebSphere files on z/OS are stored in ascii format. The z/OS system is ebcdic...so the first order of business will be two utility scripts to convert ascii to ebcdic and ebcdic to ascii. <br />
<br />
One last note on these scripts....the left and right brackets [ ] are not ebcdic characters....so when you enter them....you need to turn on HEX and make the left bracket [ a x'AD' and the right bracket ] a x'BD'<br />
<br />
The following script will convert ascii to ebcdic: (script name 2e)<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">#!/bin/sh</span><br />
<span style="font-family: "Courier New", Courier, monospace;">if [ $# -ne 1 ]; then</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> echo "Usage : 2e fileName"</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> echo "Output: fileName.E"</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> exit 10</span><br />
<span style="font-family: "Courier New", Courier, monospace;">else</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> iconv -f ISO8859-1 -t IBM-1047 $1 > $1.E</span><br />
<span style="font-family: "Courier New", Courier, monospace;">fi</span><br />
<br />
Example: <br />
$ <span style="font-family: "Courier New", Courier, monospace;">2e myasciiFile</span><br />
<br />
Output: <br />
<span style="font-family: "Courier New", Courier, monospace;">myasciiFile.E</span><br />
<br />
The following script will convert ebcdic to ascii: (script name 2a)<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">#!/bin/sh</span><br />
<span style="font-family: "Courier New", Courier, monospace;">if [ $# -ne 1 ]; then</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> echo "Usage : 2a fileName"</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> echo "Output: fileName.A"</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> exit 10</span><br />
<span style="font-family: "Courier New", Courier, monospace;">else</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> iconv -f IBM-1047 -t ISO8859-1 $1 > $1.A</span><br />
<span style="font-family: "Courier New", Courier, monospace;">fi</span><br />
<br />
Example: <br />
$ <span style="font-family: "Courier New", Courier, monospace;">2a myebcdicF</span>ile<br />
<br />
Output:<span style="font-family: "Courier New", Courier, monospace;"> </span><br />
<span style="font-family: "Courier New", Courier, monospace;">myebcdicFile.A</span><br />
<br />
These scripts should be saved in a location in z/OS Unix and that location needs to be added to your PATH environment variable. So if you have saved them to /usr/lpp/scripts Then you can either place this directory in your .profile file on the PATH variable or you can export a new PATH variable.<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ export PATH=$PATH:/usr/lpp/scripts</span><br />
<br />
<span style="font-family: inherit;">They also need to be executable, so using chmod:</span><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ cd /usr/lpp/scripts</span><br />
<span style="font-family: "Courier New", Courier, monospace;">$ chmod 755 2e 2a</span><br />
<br />
<span style="font-family: inherit;">Okay, now the preliminary work is out of the way...we can look at where the security switch is set. For standalone servers the location of the configuration files is:</span><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">/<span style="color: red;">mountPoint<span style="color: purple;">/</span><span style="color: black;">AppServer/profiles/default/config/cells</span><span style="font-family: "Courier New", Courier, monospace;"><span style="color: black;">/</span></span></span></span><br />
<span style="font-family: "Courier New", Courier, monospace;"><span style="color: red;"><span style="font-family: "Courier New", Courier, monospace;"><span style="color: black;"> </span><span style="color: red;">cellName</span></span></span>/</span><br />
<br />
The location for the Deployment Manager configuration files is:<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">/<span style="color: red;">mountPoint</span>/DeploymentManager/profiles/default/config/</span><br />
<span style="font-family: "Courier New", Courier, monospace;"> cells/<span style="color: red;">cellName</span></span><br />
<br />
<span style="color: black;">The mountPoint and cellName locations above were named by you when the server was created. Inside of these directories will be a file named security.xml. Remember, this file is store in ascii format so using the scripts we created earlier, let's convert it to ebcdic.</span><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ 2e security.xml</span><br />
<br />
You will now have a file that you can view as well as edit. The file name will be security.xml.E.<br />
<br />
Using the USS editor, open the file.<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ oedit security.xml.E</span><br />
<br />
<span style="font-family: inherit;">On the second line of this file, over to the right...there will be a variable <span style="color: red;">enabled="true" </span><span style="color: black;">. In order to turn off global security, change the <span style="color: red;">true</span> to<span style="color: red;"> false</span>...then save the file. Now we have our ebcdic file with the correct values, but we need it in ascii format. We need to execute the 2a script:</span></span><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ 2a security.xml.E</span><br />
<br />
<span style="font-family: inherit;">Now we have a file named security.xml.E.A that we need to rename security.xml. Before we do this, we should save the original file...just in case.</span><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ cp security.xml security.xml.ORIG</span><br />
<br />
Now we can rename or move our ascii file with security turned off.<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ mv security.xml.E.A security.xml</span><br />
<br />
<span style="font-family: inherit;">For our last item, we need to make sure the permission bits, the owner and the group ownership on the new file are the same as the original file. Using the <span style="font-family: "Courier New", Courier, monospace;">chown, chgrp</span> and <span style="font-family: "Courier New", Courier, monospace;">chmod</span> commands....make the security.xml file the same as security.xml.ORIG.</span><br />
<br />
You now should be able to start your server or deployment manager and using the Administration Console correct any problems with your security set-up.<br />
<br />
These types of errors don't happen that often...but when they do, it is always good to know how to manually turn security off so that the server or cell can start.<br />
<br />
Good luck.Jayhttp://www.blogger.com/profile/10562244767926464299noreply@blogger.com0tag:blogger.com,1999:blog-2119148029454813134.post-22646197474700000282011-02-21T16:30:00.000-08:002011-02-24T05:08:33.125-08:00Directing Application dumps in WebSphere for z/OSSometimes when you have an application that produces a dump, you run the risk of depleting your space in the Unix System Services, USS, file system and having this affect other applications. In order to redirect your WebSphere dumps to a pre-allocated file system, you can do the following:<br />
<br />
In the WebSphere Admin Console...go to...<br />
<br />
Environment -> WebSphere variables<br />
<br />
Add a new environment variable at the Cell or Server level which ever is the highest. The name of the variable will be _CEE_DMPTARG and the value will be the new HFS or ZFS you allocated and mounted.....i.e. /home/websphere/dumps.<br />
<br />
Save the configuration and stop and re-start the cell and or servers.Jayhttp://www.blogger.com/profile/10562244767926464299noreply@blogger.com0