April 2011

VSAM Questions - Part I

  1. What are the different types of VSAM files available?
    ESDS: Entry Sequence Data Set
    KSDS: Key Sequence Data Set
    RRDS: Relative Data Set
  2. What is IDCAMS?
    IDCAMS is the Access Method Services program. You run the IDCAMS program and supply AMS commands thru SYSIN. (examples of AMS commands are DELETE, DEFINE, REPRO etc..).

IMS - DB Components

IMS(Information Management System) is IBM's hierarchical database product. For many years, IMS was the most popular database for IBM mainframes. IMS consists of two components:

  1. DB, or Database and
  2. DC, or Data Communications.

Perl Hash and Array numerical and alphabetical Sorting

Sorting Array in numerical Order

my @numbers = (1,2,10,11,100,22,20);

#sorting array in numerical order
print "\n\n Sorting Array in Numberical Order\n\n";
foreach my $num ( sort {$a <=> $b} @numbers) {

print $num."\n\n";

Linux / Unix : who is currently in the system? What they are doing?

To get the list of users currently loggged in the system, we can use who, users and w commands.

Linux / Unix : how to see the hidden files?

When working in the linux / unix, need to list out the hidden files or directories. For example your home directory have hidden files like .profile.

To display hidden files, the ls command have option.

Perl - how to read the hash or object data in human readable format ?

Want to read the content of the hash or object in readable form instead of HashXX...

Repeat what you did last in Vim

when you work in vim, sometimes you may need to repeat the last step you did. for example commenting the lines, deleting the lines... So how to do that?

Just use .

which repeats your last command.

How to record and repeat the steps in vim

Sometimes you find same code or content repeated over and over while working in vim. So don't want to type it again, looking for recording and repeat it?

Here is the steps:

How to transfer Putty session to other machine?

I work in Desktop and when switch to laptop, i copied the putty.exe to laptop. When i open the putty in laptop, the session entries are missing. Where this values are stored? How to copy that to new laptop or another PC?

Here is the way!!

Internet Explorer - How to backup or export the favorites from one machine to other? How to import favorites?

1. Open Internet Explorer.
2. Open File Menu -> Import and Export option.
3. Click Next in the Welcome Screen.
4. Select Export Favorites option.
5. Select the folder you want to export and click Next button.
6. Choose Export to File or Address and specfy the path where you want to store this favorites backup file and Click Next.
7. Click Finish. It shows the message, Successfully exported favorites.

Mozilla Firebox - How to backup or Export and Import Bookmarks from one machine to other?

How to backup or Export and Import Bookmarks from one machine to other?

1. Press Ctrl+Shift+B or Bookmarks->organize bookmarks will open Library.
2. Click Import and Backup.
3. Choose Export HTML.
4. Specify the path and filename to backup the bookmarks. if you want to backup in json format then choose backup option in the step 3.
5. Click save, the bookmarks are stored in the html format.

Excel : repeat the last step

While working in Excel, You can find many steps are repeating.

For example, you want to delete the rows or insert row in between existing rows or formatting different rows over and over again.

linux / Unit How to find the difference between two files? diff command

diff command is to find the difference between the two files or directory of files.

The example are based on the below file content.

Unix or Linux How to get the previously executed command and repeat it ?

Sometimes we repeat the same commands, more than once. Instead of retyping the command again, just do a reverse search and execute it.

How to do the reverse search in command prompt?

Simple, just use Ctrl+R


which shows way to enter command, when you start type it produce matched command.

for example:

$ history
$ cat 1.txt
$ who

Ctrl+R and type c, it will show the cat command

(reverse-i-search)`c': cat 1.txt

is it useful for you? Write your comments.

jQuery UI datepicker working in firebox and not working IE?

I have jquery v1.4 and jQuery UI 1.8.1 , showing the date picker properly.

Later i have upgraded the jquery to 1.5.1. After upgrade, it is displaying only image in IE and not showing the calender in the Internet Explorer.

JSP Questions

2. Which are valid method calls on a PageContext object?

a. getAttribute()
b. getAttribute("key")
c. findAttribute("key")
d. getSessionAttribute()
e. getAttributeScope("key")
f. findAttribute("key",pageContext.SESSION_SCOPE)
g. getAttribute("key",PageContext.SESSION_SCOPE)

Ans: getAttribute("key") , findSttribute("key")

getAttributeScope("key"), getAttribute("key", PageContext.SESSION_SCOPE)

3. Which is the most efficient JspContext method to call to access an attribute that is known to be in application scope?

a. getPageContext()
b. getAttribute(String)
c. findAttribute(String)
d. getAttribute(String , int)

Ans: getAttribute(String, int)

4. What is the best strategy, when implementing a custome tag, for finding the value of an attribute whose scopt is unknow?

a. Check all scopes with a single pageContext.getAtteribute(String) call.
b. Check all scopes with a singale pageContext.findAttribute(String) call.
c. Check each scope with calls to pageContext.getAttribute(String,int).
d. call pageContext.getRequest().getAttribute(String), then call pageContext.getSession().getAttribute(String), and so on.

Ans: Check all scopes with a single pageContext.findAttribute(String) call.

5. Which is true about the Tag File model?

a. Each tag file must have a corresponding entry in a TLD file.
b. All directives allowed in JSP pages are allowed in Tag files.
c. All directives allowed in Tag files are allowed in JSP pages.
d. The standard action can only be used in tag files.
e. The allowable file extensions for Tagfiles are .tag and .tags
f. for each attribute declared and specified in a Tag file. The container creates a page-scoped attribute with the same name.

Ans: The standard action can only be used in tag files.

The allowable file extension for Tag files are .tag and .tags

For each attribute declared and specified in a tag file. The container creates a page-scoped attribute with the same name.

6. Which returns the enclosing tag when called from within a tag handler class?

a. getParent()
b. getAncestor()
c. findAncestor()
d. getEnclosingtag()

Ans: getParent()

7. Give Web application structure:

which tags could be used by an appropriate taglib directive?

a. Tag1.tag
b. Tag2.tag
c. Tag3.tag
d. Tag3.tag
e. Tag4.tag

Ans: Tag1.tag , Tag2.tag

8. Assume the standard JSTL prefix conventions are used, which JSTL tags would be used to iterate over a collection of objects?

a. <x:forEach>
b. <c:iterate>
c. <c:forEach>
d. <c:forTokens>
e. <logic:iterate>

Ans: <c:forEach>

9. Which is true about TLD files?

a. TLD files may be placed in any subdirectory of WEB-INF.
b. TLD files are used to configure JSP environment attributes, such as scripting - invalid.
c. TLD files may be placed in META-INF directoru of the WAR file.
d. TLD files can dec;are both Simple and Classic tags, but TLD files are not used to declare Tag files.

Ans: TLD files may be placed in any subdirectory of WEB-INF

10. What about the findAncestorWithClass method are true?

a. It is requires one parameter: A Class.
b. It is a static method in the TagSupport class.
c. It is not defined by any of the standard JSP tag interfaces.
d. It requires two parameters : A Tag and a Class.

It is a static method in the TagSupport class.
It is not defined by any of the standard JSP tag interfaces.
It requires two parameters: A Tag and aClass.

jQuery How to check element exists or not?

While working in forms or pages, sometimes we need to check the element exists or not. So that we can further get the value or assign or process it.

How to check that element exists or not using jQuery?

Here is the way. For example you want check an element with id blog_id exists or not.

if(jQuery('#blog_id').length > 0) { alert ("elemenet exists");}

jQuery('#blog_id') always return object, it wont help to check the element exists or not.

so always use if(jQuery('#id').length>0) to check the existence of the element.

Vim - To find and search & replace the text

While working in vim editor, sometimes we want to locate the text in the file.

To find the text

/searchtext - helps to find

if searchtext exists more than one place, just press n to continue find next occurrence.

To search and replace....

Getting Merge conflict issue how to resolve it?

I did hg pull then hg update and getting resolve failed message.

when i try hg resolve filename
getting merging conflict message.

How to resolve in hg?

Sum Sort

How to sum one column by using sort?