ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  MainFrame  >>  IBM MainFrame  >>  DB2
 
 


 

 
 COBOL interview questions  COBOL Interview Questions
 JCL interview questions  JCL Interview Questions
 CICS interview questions  CICS Interview Questions
 DB2 interview questions  DB2 Interview Questions
 IMS interview questions  IMS Interview Questions
 IDMS interview questions  IDMS Interview Questions
 Natural interview questions  Natural Interview Questions
 ADABAS interview questions  ADABAS Interview Questions
 REXX interview questions  REXX Interview Questions
 Assembler interview questions  Assembler Interview Questions
 CLIST interview questions  CLIST Interview Questions
 QMF interview questions  QMF Interview Questions
 MVS interview questions  MVS Interview Questions
 OS390 interview questions  OS390 Interview Questions
 OS 2 interview questions  OS 2 Interview Questions
 VSAM interview questions  VSAM Interview Questions
 QSAM interview questions  QSAM Interview Questions
 Sysplex interview questions  Sysplex Interview Questions
 IBM MainFrame AllOther interview questions  IBM MainFrame AllOther Interview Questions
Question
How can you split a table in to exactly half?
 Question Submitted By :: Anu
I also faced this Question!!     Rank Answer Posted By  
 
  Re: How can you split a table in to exactly half?
Answer
# 1
Hi,

Here i am giving the procedure , how to make the table into 
half..... using program... I dont know whether any direct 
SQL command is there or not. This is just for ur idea what 
i know.

1) Find the total number of rows in a table using count(*)

2) Declare two variable in working storage section.
eg: 02  A pic 9(4) .
    02  B pic 9(2).

store the count no into one variable .assume u stored that 
in A.

then divide that by 2. so u will get half of the rows in a 
table. strore that value in B.

3)  Take another variable name C . 

eg: 02  c pic 9(4) value 0.

perform para1 until B =C

para1:

Retrive the row from the table.

move to corresponding  host variables ( use table to store 
muliple rows ).

insert into table(u can insert multiple rows at a time ...)

do the same for storing the other half into the another 
table. 

means here 1 st half rows were stored in one temp 
table .... the other in the one table.
 
Is This Answer Correct ?    0 Yes 0 No
Reddy Kanupuru
 
  Re: How can you split a table in to exactly half?
Answer
# 2
i forgot to mention the  c value increment in the above 
mail.increment the c value after each row retrieved.
 
Is This Answer Correct ?    0 Yes 0 No
Pavani
 
 
 
  Re: How can you split a table in to exactly half?
Answer
# 3
Hi ............
try this one ....might be a logical one ... but have to 
give customers what they want.....

Select count(*) into :ws-count from emp with ur;

Declare CURSOR cursor1 for 
              Select *(if possible better code all fields) 
from emp where count(*) < :ws-count;
Open cursor 
Fetch cursor.

Declare CURSOR cursor2 for 
              Select *(if possible better code all fields) 
from emp where 
                                                            
                                         count(*) >= :ws-
count;
Open cursor 
Fetch cursor.
 
Is This Answer Correct ?    0 Yes 0 No
Kumar
 
  Re: How can you split a table in to exactly half?
Answer
# 4
ohh.. just manage the ws-count variable..
 
Is This Answer Correct ?    0 Yes 0 No
Kumar
 

 
 
 
Other DB2 Interview Questions
 
  Question Asked @ Answers
 
What is a buffer pool?  1
what are extents?  3
Describe what a storage group(STOGROUP) is?  1
How to see the structure of db2 table??  2
What is isolation level?  1
can any one expalin check point with an example?  1
What's the maximum number of volumes that can be added to a STOGROUP?  1
What is an alias and how does it differ from a synonym?  2
how to fetch multiple records without using cursor HCL9
What is a SELECT statement?  1
what is commit & rollback? When and where is used while compiling a cobol-db2 program?  2
What does the CHECK Utility do ?  1
How many sub queries can you combine together ?  1
What is auditing?  1
What is lock contention?  1
when does the SQL statement gets executed when you use cursor in the application programming ?  3
What is the meaning of -805 SQL return code?  2
can we drop column from a table INDUS4
AGGREGATE function support by DB2. A) SUM & AVG B) SUM, MIN & AVG C) SUM, MAX, AVG , MIN &COUNT D) NONE Accenture1
What is JOIN and different types of JOIN.  2
 
For more DB2 Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com