What are different ways of Initiating Transaction in CICS?

  • We can initiate the transation through MQ and TCP/IP and Terminal and consol.
  • We can initiate CICS Transaction By giving TRANSACTION ID By giving CICS START Command AUTOMATIC TASK INITIATION(ATI). 
 Other Methods:

1. By entering Transaction Id(4 bytes)
2.By Start command
3. By Return Trans Id (as in pseudo conv)
4. By Registering Tran ID in plt so that it will be automaticaly dusring CICS start
5. By ATI
6.PF PA keys as defined in PCT

How a CICS Transaction be initiated?

Involving CICS Control programs and Control tables. a. Trans-id entered in terminal b. TCP with TCT recognizes incoming data c. SCP acquires the storage for the Terminal Input-Output Area (TIOA) d. KCP prepares control data for this task e.KCP, through PCT, tries to find the application program associated with the Trans-id. f. If PPT entry of the application program does not show the resident address of the program, KCP passes control to PCP, which fetches the application program from the load library and places it into the main storage. g. KCP passes control to the application program. h. Application program starts its processing

CEDF,CEMT,CEBR,CECI transactions in CICS

CICS-supplied Execution Diagnostic Facility transaction. It provides interactive program execution and debugging functions of a CICS programs.
CEMT : CICS-supplied Extended Master Terminal transaction. It displays or manipulates CICS control environment interactively.
CEBR : CICS-supplied Temporary Storage Browse transaction. It displays the content of Temporary Storage Queue ( TSQ ).
CECI : CICS-supplied Command Interpreter transaction. It verifies the syntax of a CICS command and executes the command.

CICS Interview Questions for TCS,Infosys,IBM,HP and Other Companies

  1. How do you place the cursor on a particular position on the screen? –
              Move -1 to the length attribute of the field aand use the CURSOR option.
     2.    Define the field with IC in the BMS map.               Use CURSOR(n m)??
  1. What are the two outputs created as a result of generation of a map? – The map copybook and the load module.
  2. What is the difference between physical map and symbolic map? –
              The physical map is the load module and the symbolic map is the data structure.

5.     How do you protect a field from being overlaid? -
              What is the attribute byte? –
              Defines the display/transmission of field. most cases is an output field from the program.
  1. How do you use extended attributes ? Define EXTATT=YES and the correct terminal type.
  2. What are the 3 working storage fields used for every field on the map? – Length, attribute and input/output field.
  3. What is MDT? What are FSET, FRSET ? Modified Data Tag. Bit in the attribute byte indicating modification of field on screen. Happens on an input operation.
    FSET. Sets MDT on to ensure field is transmitted. Happens on an output operation.
    FRSET. Resets MDT. Until this happens, field continues to be sent.
  4. What is the use of DSECT parameter in BMS? Is the parameter to generate a symbolic map.
  5. Do you receive the attribute byte in the symbolic map? On EOF yes.

  6. How do you make your BMS maps case sensitive? Use ASIS???

  7. What is effect on RECEIVE MAP when PF key is pressed? Data transmission may happen,
    PA key is pressed? Data transmission will not happen.
  8. What are SEND MAP MAPONLY & SEND MAP DATAONLY ? MAPONLY - to send the map alone, without any data. Eg: used for sending Menu screens.
    DATAONLY - to send data alone, without sending the screen layout again. Eg: used for refreshing the screen data.
  9. What is the difference between a PF key & a PA key ? PF keys wake up the task and transmit modified data, PA keys only wake up the task.
  10. Name the macros used to define the following: MAP MAPSET FIELD
  11. Can you use OCCURS in a BMS map? If you do, what are the issues related with its use? Yes. cannot use group by clause???
  12. Can you define multiple maps in a BMS mapset? Yes.
  13. How is the storage determined in the symbolic map, if you have multiple maps? Storage for maps redefine the first. This means largest map has to be the first.
  14. What is the meaning of BMS length of field = 0? Data was not entered in the field
  15. Can you simply check if length = 0 for checking if a field was modified? No, not if ERASE EOF was used.

Difference between single quotes and double quotes in unix

Enclosing characters in single quotes (`'') preserves the literal value of each character within the quotes.  A single quote may not occur between single quotes, even when preceded by a backslash.

Enclosing characters in double quotes (`"') preserves the literal value of all characters within the quotes, with the exception of `$', ``', and `\'.  The characters `$' and ``' retain their special meaning within double quotes (*note Shell Expansions::).  The backslash retains its special meaning only when followed by one of the following characters: `$', ``', `"', `\', or `newline'.  Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified.  A double quote may be quoted within double quotes by preceding it with a backslash.

The special parameters `*' and `@' have special meaning when in double quotes (*note Shell Parameter Expansion::).

What is the difference between CI( CONTROL INTERVAL)and CA(CONTROL AREA)

The CI is a single unit of transfer from secondary to main memory. Inside it will have freespace to store the records of fixed or variable size.
If u try to insert a new record to a ci which is not having any space to hold at that time the half of the record from this ci will be moved to some free ci. This splitting of ic in case of ci full is called CI splitt.
A collection of ci is called as CA. During the ci splitt if it is unable to find the free ci at that time the entire CA will be splitted into two and half will be moved to some free CA. This is called CA splitt. This is the primary mechanism of the VASM to store all the records inside your ksds in sorted order.

What is the procedure for running the batch job in mainframe?

Friends let me explain with an example:--

EG:-Adding two numbers

Step-1:- We need to compile that program and that compiled program(i.e Error free code) we need to keep in one Load Library (EG:-ABCD.GEEK.LOADLIB)

Step-2:- Now we need to execute this program giving PGM=ADD(Program Name) and the Load Libray name(ABCD.GEEK.LOADLIB)

Step-3:- Now In SYSOUT we can view the results

That's it this the process how to compile and execute a batch program

How do you convert flat files to VSAM files

Let's be a little more precise.We will take the tack that you will be creating a KSDS file.First, you need to know which field/s you will be using as the primary key and if you need, alternate keys. Sort the records by that field/s.Use IDCAMS REPRO to load the flat file into the VSAM file.

difference between Intra partition TDQ and Extra partition TDQ?

INTRA PARTITION TD QUEUEs It is a group of sequential records which are produced by the same and / or different transactions within a CICS region. These Qs are stored in only one physical file ( VSAM ) in a CICS region, which is prepared by the system programmer. Once a record is read from a queue, the record will be logically removed from the queue; that is the record cannot be read again. EXTRA PARTITION TD QUEUEs It is a group of sequential records which interfaces between the transactions of the CICS region and the systems outside of CICS region. Each of these TDQs is a separate physical file, and it may be on the disk, tape, printer or plotter.

What is Pseudo-conversation?How it is achieved in CICS Programs?

The programming methodology in which the task will not wait for the terminal users response, but frees and resources after sending the message is call a PSEDUDO Conversational Technique. Terminating the task every time the application needs a response from the user and then starting the next transaction when the user presses a attention key is PSEUDO Conversational Processing.

Generally the I/O request requiring a user input takes 1000 times more time than CPU processing time. So, the idea is to free the current CPU resources till the user gives his response and initiate the same after receiving the response from user. In the meantime, CPU engages itself in processing other programs/transactions. This helps multitasking concept and hnce faster and concurrent processing.

What is the difference between the XCTL and LINK commands?

XCTL : This command passes the control to the same level.Control does not return back after this command is executed.

LINK: link transfers the control to the next lower level.Link command also expects the control to return back.
Syntax is same use link in place of XCTL. 

Both XCTL and LINK are control transfer commands.

XCTL transfers the control to another program (called program) at the level below to the calling program. Control is never returned back to the called program.

LINK transfers the control to another program (called program) at the same of the calling program. Control is expected to return back to the called program.

CICS Error Code AIEV,IBM AEIV due to length error of COMMAREA on EXEC CICS LINK command


You have a modified Node Error Program, DFHZNEP, that issues an EXEC CICS LINK command to another application. This program has worked for many years until upgrading to z/OS 1.8. Now, the program abends with abend code AEIV indicating that there is a length error (LENGERR).


EXEC CICS LINK command has LENGTH parameter coded incorrectly.

Diagnosing the problem

Your Link command is coded similar to the following:



NEPCALEN is defined using the DFHNEPCA macro as an equate:


Thus, NEPCALEN is equated to a full word binary value of x'0000009E', causing the length value to be picked up at location x'9E'. The CICS Translator loads the address of the equated field into the parameter list, and this actually yields an address of x'0000009E'.

Prior to upgrading to z/OS V1.8, location x'9E' either contained a half word of zeros or a half word value not having the left most bit turned on. After upgrading, this storage contains a half word value with the left most bit turned on, thus thought to be a negative value. The negative value causes LENGERR and abendAEIV. 

Source :IBM

How can connect sql server 2005 with java in java?

In order to connect MySQL database with Java one need to use below mentioned sample script:

<%@ page import="java.sql.*" %>
<%@ page import="com.mysql.jdbc.Driver" %>

Class.forName("com.mysql.jdbc.Driver").newInstance ();
java.sql.Connection conn;
conn = DriverManager.getConnection(
"jdbc:mysql:///?user=&password=") ;
Use the JDBC functionality to open a connection to SQL Server.
You can read up on how here:

How to connect MySQL Database from Java

In order to connect MySQL database with Java one need to use below mentioned sample script:

<%@ page import="java.sql.*" %>
<%@ page import="com.mysql.jdbc.Driver" %>

Class.forName("com.mysql.jdbc.Driver").newInstance ();
java.sql.Connection conn;
conn = DriverManager.getConnection(
"jdbc:mysql:///?user=&password=") ;

Connect to an Oracle database with JDBC in Java

JDBC mean Java Database Connectivity. In java, using JDBC drivers, we can connect to database.
Steps to connect to JDBC.
1) Load the driver, using Class.forName(DriverName);
2) Get the connection object, Connection con = Driver.getConnection(loaded driver name);
3) Create a SQL statement, Statement s = con.createStatement();
4) Create Resultset object using the statement created above, ResultSet rs = s.executeQuery("sql statement");

Iterate the result set to get all the values from the database.

Finally don't miss this
5) s.close();
6) con.close() ;


import java.sql.*;

public class TestDBOracle {

  public static void main(String[] args)
      throws ClassNotFoundException, SQLException
    // or
    // DriverManager.registerDriver
    //        (new oracle.jdbc.driver.OracleDriver());

        String url = "jdbc:oracle:thin:@//server.local:1521/prod";
    //               jdbc:oracle:thin:@//host:port/service
    // or
    // String url = "jdbc:oracle:thin:@server.local:1521:prodsid";
    //               jdbc:oracle:thin:@host:port:SID
    //  SID  - System ID of the Oracle server database instance.
 //         By default, Oracle Database 10g Express Edition
 //         creates one database instance called XE.
 //         ex : String url = "jdbc:oracle:thin:@myhost:1521:xe";

    Connection conn =

    Statement stmt = conn.createStatement();
    ResultSet rset =
         stmt.executeQuery("select BANNER from SYS.V_$VERSION");
    while (rset.next()) {
         System.out.println (rset.getString(1));
    System.out.println ("Ok.");

XML and using Xerces parser for Java to generate and parse XML

his small tutorial introduces you to the basic concepts of XML and using Xerces parser for Java to generate and parse XML.
The intended audience are XML beginners with knowledge of Java.
DOM (Document Object Model ) parser - Tree Structure based API:
    The Dom parser implements the dom api and it creates a DOM tree in memory for a XML document
5.2 SAX (Simple API For XML ) parser - Event Based API
    The SAX parser implements the SAX API and it is event driven interface. As it parses it invokes the callback methods
5.3 When to use DOM parser
  • Manipulate the document
  • Traverse the document back and forth
  • Small XML files
Drawbacks of DOM parser
    Consumes lot of memory 5.4 When to use SAX parser
  • No structural modification
  • Huge XML files
5.5 Validating And Non Validating
DOM and SAX can either be a validating or a non validating parser.
    A validating parser checks the XML file against the rules imposed by DTD or XML Schema.
    A non validating parser doesn't validate the XML file against a DTD or XML Schema.
Both Validating and non validating parser checks for the well formedness of the xml document

View Complete Tutorial here

How to create XML document using java,Java Architecture for XML Binding (JAXB)

In this section, you will  learn to create a XML document using the DOM APIs. This XML document uses  1.0 version  and UTF-8 encoding. 
To work with an XML document it is easy to do so, if you have a document object in place and the XML document loaded in it. Yes, java too has APIs for working with an XML document. With this API, you can navigate through the XML document, or create an XML document from the scratch.
import org.w3c.dom.Document;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
DocumentBuilder bd = fact.newDocumentBuilder();
doc = bd.newDocument();
Element rt = (Element) doc.createElement("rtElement");
rt.appendChild( doc.createTextNode("Some") );
. . .
. . .
Proper imports are to be done to work with the classes and the methods needed for working with an XML document. The above code sample would give you an idea on how to go about it. Methods like createElement of the Element object are used to create elements.
And these elements are added to the root node using the method appendChild. Lots of sample codes are available in the internet on this topic.
 Here is Java File: CreatXMLFile.java

How to Create Running Total Field in Crystal Reports


A running total field in a Crystal report is a summary field that allows you to control how and when the summary is calculated, and when it is reset.
In this tutorial, you will create a running total field and insert it into a report.

View Complete Tutorial here

VB.NET Crystal Reports Summary Fields

The following C# - Crystal Reports section describes how to add a summary field in the Crystal Reports
In the Crystal Reports designer view window, right click on the Report Footer , just below the Total field and select Insert -> Summary .

Then you will get a screen , select the Total from the combo box and select Sum from next Combo Box , and summary location Grand Total (Report Footer) . Click Ok button

Now you can see @Total is just below the Total field in the report Footer

Now the designing part is over and the next step is to call the Crystal Reports in C# and view it in Crystal Reports Viewer control .

Select the default form (Form1.cs) you created in C# and drag a button and a CrystalReportViewer control to your form .

You have to include CrystalDecisions.CrystalReports.Engine in your C# Source Code.

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;

How to create a login page in Aspnet with sqlserver

First we have to create a database for storing the login information

Open the Sqlserver Management studio

Create a new database and change the database name as db_Logininformation

Create a New table in that database(db_Logininformation) and change the table name as tab_userinformation
Now, create the following fields

  1. UserID   int         PrimaryKey  
  2. username varchar(50)  
  3. Password varchar(50)  
Next, Enter the some usernames and paasword directlu in the database for checking purpose

and save the table

Next ,open the Microsoft visual studio 2008

Next,select the Aspnet web application and change the name as LoginPage

Next,come to the design page of LoginPage and drag and drop two labels,two textboxes and button

next,come to the code page of the Login.aspx.cs

Write the following codein the page event
  1. protected void Button1_Click(object sender, EventArgs e)  
  2.     {        
  3.         con = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstring"].ToString());  
  4.         con.Open();  
  5.         com = new SqlCommand("select Password from userinformation where Username='" + txt_uname.Text + "'", con);  
  6.         dr = com.ExecuteReader();  
  7.         if (!dr.Read())  
  8.         {  
  9.             Response.write("Invalid User");  
  10.         }  
  11.         else  
  12.         {  
  13.             if (dr[0].ToString() == txt_pwd.Text)  
  14.             {  
  15.                 Response.Redirect("~/mainPage.aspx");  
  16.             }  
  17.             else  
  18.             {  
  19.                Response.write("Wrong Password");  
  20.                txt_pwd.Focus();  
  21.             }  
  22.         }  
  24.     } 

How to Create ASP.NET Session Login Without Cookies

The following describes the easiest way I have found to force users to log into an ASP.NET website for each session but not require them to accept cookies. You must do the following things.
  1. Create a Web.config file with the appropriate entries to allow session state management.
  2. Create a well formed Global.asax file with the code below included in it.
  3. Create a login page to authenticate users against a database or whatever method you desire.
' Fires when the session is started and sets the default loggedin state to ""

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
Session("Loggedin") = ""
End Sub
' Called when the request has been process by the Request Handler and 

' HttpSessionState is available [This is the key piece of code that forces 

' the user is login check with each page request]

Sub Application_OnPostRequestHandlerExecute()
End Sub
'Check that the user is logged in.

Sub CheckLoggedIn()
'If the user is not logged in and you are not currently on the Login Page.

If Session("LoggedIn") = "" And InStr(Request.RawUrl, "Login.aspx") = 0 Then
End If
End Sub
Finally create a Login.aspx file that authenticates the user. If the user is allowed in, set: Session("Loggedin") = "Yes"
That's all there is to it. Hope this helps! Enjoy!

Create Login Page with ASP Connected to Database

dim username, password, loginButton
if logButton then
   Dim Con, sql, rec
   set Con = Server.CreateObject("ADODB.Connection")
   Con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("database.mdb")
   'Select the record matching the username.
   sql = "SELECT * FROM tblusers WHERE UCase(username)='
"& UCase(username) & "' AND UCase(password)=' " & UCase(password) & " ' "
   set rec=Con.execute(sql)
   'If no match found, EOF is not true.
   if NOT rec.EOF then
      Response.Redirect("somepage.asp") 'Change to page redirect to after login
      blankError="Invalid username." 'EOF is true, no match found.
   end if
end if
<form name="productForm" method="post" action="<%=Request.ServerVariables("URL")%>">
<table border =1>
<tr><td colspan="2">

if blankError<>"" then
Response.Write("<center><font color='red' size='3'>"&blankError&"</font></center>")
end if
<td><Strong><font face="courier new" size="3">Username:</font></strong></td>
<td><input type="text" name="username" size="35"></td>
<td><Strong><font face="courier new" size="3">Password</font></strong></td>
<td><input type="password" name="password" size="35"></td>
<tr><td colspan="2" align="center"><input type="submit" name="loginButton" value="Login">
<input type="reset" name="reset" value="Clear"></td>

Fixing the java.lang.OutOfMemoryError: PermGen space error.

Fixing the java.lang.OutOfMemoryError: PermGen space error.

Start your JVM with -XX:MaxPermSize=XXXm where XXX is a number like 128, 256. This will allow the JVM to allocate XXX megabytes of memory for the PermGen space if that space is needed. Here are the quick guides to configuring memory options for some popular containers. If you still have issues see my other posts about tracking down your possible memory leaks.

Explaining java.lang.OutOfMemoryError: PermGen space

Most probably, a lot of Java developers have seen OutOfMemory error one time or other. However these errors come in different forms and shapes. The more common is: "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space" and indicates that the Heap utilization has exceeded the value set by -Xmx. This is not the only error message, of this type, however.
One more interesting flavor of the same error message, less common but hence even more troublesome is: "java.lang.OutOfMemoryError: PermGen space". Most of the memory profiler tools are unable to detect this problem, so it is
even more troublesome and therefor - interesting.
To understand this error message and fix it, we have to remember that, for optimized, more efficient garbage-collecting Java Heap is managed in generations - memory segments holding objects of different ages. Garbage collection algorithms in each generation are different. Objects are allocated in a generation for younger objects - the Young Generation, and because of infant mortality most objects die there. When the young generation fills up it causes a Minor Collection. Assuming high infant mortality, minor collections are garbage-collected frequently. Some surviving objects are moved to a Tenured Generation. When the Tenured Generation needs to be collected there is a Major Collection that is often much slower because it involves all live objects. Each generation contains variables of different length of life and different GC policies are applied to them.
There is a third generation too - Permanent Generation. The permanent generation is special because it holds meta-data describing user classes (classes that are not part of the Java language). Examples of such meta-data are objects describing
classes and methods and they are stored in the Permanent Generation. Applications with large code-base can quickly fill up this segment of the heap which will cause java.lang.OutOfMemoryError: PermGen no matter how high your -Xmx and how much memory you have on the machine.
Sun JVMs allow you to resize the different generations of the heap, including the permanent generation. On a Sun JVM (1.3.1 and above) you can configure the initial permanent generation size and the maximum permanent generation size.

To set a new initial size on Sun JVM use the -XX:PermSize=64m option when starting the virtual machine. To set the maximum permanent generation size use -XX:MaxPermSize=128m option. If you set the initial size and maximum size to equal values you may be able to avoid some full garbage collections that may occur if/when the permanent generation needs to be resized. The default values differ from among different versions but for Sun JVMs upper limit is typically 64MB.
Some of the default values for Sun JVMs are listed below.
JDK 1.3.1_06 Initial Size Maximum Size
Client JVM 1MB 32MB
Server JVM 1MB 64MB
JDK 1.4.1_01 Initial Size Maximum Size
Client JVM 4MB 64MB
Server JVM 4MB 64MB
JDK 1.4.2 Initial Size Maximum Size
Client JVM 4MB 64MB
Server JVM 16MB 64MB

Java JVM GC, PermGen, and Memory Options

when I ran into a situation with some code where we were running out of PermGen space I had to do some reading. In the JVM, PermGen holds the metadata about classes that have been loaded/created. This information is garbage collected like the other parts of the heap, however there are rough edges that can prevent this from happening, class loaders in particular (which I won’t discuss here.) Generally, the amount of PermGen space needed is small in relation to the rest of the heap and default JVM values should work for you.

Java Exhausted Result Set / Oracle & Websphere 5.1|java.sql.SQLException: Exhausted Resultset

I am experiencing some problems with a simple query on a thin oracle driver. I am using a connection from the application server connection pool on a cluster machine. Basically this is my code:

try {
conn = DAOFactory.getConnection();
stmt = conn.prepareStatement(SELECT_STATEMENT);
stmt.setInt(1, var);
rs = stmt.executeQuery();

while( rs.next() ) {
long id = rs.getLong(1);

All this I incorporate into a try/catch block like this:

} catch(SQLException e) {
// some exception handling
} finally {
try {
} catch (SQLException e1) {
// some exception handling

After some runs I get sporadically the “Exhausted Resultset” Exception at line rs.getLong(1). This indicates, that my result set is closed. This will imply that rs.next() returns true even if there are no results! This kind of strange behaviour I have already noticed by some other users.

My question: How can I ensure that rs.next() will return false if the result set is empty? Does anybody else encounter this problem before and have a smooth solution?