Wednesday 8 December 2010

CONVERTING PROGRAMS FROM MAINFRAME TO UNIX (3)

IMPLEMENTATION OF STARTING A TRANSACTION

Index.html
Sets frame to login.jsp


Login.jsp
Sets Library.jsp which carries the global substructure…
Checks whether there is a previous session
Invalidates previous session
Gets logon parameters such as user pwd working library etc.
Form action posts library.jsp

Library.jsp
Check whether there is a previous screen lock and go to a frame which warns backbutton has been pressed
Get parameters from the previous screen via String user = request.getParameter(“user”)
Remove session parameters related to window processing
Get properties file related to security and do security checking
Instantiate library object using l = (Library) Class.forName(“library”+ “.application”).newInstance();
Set library attributes from the logon data
Get session attribute values
Set session attributes such as user pwd
Check STACK and if it is full remove first and pageContext.forward to action.jsp and command (module name) as param

Action.jsp
Check the command parameter if it is wrong pageContext.forward.
Get Library from the session via Library lib=(Library)request.getSession().getAttribute("library");
Check if lib exists
Check via Object[] lockx=(Object[])request.getSession().getAttribute("lock"); if it exists display backbutton.jsp
Handle various commands such as beginning with logon globals etc
Extract command parms
At the end:
Object[] lock=new Object[2];
request.getSession().setAttribute("lock",lock);
lib.setPageContext(pageContext);
synchronized(lock) {
lib.invokeProgram(command,lock);
lock.wait();
}

The library method invokeProgram calls the mechanism which first finds the related class name of that program name in that module, it also checks whether a class for this program name exists. It records the last fetched program for future references. It runs the main method of that program.
{

Program p=getProgram(name);

p.main();
}

public Class getProgramClass(String _name,String _package) throws Exception {

Class cl=(Class) Class.forName(qualifiedName);
batchDebug("Class loaded successfully "+cl);
return cl;
}
return (Class) Class.forName(qualifiedName);
}