Below are few questions asked to me in a telephonic interview:
Q1: If there is a column in DB2 table which stores days (Viz. Monday, Tuesday etc) how do we fetch the data ordered by days? Below is the example:
PK Day
1 monday
2 wednesday
3 friday
4 saturday.
How to get the data ordered by days like given below:
Monday
Tuesday
Wednesday
Friday
Saturday
My answer:
I could not answer the question. But later i found out that using CASE statement in SELECT query we can assign values to days and give order by on that. But I am not sure yet. Could anyone help me how to solve this and give the proper syntax?
Q2: How does the records from a file be stored in MVS? Is it based on LRECL or BLK Size?
My answer:
I mentioned that records from flat file which is in fixed blocked mode will be stored in terms of Blk size as that is the physical length. LRECL is the logical record used by the developer for processing.
Q3: How do we get to know about the bytes allocated for a flat file given the number of records, record length and allocation type (Viz TRKs, CYL)
My answer:
I did not know the answer, but later found out that Total Space required for the dataset in bytes = Record Length * Maximum number of records.
Q4: Is there any DB2 command to get the access path DB2 has selected after the binding and if it is there what is that?
My answer:
I don't know the answer.
Rest were direct questions about differences between Plan and package, COBOL-DB2 execution phases (Precompile, Bind, Compile, Link, execute), SQL error codes, SQLCA, DB2 catalog tables, DISP parameters in JCL, Abends like SOC7, SB37.
I look forward to get some answers that I was wrong/not sure at it.
Q3: How do we get to know about the bytes allocated for a flat file given the number of records, record length and allocation type (Viz TRKs, CYL)
My answer:
I did not know the answer, but later found out that Total Space required for the dataset in bytes = Record Length * Maximum number of records.
the question and the terminoloy used is pretty foggy ...
as posed is pretty unclear
anyway
required in what sense ....
what You asked for
what is needed to satisfy Your request ...
what will zOS allocate
if You ask for 1(one) 80 bytes record
zOS will ( per dasd geometry ) allocate 55,840 bytes
( 2 blocks per track with optimum blksize )
Code:
Data Set Information
Command ===>
Data Set Name . . . . : ENRICO.MFTESTS.F1
General Data Current Allocation
Management class . . : **None** Allocated bytes . . : 55,840
Storage class . . . : **None** Allocated extents . : 1
Volume serial . . . : STOR03
Device type . . . . : 3390
Data class . . . . . : **None** Current Utilization
Organization . . . : PS Used bytes . . . . : 0
Record format . . . : FB Used extents . . . : 0
Record length . . . : 80
Block size . . . . : 27920
1st extent bytes . : 55840
Secondary bytes . . : 80
Data set name type : SMS Compressible : NO
Creation date . . . : 2012/11/28 Referenced date . . : 2012/11/28
Expiration date . . : ***None***
and in ISPF 3.4
Code:
DSLIST - Data Sets Matching ENRICO.MF* Row 1 of 1
Command ===> Scroll ===> CSR
Command - Enter "/" to select action Tracks %Used XT
-------------------------------------------------------------------------------
ENRICO.MFTESTS.F1 1 0 1
***************************** End of Data Set list ****************************
Just TO add some more questions on JCL.....which were asked in a interview:
1. If u have two files and file 1. contains records like : 100,100,100...only 3 records in it and file 2 contains records like 200, 200,200,200 only 4 records are there....Now how can we write the records in third files which contains records like 100,200,100,200,100,200 from the above files....????
2.If u have a file and one .no is key now the file have some duplicate recirds like.....100 abc
101 def
100 ghi
103 jkl
now if we want write the above record in another file which doesnt contain duplicate record and record key 100 should be selected which have ghi not the abc ...How can we do that...
Please cnswer the above two questions thru JCL do not use cobol pgms...
Q3: How do we get to know about the bytes allocated for a flat file given the number of records, record length and allocation type (Viz TRKs, CYL)
My answer:
I did not know the answer, but later found out that Total Space required for the dataset in bytes = Record Length * Maximum number of records.
the question and the terminoloy used is pretty foggy ...
as posed is pretty unclear
anyway
required in what sense ....
what You asked for
what is needed to satisfy Your request ...
what will zOS allocate
if You ask for 1(one) 80 bytes record
zOS will ( per dasd geometry ) allocate 55,840 bytes
( 2 blocks per track with optimum blksize )
Code:
Data Set Information
Command ===>
Data Set Name . . . . : ENRICO.MFTESTS.F1
General Data Current Allocation
Management class . . : **None** Allocated bytes . . : 55,840
Storage class . . . : **None** Allocated extents . : 1
Volume serial . . . : STOR03
Device type . . . . : 3390
Data class . . . . . : **None** Current Utilization
Organization . . . : PS Used bytes . . . . : 0
Record format . . . : FB Used extents . . . : 0
Record length . . . : 80
Block size . . . . : 27920
1st extent bytes . : 55840
Secondary bytes . . : 80
Data set name type : SMS Compressible : NO
Creation date . . . : 2012/11/28 Referenced date . . : 2012/11/28
Expiration date . . : ***None***
and in ISPF 3.4
Code:
DSLIST - Data Sets Matching ENRICO.MF* Row 1 of 1
Command ===> Scroll ===> CSR
Command - Enter "/" to select action Tracks %Used XT
-------------------------------------------------------------------------------
ENRICO.MFTESTS.F1 1 0 1
***************************** End of Data Set list ****************************
Thanks a lot for the information enrico, that helped me a lot.
[quote="neha_cap"]Just TO add some more questions on JCL.....which were asked in a interview:
2.If u have a file and one .no is key now the file have some duplicate recirds like.....100 abc
Code:
101 def
100 ghi
103 jkl
now if we want write the above record in another file which doesnt contain duplicate record and record key 100 should be selected which have ghi not the abc ...How can we do that...
We can try ICETOOL for this problem: from the given scenario, assuming for every key we have to pick the last duplicate value the solution is as given below: