Geek Interview
Geek Interview
com/turnkey/
GeekInterview.com
For accessing a VSAM cluster sequentially, STARTBR, READNEXT, ENDBR
commands are used. Suppose the VSAM cluster is sorted on the basis of a field (lets say
age) and using STARTBR pointer is positioned on the record with name 'brijesh'. By
using READNEXT that record is read. Now if i again use READNEXT, next record will
be read(which could be the record with name other than 'brijesh'). If I want to read the
next record with the same name (i.e. brijesh), whether RESETBR will be correct option
for me. By using RESETBR here, whether the pointer will be placed at the next record
with same name(brijesh) or the first record with the name 'brijesh'. Please explain the
same.
GeekInterview.com
what do you mean by RDW in VSAM?
Guys As you are aware RDW stands for Record Descriptor Award.This is the first 4
bytes in a VSAM - Variable Record Length file that stores the actual length of the record.
This is hidden if you browse a VSAM file. In a VB file realistically the record startsfrom
COL 5 and NOT COL 1 as you see when you browse the file.
GeekInterview.com
What do you mean by dirty read
The dirty read technique can be used to provide a high degree of concurrent access to
VSAM files while avoiding the complications associated with CI and CA splits. The dirty
read protocol can be summarized as follows:
GeekInterview.com
In vsam why we use export-import utility?
EXPORT-IMPORT UTILITY is used to take a back along with the attributes of the
VSAM file and restore the back with the same attributes respectively.We can use REPRO
to take back up it will not copy the attributes of the file it will only copy data logically.
Hance after deliting the original VSAM file we will have to redefine it for restoring.
NOTE: IMPORT can be used for restoration only if data has been backed up using
EXPORT
GeekInterview.com
What is the maximum record length for the VSAM dataset?Of all the answers provided.
The answer provided by DRSCBALAJI is correct. It is Max of 1 cylinder.
The reason he gave is also correct, since there can be SPANNED RECORDS which can
cover multiple CI's. But a spanned record can never cross a CA. And the maximum value
for a CA is 1 Cylinder. So ultimately the maximum size of a VSAM record will be 1
Cylinder.
GeekInterview.com
The Maximum Number of records which can be stored on KSDS depends on various
factors,
1. The record size and its type(fixed length or variable length).
2. The type and sige of the CA which is defined so to say , either cylinders or tracks etc
along with the primary and secondary quantity.
3. The maximum number of extents which we can get in VSAM are 123 and
The percentage free space for CI and CA, being specified during the definition will also
plays important role
thus I hope considering all these factors, one can come to a conclusion about the
approximate records those can be stored on VSAM file.
While designing vsam files,what's the best way to choose control interval size for the data
and the index?
for direct access use small ci for sequential access use larger ci.
RE: while designing vsam files,what's the best way to...
Don't get bogged down unless the file is tremendously large. Rule of thumb: use 4096 for
the data and 1024 for the index. You'll never never be far from optimum with those CI
sizes.
Please let me know why we choose data as 4096 and index 1024 in
RE: While designing vsam files,what's the best way to choose control interval size
for the data and the index?
Control interval size can be optimally selected by the system when we omit it. Because
the C.I. is nothing but the place where a record get stored depending on various factors
(such as either a fixed length or variable length record) we have to calculate the C.I size.
Don't worry about these issues thanks to some modern developments by the IBM which
makes the system to effectively calculate the optimum C.I. size.
RE: While designing vsam files,what's the best way to choose control interval size
for the data and the index?
1024 and 4096 are powers of 2. You could specify 1000 and 4000 but VSAM would
actually use 1024 and 4096 although I'm not sure if the full 1024 would actually be
available to you. Short answer is that since that is the number VSAM will use 1000 or
4000 will not save you anything.
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.
How do you convert flat files to VSAM files
Hi all
You can't convert the flat files to Vsam files. The data it means the record in the flat file
will be copied to vsam file where you can have any field as the primary key but it should
be unique.
When you allocate the vsam cluster at that time you have the option to catlog the dataset
using the idcam utility. Apart from this tools like file aid also gives you an option to
catalog a vsam dataset.
Are you sure? I didn't think you could create a VSAM data set without catalog entries
because on the DASD VTOC when it is listed as VS there are limited DSCB entries. I
think that if you are creating a catalog entry for a VSAM data set you must be importing
it.
To create a VSAM data set the only way I am aware of is through IDCAMS which would
be associated with some catalog. (Won't swear to all of the above but would be willing to
wager a drink on it...)
Think DOS VS! Using VSAM was much much easier than coding masses of inflexible
DLBL and EXTENT cards for running jobs in DOS VS.
VSAM was written as a replacement for ISAM. The main problem with ISAM was that if
there were many insertions and deletions the way he chained the entries was horribly
inefficient. VSAM through the use of splitting CIs was a hugh improvement.
http://www.exforsys.com/tutorials/mainframe/vsam-introduction.html
VSAM Catalogs
VSAM Structure
VSAM Introduction
Mainframe system supports sophisticated operating systems like UNIX, Linux and VMS
and IBM operating systems like Z/OS, Z/VM, and VSE/ESA.
Control Interval in VSAM is a unit of data that is transferred when an I/O request is made
between auxiliary storage and virtual storage. It contains records, free space and control
information. The data records are grouped into control intervals. That is in other words in
non-VSAM method the unit of data that is transferred between memory and the storage
device is defined by the block which in contrast in VSAM is referred as Control Interval.
The records in the Control Interval are all placed in the beginning of the Control Interval
with key of each record followed by the actual record. The end portion of the Control
Interval is occupied by control interval descriptor this also has space for specifying the
record length of each record in the Control Interval. The space between this beginning
part which is occupied by records and the end part of control interval which has
descriptor followed by length of record denotes the free space. This is shown
diagrammatically below:
Key 1 Record 1
Key 2 Record 2
Key 3 Record 3
Key 4 Record 4
Key 5 Record 5
Free Space
Length of Record 1
Length of Record 2
Length of Record 3
Length of Record 4
Length of Record 5
Descriptor
(End part of control interval)
The Control information also called as CI in short consists of the following information:
• RDF called as Record Descriptor Field
• CIDF called as Control Interval Descriptor Field
The maximum size that is allowed for a Control Interval is 32K. Let us now see about the
information stored on the above RDF and CIDF.
A CIDF is present for each Control Interval. The CIDF is a field which has the last 4
bytes of a Control Interval. This has information about the offset and the length of free
space in the Control Interval. Having seen about the information in CIDF let us now see
the information present in RDF. If the records are of fixed size then each Control Interval
has two RDF's with each RDF of length 3 bytes. If the records are of variable size then a
separate RDF is available for each record in the Control Interval. The Control Interval in
VSAM is created as soon as VSAM dataset is loaded after which records are placed
inside it. Having got an idea about Control Interval in VSAM from above explanation
and idea about KSDS clusters, RRDS clusters and ESDS clusters from our previous
section let us now see how the records are filled in the control interval by each of these
different clusters.
In case of Entry Sequenced Data Set clusters also called as ESDS clusters which follows
sequential data set, records are fully placed in a control interval and only after completing
this control interval say the current control interval, the records are written into the next
control interval in sequence.
Sponsored Links
In case of Key Sequenced Data Set clusters also called as KSDS which has room for free
space as we have seen in our previous section the records are placed in a control interval
but not with a condition that it is fully filled which means that some amount of free space
is provided for future additions. In case of Relative Record Data Set clusters the control
interval is filled with records of fixed length which can be two types say either a active
record or a dummy record. Active record refers the original record and the dummy record
helps in providing space for future record addition to the dataset as and when needed.
A group of control intervals makes up a control area. Since the control intervals are
grouped to form control area the way of filling the control area is similar to the way of
filling records in control interval as discussed in detail in our previous paragraph. The
number of control intervals per control area depends on how much space is reserved
when the dataset is created. This is shown diagrammatically below:
Control Area 1
Control interval A
Control interval B
Control interval C
Control interval D
Control interval E
Control Area 2
Control interval F
Control interval G
Control interval H
Control interval I
Control interval J
Attributes in the index component
• index set
• sequence set
The index set lists the largest index within each control area and the sequence set lists the
largest index within each control interval.
The records get allocated in Control Interval and Control area in the following manner:
• Check for enough free space within a control interval is made and if such a space is
present then the new records gets added in that position.
• If the Check for enough free space within a control interval returns no enough free
space within a control interval then a check for the presence of empty control interval
within the same control area is made and if such a empty control interval within the same
control area occurs the control interval split is made with the record from the control
interval which is filled with records being moved to the empty control interval space.
• If in case of Check for enough free space within a control interval returns no enough
free space within a control interval and also there is no empty control interval within the
same control area then control area split is made and records gets moved to the new
control area.
database DSNDB01 means a.db2 catalog b.db2 directory c.BSDS d.active logs
answer with reason please Answer
#1
B, DB2 directory. DSNDB01 is a DB2 system database that
contains DB2's directory. The directory contains table
spaces that hold DBDs(DBD01), Plans(SCT02), Packages
(SPT01), information about utilities(SYSUTILX) and system
log range records (SYSLGRNX). This data cannot be queried
through SQL, only through DB2 commands.
in GDG: is it poosible to copy records from a file which utilizes some 100 cylinders
to a gdg whose model is defined as trk(1,0) and also it possible to copy 100 bytes file
to 80 bytes file? Answer
#1
It is possible but we losse data.
IBM
IBM
IBM
Re: What is usage pointer in cobol? Answer
#1
Declare a pointer as an elementary data item bearing the
USAGE IS POINTER clause, with no PICTURE. E.g:
05 EXAMPLE-P USAGE IS POINTER.
IBM
IBM
Parm value passed is PARM=(10,20). how do code linkage section and how would you
add these two passes values and show result in cobol program.
UST
Can we use select query in a loop to fetch multiple rows in a COBOL PROGRAM? If so,
what is the advantage of cursor?
UST
have cobol+ db2 program but it contains n number of subprograms for this how many
dbrm members i need to mention in bind process
ACCENTURE
what is the differences between spufi and qmf and which is better? Answer
#1
QMF - by using QMF we can execute 1 query at a time,
SPUFI - by using SPUFI we can exeute multiple querys at a time
QMF - By using QMF we can we can identify error code
SPUFI - BY using SPUFI we can identify error in case of
query failure,
application programmer use SPUFI.
I THINK SPUFI IS BETTER
IBM
Suppose we have a query for update update table1 set col1 = 'val1' where
col2=(select .... from ...) suppose the subquery does not return any record, what will
happen to update? Answer
#1
If the col2 field having any null value then that value to
be updated.
If col2 doesn't have any null value then record remains same
nothing will be updated.
SYNTEL
CAPGEMINI
Re: why we go for SPUFI for creating tables or for sql queries? Answer
#1
By using SPUFI we can get the error code when the query fails, and at a
time we can execute multiple queries.
QMF doesn't support to execute multiple queries at a time.
CAPGEMINI
CTS
In db2, how do you insert multiple rows in 1 query using a.) Cursors, b.) Normal
query?? Give syntax for both. Answer
#1
We can insert by using the following command:-
SYNTEL
for right outer join--- it will give non matching rows also
from right table in addition to matching rows
for left outer join-- it will give non matching rows also
from left table in addtion to matching rows
TCS
how can u retrieve the data from null values using applicaion program. Answer
#1
whenever you are retreving the data from null coloumn,
first you need to declare the null indicator in the working
storage section. and use this variable when you are
fecthing the data from null coloumn.
how can u retrieve the data from null values using applicaion program. Answer
#2
The null indicator would be assigned a value of -1 if the
fetched column has a null value.
if any of the column names is provided wrong, where do you get the error(during
precompilation or during Bind) Answer
#1
Precompilation has got nothing to do with the column
checking, it is just the process of syntax checking and
separating the sql statements from the cobol program and
just prepares the dbrm.
Open orders_cur
fetch orders_cur....
SELECT SUBSTR(DESC_T,1,4)
FROM PRODUCT
WHERE PROD_I = 123456;
CAPGEMINI
Example:
HCL
what is the difference between declaring the cursor in WS section and Procedure
division? Answer
#1
As definition of cursor is non executable statement, it is
advisable not to define in procedure division as it may
misunderstood others.
we can define it any where only thing you have to take care
is definition of cursor should be prior to the OPEN
statement of the same cursor
Deloitte
Deloitte
Hi , I am posting some interview ques . what is the use of cursors ? what is the diff
between select and cursor ? bith are used for data retrival .. rite? Answer
#1
>>Cursors are memory structures used to handle multiple
rows at a time.
>>Though,select statement can fetch only multiple rows, we
cannot handle multiple rows using host variables.
Basic difference would be single row handling and multiple
rows handling.
How can we define a table? How can we apply SEARCH ALL on it ? Answer
#1
If u are asking about COBOL internal tables then it can be
defined with occurs clause.
SEARCH ALL is the binary search in COBOL with only one WHEN
Condition. Remember to declare the table with INDEX if you
want to apply SEARCH ALL on it.
expalain?
How to acess:
TCS
what is main use of table space and index object? please its urgent Answer
#2
>>Tablespace is one of the subdivision of Database in DB2.
Tables are created in Tablespaces.Indexspace is also a
subdivision of Database which contains indexes.
>>One imp difference is tablespace can contain one or more
tables whereas indexspace contains only one index for a table.
>>Tablespace has to be created by explicitly mentioning
create tablespace whereas indexspace is created implicitly
whenever we create an index using create index command.
>> Index is an object which can be considered as pointers to
rows of a table.
What is the use of COMMAREA ?Minimum how much data we can pass from it?
Answer
#1
COMMAREA is a communication area between COBOL and DB2. We
can pass maximum of 32k. If it is more than that we can use
the QUEUES
What are the abend codes occour in ur latest PROJECT in DB2 Answer
#1
-305 --->NULL value is moved to the HOST VARIABLE
-803 ---->DUPLICATE ROW INSERTION
-904 ---->DB@ Resources not avalable
-805 --->PLAN not FOUNd
-911/-913 -->TIME OUT DUE TO DEAD LOCK
What are the abend codes occour in ur latest PROJECT in DB2 Answer
#2
-803 ---->DUPLICATE ROW INSERTION
Identify the record for SQLCODE=-803 and rectify the issue.
-904 ---->DB@ Resources not avalable
Try to use display database and check the locks on which
pages.
DIS DB(MMLPDDDB) SPACENAM(MMLPD61T) LIMIT(*)
-805 --->PLAN not FOUNd
Rebind the package/plan.
-911/-913 -->TIME OUT DUE TO DEAD LOCK
1. change the lock size to 'ROW' for all the tablespaces(
tables) used in batch job program. here LOCKSIZE is a
tablespace property.
What is the use of DELGEN in DB2? Can we Write the program with out using it?
Answer
#2
DCLGEN(Declaration Genrator) is used to generate DB2
equivalent Cobol Datatypes. We can write a cobol Db2
program without using it but we will have to declare cobol
variables in our Program and for sure it need to be DB2
Equivalent... but it is preffered to use DCLgen as it gives
you the accurate... equivalent... of db2 datatype...and it
enhances the performance no doubt...
IBM
pls explain the precompilation process of cobol-db2 pgm Answer
#1
Precompilation separates the SQL statements and non-SQL
statements of an application program.
From the precompilation step onwards the original source
code will be contained in two separate physical components.
The non-sql part of the program will have all the
sql-statements commented out by the precompiler and and
replaced with cobol call statements.
The colection of SQL that was extracted will be placed in a
DBRM(Database Request Module).Precompiler also places a
consitency token in both of its outputs.
EX: if sqlcode=100
Display end of the table
end-if.
patni
can i code union in cobol-db2 pgm ? Answer
#2
Sure you can...union is like to check the existence row in
many differents tables...
: is there any restrictions for unions ? Answer
#1
yes, u have to code with the cursor.....
if i made sme changes in sub pgm wht r the things to be done for this ? Answer
#1
If that is static call, need to compile main program means
link edit the sub program and main program in compile
time(create only one load module).
i have one file having 100 of records? i want to display it like 20 records in one
column and 20 records in another column total 40 records per page ? how ? Answer
#1
you can't do that in Spufi....You could do it in the
program cobol...
you have to create 3 Pages...Each page you define 2 columns,
each columns you define 20 records..
how to u check the query is executing or not ?where will u check for sqlcode ?
Answer
#1
OH man...everytime, you execute a sql statement, u have to
check you SQLCODE = 0 or not = 0....this a basic using DB2,
Oracle....
how can u nderstand the sql stmts executed successfully or not ? Answer
#1
Oh man, you have to check SQLCODE for each SQL
stament...SQLCODE = 0 it's good.... SQLCODE not = 0 it's
bad.
OR you look in SQLCA... verify this SQLERRD
i have a db2 variable how do u declare tht into working storage section ? Answer
#1
the db2 variable can be declared in the working-storage
section by using the DCLGEN of the particular table.
Eg:
EXEC SQL
INCLUDE DCB0XXX
END-EXEC.
Plan has the optimized access path in it. But is that optimized access path is attained
or known Answer
#1
It is attained based on results from RUNSTATS utiliry. The Query
Optimizer derives it.
Can we declare cursor in Procudere division or open the cursor in the Working
storage section. Is there any particular rules in the usage of cursors lifecycle Answer
#1
yes we can declare cursor in procedure division but we cant
open the cursor in working-storage section as it is an
executabale statement.the lifecycle of cursor is as below
1>declare cursor
2>open cursor
3>fetch cursor
4>close cursor
Plan is an executable form of sql statements,But what exactly resides inside a Plan.
what are the details inside Plan. Answer
#1
Plan contains DBRM(machine level SQL statements) and
Optimized Access Path.
Plan is an executable form of sql statements,But what exactly resides inside a Plan.
what are the details inside Plan. Answer
#2
. Plans are created by BIND command on sysibm.sysplan. To
execute a package, you must 1st include it in the package
list of a PLAN, so they are only executed when the plan in
which they are contained executes.
PACKAGEs are related to a PLAN, and PLANs are related to
a COLLECTION-ID. So when we REBIND a Package we do not need
to BIND REPLACE the Plan.
What is the specific need of Plan and..where are the tables in DB2 are physically
saved Answer
#1
plan is nothing but executable form of sql statements and
formed by one or more dbrms, it is used for run the program,
without plan it will not run.
What is the specific need of Plan and..where are the tables in DB2 are physically
saved Answer
#2
Though the tables are stored logically in tables space and
physically all tables/table Spaces are stored in VSAM
files....so the ultimate pgysical storage of any database
object is a VSAM file.
wht is d/f b/w inner join and outer join ? d/f group by and order by having by ?
Answer
#2
INNER JOIN: ALL THE MATCHED ROWS FROM BOTH THE TABLES ARE
DISPLAYED IN THE RESULTANT TABLE.
OUTER JOIN: THERE ARE THREE TYPES OF OUTER JOIN
THEY ARE
1)LEFT OUTER JOIN
2)RIGHT OUTER JOIN
3)FULL OUTER JOIN
LEFT OUTER JOIN:- ALL THE MATCHED AND UNMATCHED ROWS FROM
BOTH TABLES FROM THE LEFT TABLE ARE DISPLAYED IN THE
RESULTANT TABLES
RIGHT OUTER JOIN:- ALL THE MATCHED AND UNMATCHED ROWS FROM
BOTH RIGHT TABLE ARE DISPLAYED IN THE RESULTANT TABLE.
FULL OUTER JOIN:- ALL THE MATCHED AND UNMATCHED ROWS FROM
BOTH THE TABLES ARE DISPLAYED IN THE RESULTANT TABLE.
GROUP BY CLAUSE:- IT IS USED ON GROUP OF DATA AND PROCESS AN
SQL QUERY.
ORDER BY:- IT IS USED TO SORT THE DATA IN ASCENDING OR
DESCENDING ORDER.
EX:- SELECT EMPID FROM EMP_TBL ORDER BY
DSC (OR) ORDER BY 1.
ORDER BY 1 i.e THE COLUMN NUMBER (EMPID)
HAVING BY:- IT IS USED FOR CONDITION CHECKING.
how to delete perticular row from table for ex. how you will delete 3rd row from
table please answer THANKS IN ADVANCE Answer
#4
delete from (SELECT * FROM (SELECT col1,rownumber() over()
as rn from table where col =value) as tr where rn = 3)
i have a table like this : Name ADDRESS Toto 123 ... Toto 456 ToTo 678 I would
like to delete 2 last row...please tell me how to delete its Answer
#3
delete from (select rownumber() over() as rowid from tab1 )
where rowid = ( (select count(*) from tab1) - 1)
i have a table like this : Name ADDRESS Toto 123 ... Toto 456 ToTo 678 I would
like to delete 2 last row...please tell me how to delete its Answer
#1
delete from table_name
where address = '456' and '678
Is it Possible to declare or create a cursor for UPDATE of table? If yes tell me how?
If no Tell me why? Answer
#1
yes, read this :
Updating a column: You can update columns in the rows that
you retrieve. Updating a row after you use a cursor to
retrieve it is called a positioned update. If you intend to
perform any positioned updates on the identified table,
include the FOR UPDATE clause. The FOR UPDATE clause has
two forms:
• The first form is FOR UPDATE OF column-list. Use
this form when you know in advance which columns you need
to update.
• The second form is FOR UPDATE, with no column list.
Use this form when you might use the cursor to update any
of the columns of the table.
For example, you can use this cursor to update only the
SALARY column of the employee table:
EXEC SQL
DECLARE C1 CURSOR FOR
SELECT EMPNO, FIRSTNME, MIDINIT, LASTNAME, SALARY
FROM DSN8810.EMP X
WHERE EXISTS
(SELECT *
FROM DSN8810.PROJ Y
WHERE X.EMPNO=Y.RESPEMP
AND Y.PROJNO=:GOODPROJ)
FOR UPDATE OF SALARY;
EXEC SQL
DECLARE C1 CURSOR FOR
SELECT EMPNO, FIRSTNME, MIDINIT, LASTNAME, SALARY
FROM DSN8810.EMP X
WHERE EXISTS
(SELECT *
FROM DSN8810.PROJ Y
WHERE X.EMPNO=Y.RESPEMP
AND Y.PROJNO=:GOODPROJ)
FOR UPDATE;
DB2 must do more processing when you use the FOR UPDATE
clause without a column list than when you use the FOR
UPDATE clause with a column list. Therefore, if you intend
to update only a few columns of a table, your program can
run more efficiently if you include a column list.
The precompiler options NOFOR and STDSQL affect the use of
the FOR UPDATE clause in static SQL statements. If you do
not specify the FOR UPDATE clause in a DECLARE CURSOR
statement, and you do not specify the STDSQL(YES) option or
the NOFOR precompiler options, you receive an error if you
execute a positioned UPDATE statement.
Cursors can be declared in both working-storage & procedure division, Agreed. But
is there any difference? If could you please suggest what is the difference. TIA
Answer
#5
yes there sre diffrence.
If we declare cursor in working storage section then it is
called as static cursor without parameters from cobol.
WORKING-STORAGE SECTION.
01 HV-EMPNO PIC 9(4) value 7934.
EXEC SQL
DEFINE C1 CURSOR FOR SELECT * FROM EMP WHERE EMPNO=HV-EMPNO
END-EXEC.
DYNAMIC CURSOR:
PROCEDURE DIVISION.
ACCEPT HV-EMPNO.
EXEC SQL
DECLARE C1 CURSOR FOR SELECT * FROM EMP WHERE EMPNO=:HV-
EMPNO
END-EXEC.
I hope now its clear for you. If you need more information
let me know.
So check the record from table .Fix the abend and restart
your job for the failed step.
Can you search give an array in the WHERE clause of a db2 query? Answer
#1
arrays are not supported by sql so trying to add an array in
a where clause of sql may throw some errors...
only dot operators are possibly used...
Can i insert bulk records into a db2 table using qmf of spufi only............!!! Answer
#1
Thru SPUFI/QMF/FileAID you can insert bulk records by
selecting the records from one table and inserting into
other one.
I have some 3 particular fields ..i want to know which all tables have those 3 fields.
Is there any way to identify.. can we know by quering system tables.. Answer
#1
select * from sysibm.syscolumns where name = <name you 3
columns here>
The above query to metadata will show you the list of table
names where these 3 columsn present
when we are tying to update a table having 100 rows. if the program abends when
updating 51 row . how to start updating again from the 51 row .what was the logic
Answer
#1
when we are tying to update a table having 100 rows.
if the program abends when updating 51 row . how to start
updating again from the 51 row .
what was the logic
Ans: The Possible answer would be..if you had used COMMIT
before 51st ROW .. the Former records
would have been updated in the table .. If No COMMIt was
used.. The whole transaction would have been
ROLLBACKED.
Now If you want to start a fresh Transaction and want to
start Updating directly from 51st Row
Then There are two ways
or
what is the difference between normal select query and currosor Answer
#2
using select in embedded sql with where clause should fetch
only one row , but cursor can be used when we need more rows
to be retrieved one at a time.
When DB2 connection fails, will online program work or give errors. Answer
#1
Online program will not work and it will give you abend
AEY9 when retry to use if connection has not been
established.
So REORG utility is run which will drop the index and create
the index again for the table.
What is image copy
how to resolve -818 error. how to see timestamp token in load module and plan
Answer
#1
BIND the application again, using the DBRM for the
application program that matches the object module.
In load module we can check timestamp.
for timestamp token Plan, check for BOUNDTS in
SYSIBM.SYSPLAN
when we are trying to update db2 rows. if the program abends . how we will know
that the last successful update row was Answer
#3
In SQLCA , we have field named SQLERRD . In SQLERRD(3) , the
no of rows successful updated (or) inserted can be found .
when we are trying to update db2 rows. if the program abends . how we will know
that the last successful update row was Answer
#1
We can go in Abend Aid and look for the source listing where
we can find the last values stored in Host Variables where
the Job Abended.
how to resolve -805 . how to see dbrm and package not found Answer
#1
I think u have to recompile and bind your program, then
look at jcl compile and bind , locate the package name
AND !!! GO TO SEE your DBA....
Why PS file called Physical seqential file?How to sore data in sequential file and
ESDS file? What is the use of DBRM,PLAN,package and Collection. Answer
#1
What is the use of DBRM,PLAN,package and Collection.??
4.easy maintanance.
COLLECTION
Display Array(Idx)
a cursor normally gets closed once we provide a commit . If u try to close the same
cursor with close cursor command later after providing the commit will there be
any sql-error. Answer
#1
when we try to close the cursor that is already closed, it
will return the SQL error code
i hav created a program and moved to production but failed to create the table
which is been used in the program. the program shows error as soon as it is moved
or installed in production or shows error during its runtime. what is the sqlcode for
this error Answer
#2
The code promotion will fail. When you promote the code
from one region to other (say QC to Production), the
program will be bound (BIND) to the new DB2 environment.
The BIND will fail with SQLCODE of -204 (Object Not found).
if there is a table with huge number of records and if i want to extract only first 3
records from the table, what query i have to provide to retreive first 3 records
Answer
#2
SELECT * FROM <qualifier>.<table_name>
FETCH FIRST 3 ROWS ONLY
WITH UR;
from account
where acc.name in
( select distinct acc.name
from account
group by acc.name
where count(acc.no) > 1)
What is the purpose of coding FETCH in a SQL SELECT query? Explain with an
example in Detail? Answer
#2
FETCH is used to retrieve a specific row from a result set
of the SELECT query and places them into local variables.
What is the purpose of the SDSNLOAD dataset in the STEPLIB while running
DB2 programs? Answer
#1
THE SDSNLOAD load library allows the batch job to access
the DB2 load modules.
Solution:
1. Rebind the program with the correct DBRM library name.
2. The plan name used in the JCL and the plan used for bind
should be same.
I have 3 cursors declared. Cursor1 retieves some data. Based on this curso2 will also
fetches some data. In cursor3 (using for some updation) I'm using the data retrieved
by the above 2 cursor. My question is, while working with cursor3, periodically if I
give commit, will all the three crsors will be closed or only cursor3 will be closed?
Answer
#1
COMMIT will close all the cursors, if the cursors are not
delcared using 'WITH HOLD'.
How to define the a field which accepts value till 99999.99 in db2 Answer
#2
in db2 decimal(7,2) & application cobol pgm 9(5)v99.
For unmatched rows returned from an outer join, the column values in the other
table are set to null e.g If A OUTER JOIN B returns some unmatched rows from A,
the corresponding column values in B will be set to null. What can be done so that a
null value is not displayed for these columns? Answer
#1
Use the COALESCE function
Suppose the outcome of executing a query results in a row having null. Based on the
answer how you use it? Its declaration and inclusion? Answer
#1
While declaring the cursor include the null indicator for
the variables which you are retrieiving from the table.
Example.
Is it possible to update a primary key value? If not, what is the error code given? If
yes, can more than 1 primary key column be updated at a time? Answer
#3
Primary key value can be updated as well provided the value
you update it with identifies it uniquely.
Is it possible to update a primary key value? If not, what is the error code given? If
yes, can more than 1 primary key column be updated at a time? Answer
#4
Ans 3 is correct. If the key already present, while
updating it will show the sql code as = -803.
Is it possible to update a primary key value? If not, what is the error code given? If
yes, can more than 1 primary key column be updated at a time? Answer
#5
further, multiple primary keys can be updated at time. Only
condition is that value should be unquie. else sql code -803
Is it possible to update a primary key value? If not, what is the error code given? If
yes, can more than 1 primary key column be updated at a time? Answer
#6
also remember, you cannot update a primary key when it has
matching foreign key values.
Can a unique index have more than one null value? If not, what error code is given
if an attempt is made to insert more than one null value? Answer
#2
Unique index can have null values and no null value is equal
to another null value.
Can a primary key have null values? If we try to insert a null value in a primary key
column, will it work or give an error code? Answer
#4
The PRIMARY KEY cannot be null. you can insert ZERO into
that but should not be null. It will throw an error if you
try to inserts a NULL.
Can a primary key have null values? If we try to insert a null value in a primary key
column, will it work or give an error code? Answer
#6
In DB2 you can not create a primary key on a column which
is not 'not null'.
If you are trying to create a primary key on a column which
is not 'not null' then dbb2 will return an error like this
But once u alter the table and set the column to 'NOT NULL'
then you can make it as primary key.
In short you can not make a column which can hold 'NULL'
value as your primary key and you can not insert a 'NULL'
value into your primary key feild.
V7 : 18
V8 : 30
In BIND, isolation level parameter specifies the duration of page lock and
ACQUIRE, RELEASE also do almost the same thing. What is the exact difference
between the two? Do they work in conjunction while executing SQL queries and
obtaining locks? Answer
#6
(1) Isolation specifies type of lock that should be used
(2) Acquire tells when the lock should be acquired
(3) Release tells when it should be unlocked
Is it Possible to read from PS file and write it to database by using dynamic
sql(execute immediate) Answer
#2
Using the Dynamic sql the preparation of bind-plan will be
costly. As you know the data it is advisable to use the
static sql directly.
If a table has a column "dept" (declared to have nulls) and there are 10 rows in the
table of which 3 have a null value in the dept column, what will select count(*) and
select count(distinct dept) return? Answer
#1
SELECT(*) Will return 10 and SELECT (distinct dept) will
return 8.
If a table has a column "dept" (declared to have nulls) and there are 10 rows in the
table of which 3 have a null value in the dept column, what will select count(*) and
select count(distinct dept) return? Answer
#2
select count(*) returns 10 --- this is right. But,
select count(distinct dept) returns 7. Because null values
are not considered as distinct.
Consider that a package is bound into 2 different collections and the PKLIST option
specifies both the collections. If the collection id is not specified in the program while
executing the SQL query, then when the DB2 system will search the package list,
which collection will it pick up or will it give an error/abend? Answer
#1
Generally when the search is done the order in which the
collection id is specified in the list would be taken for
priority.
What is the SQL query to select, delete and get count of duplicate rows in DB2?
Answer
#1
DELETE FROM (
SELECT ROWNUMBER() OVER (PARTITION BY c1, c2 ORDER BY c3
DESC) AS rnum FROM t1)
WHERE rnum > 1 ;
If we keep the DCLGEN structure for a table in a copybook and include it in the
COBOL program using the COPY statement, will there be any impact during
compilation or at any stage of program execution? Answer
#2
DCLGENs are processed by Precompiler.
If a non-DB2 program calls a DB2 program, the calling program's name will be
there in SYSIN of IKJEFT01 and the plan name will be that of the called program.
But is a bind needed or a plan has to be created for the non-DB2 program also?
Answer
#1
No Plan needs to be created for the Non-DB2 program. The
SYSTIN should be as below:
DSN SYSTEM(XXXX)
RUN PROGRAM(Non-DB2 Program name) PLAN(DB2 PROGRAM NAME)
END
Can SQL statements/queries be included in a copybook? Answer
#1
Yes, if the copybook is included with the precompiler
directive EXEC SQL INCLUDE. No, if one attempts to include
the copybook with a COBOL COPY directive.
Generally if I want to select the names starting with c I need to use c% But how
could I code to select the data which contains % as a part of data. Answer
#1
Use '%%' to select the data which contains %
When you are working with the project after coding what will u do? Like what type
of documents u will prepare? How will u do testing?
What value the host varible will contain , if null indicator value is -2 ? Will it
contain the truncated value or nothing will move ? Answer
#1
That Host Variable contain the Truncated value when Null
Indicator conatin value -2.
What if we try to insert the base table through updatable view , but failed to give a
column value which is defined as NOT NULL. Answer
#1
get error code "-407"
What if we try to insert the base table through updatable view , but failed to give a
column value which is defined as NOT NULL. Answer
#1
get error code "-407"
How Plan is created while executing the query using SPUFI? Answer
#1
No Plan is get created while executing the query using
SPUFI. SPUFI , QMF are only tools to check the correctness
of your query , i.e where ur query is correct or u have
coded anythig wrong .
What if , we failed to mentioed null indicator in sql select query , that may retrieve
null value ? Answer
#2
Sorry for the above answer :(
Please see the Correct answer, we will get the SQL error -
305
1. what if null values retrived from database and no null indicator mentioned in
query. What is sql code. Answer
#1
we will get the sql code "-305".
Can we able to find all the Table names under a Particular Plan? Answer
#1
Absolutely! Just look at the catalog table SYSIBM.SYSPLANDEP
It's pretty straight forward! It recrods the dependencies
of plans on tables, views, synonyms, table spaces, indexes,
aliases, functions and stored procedures.
My cobol program(not having any sql statements) is calling another cobol program
( having sql statements), what is needed for compilation and run in jcls . Answer
#1
Hi,
What error I will get if my select query gives multiple row while executing a Cobol-
DB2 program.How can I solve it without using a cursor. Answer
#1
-811 ERROR CODE
One program calling 5 subprograms, its a cobol db2 program, after precompilation
how many plans and packages will created? Answer
#1
when u precompile a Db2 program you will get (n+1) DBRMs
where n indicates no. of subprograms. So in our case you
will get 6 DBRMs. Through Binding process you can get
minimum of 1 package and maximum of 6 packages. But finally
you will get only one plan.
How to know the primary key of a table without defining the primary key in the
table? Answer
#2
you could use SYSIBM.SYSINDEXES table to know more about
the table index.
Count
Avg
Min
MAx
....
I have a table which has thousand of records i want to fetch only record num 100 to
record num 200. Write a query that satisfies this criteria.(Cant use any keys)
Anyone please reply ASAP!
I have a table which has thousand of records i want to fetch only record num 100 to
record num 200. Write a query that satisfies this criteria.(Cant use any keys)
Anyone please reply ASAP! Answer
# 13
YA THE ANSWER IS BY USING CURSORS ONLY
declare
cursor USER_Cursor
is select *
from <table_name>;
begin
COUNT1:=1;
open USER_Cursor;
close USER_Cursor;
end;
quary for 1> fetch last record 2> fetch in reverse order 3> fetch last 5 row 4> fetch
second last record (their is no primary key) i think concept of count can be use for
this in 4th Answer
#5
1) select id,name from tab1 order by id desc fetch first
row only
2) select id,name from tab1 order by id desc
3) select id,name from tab1 order by id desc fetch first 5
rows only
4) select id,count(*),name from tab1 order by id where count
(*) = (select count(*) from tab1)-1
why we create view. Answer
#1
I know a senario in which views are created.
Can we use select * statement in cobol program without giving field names ???
Answer
#2
Yes we can do it but as a practice people don't use "SELECT
*..." in COBOL program. Possibly the main reason for this
is that if there is any modification to the table in future
(e.g. a column addition) then all such programs needs to be
at least recompiled once even if there is no code changes
into them. This is ensure taht they use latest DCLGEN for
the modified table else the programs will abend for column
mismatch.
01 host-variables.
05 HV-col1-ARRAY PIC s9(04) COMP OCCURS 100 TIMES.
05 HV-col2-ARRAY PIC x(40) OCCURS 100 TIMES.
05 HV-vcol3-ARRAY OCCURS 100 TIMES.
49 HV-vcol3-len-ARRAY PIC s9(04) COMP.
49 HV-vcol3-txt-ARRAY PIC x(40).
05 HV-IND2-ARRAY PIC s9(04) COMP OCCURS 100 TIMES.
I
open cursor
Thanks;
Amita Sharma.
How we create a tables in DB2 ?Previously client has using 7 letters for user id,now
he wants to increase the letters from 7 to 12 for user id.How we can do it? Answer
#2
i think, the size of variable is not possible to change,
please correct me if i am wrong.
how many partitions are possible in partitioned tablespace? dont say 1-64. a)240
b)256 c)512 d)none Answer
#5
Unfortunately nonoe of the above answers are completely
correct. Answer posted by Nawal Kishore is partly correct
but not the complete answer. Answer from Vani may be partly
correct depending upon the DSSiZE and the page size. Let me
try to answer the question:
#5
hi all i hope this answer will help you
emp
eid ename dep
001 manikandan mainframe
002 karthi java
003 jarin mainframe
001 manikandan java
003 jarin testing
004 hariharan java
001 manikandan testing
para1:
do the same for storing the other half into the another
table.
if one db2 pgm calls another db2 pgm. how many plans do we need. what r the steps
involved.. Answer
#1
Hi buddy,
steps
what happend with out using Commit,when closing cursor and program? Answer
#3
yes, commit-it will save the changes that we done to db2
table
How to resolve SQL Code -310. The db table feild is declared as Decimal(7,2).
Answer
#1
Check your program and make sure that the data you are
passing to this host variable do not contain NON-DECIMAL
value.
I want to fetch the 10th row of a table which has been changed.How can I do it
without going thru all the rows. Answer
#5
DECLARE cursor_name sensitivity SCROLL CURSOR FOR
SELECT ... FROM ...
//ITQCT1J1 JOB
SIMOTIME,ACCOUNT,CLASS=1,MSGCLASS=0,NOTIFY=CSIP1
//STEP01 EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM (DSN)
RUN PROG (ITQCT1C1)
END
//
COBOL PROGRAM:
IDENTIFICATION DIVISION.
PROGRAM-ID. ITQCT1C1.
AUTHOR. SIMOTIME ENTERPRISES.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
************************************************************
*****
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
************************************************************
*****
* Data-structure for Title and Copyright...
* -------------------------------------------------
-----------
01 SIM-TITLE.
05 T1 pic X(11) value '* ITQCT1C1 '.
05 T2 pic X(34) value 'Create a Table and an
Index '.
05 T3 pic X(10) value ' v04.12.01'.
05 T4 pic X(24) value '
http://www.simotime.com'.
01 SIM-COPYRIGHT.
05 C1 pic X(11) value '* ITQCT1C1 '.
05 C2 pic X(20) value 'Copyright 1987-2006 '.
05 C3 pic X(28) value ' SimoTime Enterprises,
LLC '.
05 C4 pic X(20) value ' All Rights Reserved'.
01 SIM-THANKS-01.
05 C1 pic X(11) value '* ITQCT1C1 '.
05 C2 pic X(32) value 'Thank you for using this
sample '.
05 C3 pic X(32) value 'by SimoTime Enterprises,
LLC '.
05 C4 pic X(04) value ' '.
01 SIM-THANKS-02.
05 C1 pic X(11) value '* ITQCT1C1 '.
05 C2 pic X(32) value 'Please send comments or
suggesti'.
05 C3 pic X(32) value 'ons to
[email protected] '.
05 C4 pic X(04) value ' '.
************************************************************
*****
* Buffer used for posting messages to the console.
* -------------------------------------------------
-----------
01 MESSAGE-BUFFER.
05 MESSAGE-HEADER pic X(11) value '*
ITQCT1C1 '.
05 MESSAGE-TEXT pic X(68).
EXEC SQL
INCLUDE SQLCA
END-EXEC.
************************************************************
*****
PROCEDURE DIVISION.
perform Z-POST-COPYRIGHT
perform ITEMRDB1-CREATE-TABLE
perform ITEMRDB1-CREATE-INDEX
perform Z-THANK-YOU.
GOBACK.
************************************************************
*****
ITEMRDB1-CREATE-TABLE.
EXEC SQL
CREATE TABLE ITEMRDB1
(
ITQ1_NUMBER CHAR (12) NOT
NULL
PRIMARY KEY,
ITQ1_DESCRIPTION CHAR (48) NOT
NULL,
ITQ1_QTY_ONHAND INTEGER NOT
NULL
WITH
DEFAULT,
ITQ1_QTY_ALLOCATED INTEGER NOT
NULL
WITH
DEFAULT,
ITQ1_UNIT_MEASURE CHAR (16) NOT
NULL
WITH
DEFAULT,
ITQ1_COST DECIMAL (9, 2) NOT
NULL
WITH
DEFAULT,
ITQ1_PRICE DECIMAL (9, 2) NOT
NULL
WITH
DEFAULT,
ITQ1_LADATE CHAR (8) NOT
NULL
WITH
DEFAULT,
ITQ1_LATIME CHAR (8) NOT
NULL
WITH
DEFAULT,
ITQ1_TOKEN CHAR (8) NOT
NULL
WITH
DEFAULT,
ITQ1_D_CODE_1 CHAR (1) NOT
NULL
WITH
DEFAULT,
ITQ1_D_PERCENT_1 CHAR (7) NOT
NULL
WITH
DEFAULT
)
END-EXEC
if SQLCODE = 0
display 'Finished CREATE of ITEMRDB1 '
else
display 'ABENDING CREATE of ITEMRDB1 '
'SQLCODE = ' SQLCODE
add 16 to ZERO giving RETURN-CODE
end-if
exit.
************************************************************
*****
ITEMRDB1-CREATE-INDEX.
EXEC SQL
CREATE UNIQUE INDEX IDX1RDB1
ON ITEMRDB1(ITQ1_NUMBER ASC)
END-EXEC
if SQLCODE = 0
display 'Finished CREATE INDEX for ITEMRDB1 '
else
display 'ABENDING CREATE INDEX for ITEMRDB1 '
'SQLCODE = ' SQLCODE
add 16 to ZERO giving RETURN-CODE
end-if
exit.
************************************************************
*****
* The following Z-Routines perform administrative
tasks *
* for this
program. *
************************************************************
*****
Z-POST-COPYRIGHT.
display SIM-TITLE upon console
display SIM-COPYRIGHT upon console
exit.
************************************************************
*****
Z-POST-MESSAGE.
display MESSAGE-BUFFER upon console
move SPACES to MESSAGE-TEXT
exit.
************************************************************
*****
Z-THANK-YOU.
display SIM-THANKS-01 upon console
display SIM-THANKS-02 upon console
exit.
insert into tablename a column1, column2 select column1, column2 from tablename
b i am getting abend -104..can any one help? Answer
#2
insert into tablename(column1,column2)
select column1,column2 from tablename
Alias names 'a' and 'b' should not be used.In case u want
to use alias names, specify the column names with prefix as
a.column1,b.column2 like that.
Also, brackets must be given in an insert statement.
There is a 5000 EMP in company.how we find out the 5th highest getting salary
employee outof 5000 employes........ Answer
#1
select max(sal) from emp a where 5=(select count(distinct sal)
from emp b where a.sal<=b.sal);
There is a 5000 EMP in company.how we find out the 5th highest getting salary
employee outof 5000 employes........ Answer
#2
select * from emp A where 4 = (select count(*) from emp B
where A.sal<B.sal)
In cursor program-1 can we create another cursor program-2 inside the cursor
program-1.If yes how/no why ? Answer
#1
yes it can possible. Multibull cursor we can used.
SELECT A.NAME
,A.DEPTNAME
,B.DOJ
FROM EMP_TABLE A
,DEPT_TABLE.EMP_TABLE B
WHERE A.DEPTNO = B.DEPTNO
AND B.DOJ BETWEEN '01-01-2007' AND '01-01-2008'
;
what needs to be done if a table is in copy pending / check pending status? Answer
#2
use repair utility
REPAIR SET TABLESPACE DATABASE.TABLESPACENAME NOCOPYPEND
REPAIR SET TABLESPACE DATABASE.TABLESPACENAME NORCVRPEND
REPAIR SET TABLESPACE DATABASE.TABLESPACENAME NOCHECKPEND
My DB2 program first read the data from a file and then it look into a table with the
data it got from the file.If we did not bind the program , should the file read before
SQL execution be success?? Answer
#2
Program successfully reads the file as the Bind is only for
DB2 queries and it would give an abend(-805) once it
reaches the SQL statement.
why should we bind the DB2 program . What if we did not BIND a BD2 program ??
Answer
#4
ACTUALLY BIND PLAN CONSISTS OF DBRM SO IN DB2 WE NEED TO
CREATE UNIQUE PLAN NAME TO GET EXECTABLE LOAD MODULE AND
DURING RUN PROG WE NEED TO GIVE PLANNAME AND MODIFIED
SOURCE LIB .
what is a plan and how do you refer the plan in the program? Answer
#1
plan is executable.it contains access path.we will refer
plan in jcl as plan name.generally all information abt the
plan will be there in sysibm.sysplan
what are the frequent DB2 abends did you encounter in your programs ?? What are
different SQL abends ?? Answer
#3
-100 when the rows found.
-805 plan not found
-305 null indicator not declared
-104 invalid keyword
-199 illegal use of keyword
-206 table not foung
-310 for decimal column using non decimal
-407 try to insert the null value in the not null column
-501 try to close the curosr which are already open
-811 multirow select
-504 cursor not decalred
-818 time stamp mismatch
-180 date error
-181 date and time are invalid
-414 in the union the column are not same
-911
-913 both are for the deadlock
-904 for the resource not avable
-922 authorization failure
-924 coneection is not availbke
I have a DB2 table which has 1000 rows.after udatingg first 110 rows, my job
abends. Now what I have to do if I want to restart the job next time so that it should
start updating from 111th row (without updating first 110 rows again). Answer
#1
Instead of commiting at the last point, commit at certain
intervals (increase the frequency of commit, say after
every 100 records in this situation)
Do we have any optinon to search part of integer in DB2 as we have for character
Like,SUBSTR optins? Answer
#1
DIGITS will convert INTEGER to character string
SUBSTR(DIGITS(PARTID),5,1) ='9'
This will extract the 5th character and checks to see if it
is 9.
How to resolve the -305 error code in DB2? And also please let me know, how to
resolve the db2 error codes. Answer
#2
Before going to the solution, here is the explanation of a
null indicator.
[1]pwd
/var/ifor
[2]more nodelock
#
5fbee0ee6feb.02.09.15.0f.48.00.00.00
qifx7bndg9b48n7gafpsa "" "8.1"
#[admin_comment] "IBM Toronto Lab" "DB2 Enterprise Server
Ed (Cust)" "2145852000" "0" "1" ""
how does the defining of a stored procedure effect the size of a DB2 data base A) it
increases the size of a data base B) it decreases the size of a data base C) it does not
effect the size of the data base D) it changes the table space structures Answer
#1
a - it increases the size of a data base.
Because a stored proc is called from a program and the
stored proc is stored along with the DB..hence the size of
the db increases.
What do you mean by NOT NULL WITH DEFAULT? When will you use it?
Answer
#2
NOT NULL WITH DEFAULT indicates that the column cannot
contain a NULL, if a user doesnt enter a value, DB2
generates the default.
What is the difference between TYPE 1 index & TYPE 2 index Answer
#1
TYPE 1 index has subpages and uses index locking.
TYPE 2 index has no subpages and does data-only locking.
Tablespace DSNDB06.SYSDBASE
Indexes None
Links DSNDR#DL REFERENCES SYSIBM.SYSRELS
COBOL
if a dataset is already created with fixed length but after that i want to change fixed
length to variable length then how is it possible Answer
#2
we can do that using Jcl and passing FTOV in the sysin
parameter
wirte a pgm in using files in which we hav 10 ,20,30 40...100 records in inputfile and
i want them to be send to outputfile in reverse order. PLZ HELP ME OUT
.........THIS IS A RECENT QUESTION IN IGATE.. Answer
#2
However, if there are a fixed no. of records, as you have
mentioned in the question - which may not always be the
case with Production Files(They may contain millions of
records), you may follow this approach.
wirte a pgm in using files in which we hav 10 ,20,30 40...100 records in inputfile and
i want them to be send to outputfile in reverse order. PLZ HELP ME OUT
.........THIS IS A RECENT QUESTION IN IGATE.. Answer
#2
However, if there are a fixed no. of records, as you have
mentioned in the question - which may not always be the
case with Production Files(They may contain millions of
records), you may follow this approach.
i have a variable block which is used in my cobol program as input file having
records of 4080 after compilation while runing the program im getiing file attribut
mismatch and it is saying tht the record length of the file is 4084 can any one knw
the answer how to reslove it ? Answer
#1
For Variable length file(VB) first 4 characters are used to
store the length of each record. So if your record contains
4080 then actual length is 4080 + 4 = 4084.
how can you identify wheather the program is using search or search all in the cobol
program? Answer
#1
The identification will be depend on many ways
01 var1 pic x(10) 01 var2 redefines var1 pic 9(10). then in procedure division move
'abcde' to var1 then waht is the value of var1 and var2 Answer
#4
redefines will reuse the memory with irrespective of date
type var1 is abcde and var2 also abcde.
can we declare s9(9)v9(9) in cobol ? if yes how many bytes it will occupy ?(urgent
plz answer it) Answer
#4
s9(9)v9(9)
created cluster using IDCAMS ..that is empty ..when i write a program for read
using Input ..wil it open the cluster or gives any error? Answer
#1
Open statement itself fails when u try to open an empty
file.
How do u debug a S0C7 abend? (aswered till we get the field which caused that)
After knowing the field which caused that how do u know the record which caused
that if it is in production env? (dumb) Ok let us assume that we got to know that
100th record caused that and I wanted to skip only 100th record from the file and
process from 101th. How to do that in JCL using SORT? (tried with STOPAFT but
ended up dumb when he said smthing else is ther) Answer
#1
If you came to know which field is responsible for that.
you can run your testjcl with output file DISP parameter as
(NEW,CATLG,CATLG), by doing so, your output file will get
created irrespective of SOC7 abend becuase the last record
of your outuput file will be responsible for generating
abend.
Now you can strip off that record (because its bad data)
and run your jcl.
this will remove 100th record from your file and will copy
rest all records into ouptput file.
My interviewer ask A calls B and C calls B, a and b are static c and b are
dynamic.what happens if they compile and execute at same time. Answer
#1
in static call we cannot comile the main program without
compiling the subprg(B), you can get the error that is
object not found.
05 My-number.
10 My-number-part1 pic 9(15).
10 My-number-part2 pic 9(5).
z(2) occupies two bytes and will supress the leading zeros
z9(2) occupies 3 bytes and will supress the leading zeros
in the first byte.
Suppose, file A has 100 records and file B has 500 records. We want to write records
common to both A and B into file C and records which are present only in either A
or B into another file D. What should be the logic of Cobol program to achieve this?
Answer
#5
correction to #3
sort files Asc
if f1 = f2
move file1-rec to file3-rec. write file3-rec
read f1 & f2.
if f1 < f2
move file1-rec to file4-rec. write file4-rec.
read f1.
if f1 > f2
move file2-rec to file4-rec. write file4-rec
read f2.
u have passed sme charecters thru parm parameter in jcl. how do u code in cobol to
recieve the values u gave in parm ? Answer
#1
by using 'USING' keyword in procedure division and dataname.
one restriction is, declaring length variable and dataname
in linkage section of covol program.