Page 1 of 1

IBM Mainframes interview questions.

Posted: Tue May 06, 2014 12:32 pm
by Vibha
Hi,

I've listed below some of the questions I was asked in a recent interview and I was not sure if I got the answer correctly. At times, I just did not know the answer. Can you please have a look and advise on the answers:

1.
Interviewer: How will you split one Input file into two output files?
Me: Using SPLIT of SORT product.
Interviewer: What is you've to do it using COBOL?
Me: READ input file and start writing records in two different files alternatevely .

Interviewer did not seem convienced. Can you please guide if it was correct.

2.
Interviewer: What is the maximum value that a subscript can use?
Me: I was not sure. I said, 128 MB is limit of the Working-Storage Section and if there is no other variable that much value it can take!

Iterviewer lokked at me as if I've stolen his cheese! Can you please guide if it was correct.

3.
Interviewer: How will You change the column name in a table, explain the steps.
Me: I think with alter command we can add a column but, I think with alter command we can't change the column name. Can someone please guide here.


4.
Interviewer: How will you pass parameters from JCL to a cobol program other than parm statement & sysin dd*?
Me: I did not know the answer.


5.
Inteviewer: Two files are defined this way and beng read in a COBOL program
File-A is defined as : Lrecl=80,Blksize=800
File-B is defined as : Lrecl=80,Blksize=8000

How many bytes are read in I/O in each of the cases.
Me: Not sure. Please guide.

6.
Interviewer: I have a 80 byte string in cobol. It is having character "A". I want to replace A by B.How will i do that?
Me: Using INSPECT REPLACING.


7.
Interviewer: In a db2 program a column name is given wrong. Will I will get error during compilation time or run time?
Me: I think it is during compilation time. Is it correct ?

Re: IBM Mainframes interview questions.

Posted: Thu May 08, 2014 2:39 pm
by Anuj Dhawan
I'll try to answer slowly. I don't feel prepared for the interview.. :D
1.
Interviewer: How will you split one Input file into two output files?
Me: Using SPLIT of SORT product.
Interviewer: What is you've to do it using COBOL?
Me: READ input file and start writing records in two different files alternatevely .

Interviewer did not seem convienced. Can you please guide if it was correct.
There are couple of ways of doing. As you said - you can use SPLIT in SORT. If you know the number of records in the input file beforehand, there can be other ways too.

Your COBOL-answer seems fine to me unless there are more fillers to the question.
2.
Interviewer: What is the maximum value that a subscript can use?
Me: I was not sure. I said, 128 MB is limit of the Working-Storage Section and if there is no other variable that much value it can take!

Iterviewer lokked at me as if I've stolen his cheese! Can you please guide if it was correct.
I'll follow up on this question - this look somewhat incomplete to me. What answer the interviewer is looking forward to? Number of digits allowed in subscript declaration or something else. However, 128 MB limit does not sound logical to answer this question.
3.
Interviewer: How will You change the column name in a table, explain the steps.
Me: I think with alter command we can add a column but, I think with alter command we can't change the column name. Can someone please guide here.
The answer is - it depends and it depends on the version of DB2 in use at the shop. With DB2 9, you can use ALTER TABLE table_name RENAME COLUMN RECORD_KEY TO MY_KEY;

If you are using an older version of the DB2 - take back-up of table, drop the table, create the new table, load the table from back-up.

Rest of the questions later...

Re: IBM Mainframes interview questions.

Posted: Thu May 08, 2014 3:21 pm
by William Collins
Well, you have something with 128MB. The largest useful value would be one which could cover the maximum number of entries allowed in a table. If you consult Appendix B of the Enterprise COBOL Language Reference, you should find the maximum value for an OCCURS and that would be the maximum useful value for subscripting.

You could use this, 01 X COMP PIC 9(18), as a field to use for subscripting. That would give you 999,999,999,999,999,999 maximum as a non-native binary field. It would be pointless to have a field that size for a subscript.

Re: IBM Mainframes interview questions.

Posted: Thu May 08, 2014 3:31 pm
by Anuj Dhawan
William Collins wrote:Well, you have something with 128MB.
I agree with you Bill though I'm unsure about the intent of the question and find it confusing. Probably a question on limit of Working-Storage section might sound good but for a subscript (which indicates that a COBOL internal table is already in place and we just don't know how big it is and how many entries it might get) - the 128 limit only applied to subscript declaration becomes questionable, yes? Possibly a follow up with interviewer might have helped... :)

Re: IBM Mainframes interview questions.

Posted: Thu May 08, 2014 4:45 pm
by William Collins
Yes, agreed. If a question does not make sense in itself, follow up. Sometimes that will be the reason for the question. Sometimes the interviewer has no particular knowledge, and is presenting the question approximately as given to them and expecting a "stock" answer, and does not know that phrasing the question differently/incorrectly makes it incoherent :-)

Re: IBM Mainframes interview questions.

Posted: Thu May 08, 2014 8:08 pm
by Robert Sample
For number 5, the BLKSIZE gives the amount of data each I/O will retrieve from the input device. So physically 800 and 8000 bytes, respectively, will be retrieved. HOWEVER, COBOL only returns one logical record at a time so the first READ statement will physically read 800 / 8000 bytes but only return 80 to the program. The next 9 / 99 READ statements will return data from the physical block already read, after which another I/O will occur.

Note that this is a VAST simplification of the actual process since the system can read multiple physical blocks in one operation, and actually QSAM (the sequential file access method) will read 5 blocks of data at a time since the default is 5 buffers. But for an interview, knowing that the block size defines the physical read amount, and that COBOL only returns one logical record at a time to the program, should be all you need to know.

Re: IBM Mainframes interview questions.

Posted: Wed Aug 06, 2014 1:38 pm
by Vibha
Thank you so much for the answers. If possible, could you please help me with question 4 as well:

4.
Interviewer: How will you pass parameters from JCL to a cobol program other than parm statement & sysin dd*?
Me: I did not know the answer.

Re: IBM Mainframes interview questions.

Posted: Wed Aug 06, 2014 6:23 pm
by Robert Sample
You can place the parameters into a sequential (or VSAM) data set and allocate a DD name -- ANY DD name -- to that data set. Open it and read the parameters in COBOL, then close it.