Series: Subject: Topic:

COBOL Interview Questions

Showing Questions 1 - 20 of 233 Questions
First | Prev | | Next | Last Page
Sort by: 

How many bytes occupied following comp example?

Asked By: Josephvincent2014 | Asked On: Oct 14th, 2014

Dear friends, this is regarding cobol comp. pic x(3) occupy the 3 bytes... But pic 9(3)v9(7) comp occupied how much bytes? i said in interview that 10/2 = 5 bytes. V is specified for decimal point. is that correct? But interviewer looked at me differently when I said this answer? if you are more...

Answered by: santoshkumar on: Oct 23rd, 2014

The length is 8 byte it is find by using LENGTH OF clause.

In the example below 05 ws-var1 pic x(5),05 ws-var2 redefines wa-var1 pic 9(5),procedure division move 'abcde' to ws-var1.Now what is the value of ws-var1 and ws-var2 ?

Asked By: Interview Candidate | Asked On: Aug 12th, 2005

Answered by: NAGA SUDHINDRA on: Oct 13th, 2014

wen we define the variables in the w-s section we can intialize the variables with spaces and zeros to avoid junk values.The program does not throws any error wen we try to display the var2 .Wen we tr...

Answered by: Harsha on: Jul 24th, 2014

Both will have the same values. But when you display WS-VAR2 or do any sort of arithmetic operation, you will get S0C7.

Consider the following piece of code 01 group-item 05 amount-1 pic 99v9 usage comp value 50 05 amount-2 pic 9(4)v99 usage comp move zero to group-item add 50 to amount-1 what will be the content...

Asked By: Interview Candidate | Asked On: Aug 20th, 2002

Answered by: mohit on: Oct 9th, 2014

Answer is (a) because
already value will be there like 50.0 (99v9)
and again if we are moving the value to amount-1 it will become 50.0+50.0 = 100.
and comp field can contain decimal value.

Answered by: Rishu on: Jul 28th, 2014

Answer is 50. COMP can have decimal numbers as well. Check IBM manuals

Is there any condition in cobol to check the variable has any special characters?

Asked By: seshu | Asked On: Jul 20th, 2006

Answered by: Pranab on: Sep 13th, 2014

Through "Inspect" verb its possible. like, if you want to search $ in var1 than - INSPECT VAR1 TELLING TELLY1 ALL $ DELIMITED BY SIZE.

if TELLY is >0 then it is having the special character $.

Answered by: sangramkc on: Jan 10th, 2007

Hi,In COBOL there are only two clouse for this type of check IS NUMERIC & IS ALPHABETIC let's take examplee.g A PIC X(01) VALUE '$'We can check following procedure divisionIF A IS NUMERIC ...

What is linkage section? Can we use this concept when there's no called program?

Asked By: Suganj | Asked On: Apr 20th, 2007

Answered by: Pradeep CR on: Aug 28th, 2014

Linkage basically used for to receive date, that is external to the program. So you can able to send the data to the processing program by JCL through PARM parameter. For this you have to declare 2byt...

Answered by: Rishi Sharma on: Jun 11th, 2014

You can certainly declare the variables in Linkage section even if you are not using them to call any external program. it wont result in error, but anyhow they wont get populated unless u receive data into them or populate them yourself to pass data to some called program.

I hope this helps !!!

Copy statement

Asked By: RanjithJ | Asked On: Mar 14th, 2009

Which one of the following copy statement is correct?1) copy copyfile replace ==pre-== ==wk-==2) copy copyfile replacing =pre-= =wk-=3) copy copyfile suppress4) copy replacing ==pre-== ==wk-== in copyfile5) copy suppress copyfile

Answered by: Rishu on: Jul 27th, 2014

1st one the answer

Answered by: mandadilaxman on: Feb 3rd, 2011

Copylib is create one member is write some block of codeĀ and use in this code in which you want code on this use"copy copylibname"

Cobol file handling

Asked By: rpg0247 | Asked On: Jun 29th, 2011

How do you read a file in reverse order through cobol program?

Answered by: Harsha on: Jul 26th, 2014

In CICS, we can read the file in reverse order using READPREV command. In batch is not possible to read file in reverse order. Instead sort the file in reverse order and then read in COBOL program

Answered by: rasheeed17 on: Jan 19th, 2012

I have never seen any keyword like REVERSE or REVERSED in COBOL. - If you want to read the file in reverse order, first sort you file so that you get the records in reverse order then read the file s...

Can we use redefine clause in occurs clause?

Asked By: vinayk | Asked On: Feb 18th, 2006

Answered by: Harsha on: Jul 25th, 2014

Redefine with occur is possible
Redefine within occur is possible
Occur within redefine is possible
Redefining occur clause is not possible

Let me know if anything is not clear

Answered by: ARPANA K CHANDRA on: May 10th, 2012

NO.occurs cant be redefined.

What is difference between s9(04) comp and 9(04) comp? (cobol comp with s and without s)

Asked By: mannurusrinivasulareddy | Asked On: Sep 2nd, 2012

Answered by: Harsha on: Jul 24th, 2014

Both are binary values. One can have + or - values while other can only have + values

Answered by: Pradip Wagh on: Apr 17th, 2014

First is Binary storage and Second one is just Numeric storage.
Also, First will take 2 bytes of storage whereas Second one requires 4 Bytes of memory.

Correct me if I am wrong.!!!

Consider two data items 77 w-a pic 9(3)v99 value 23.75 77 w-b pic zz9v99 value 123.45 after the statement move w-a to w-b what will be w-b value? A.123.75 b.B23.75 (where b indicates space) c.023.75...

Asked By: Interview Candidate | Asked On: Aug 20th, 2002

Answered by: Lalit Pant on: Jul 10th, 2014

Option b

Answered by: Rishi Sharma on: Jun 11th, 2014

Sorry Shashi and Soumya but this will work and answer would be B

Use of comp fields?

Asked By: clrMFint | Asked On: Feb 20th, 2014

Is there any use of using comp fields other than betwee space utilization?

Answered by: Rohit Dwivedi on: Jun 3rd, 2014

For getting precision in the mathematical calculation the Comp variables provide more precisions as well rather than simple Numeric and Decimal values

Can we reverse the string in cobol ? See the following problem : 77 name pic x(10) value 'manoj', 77 srname pic x(10).I want jonam in srname.

Asked By: manoj | Asked On: Jul 21st, 2006

Answered by: Rishi Sharma on: May 22nd, 2014

Yes it can be done by following code:

  1.  MOVE FUNCTION REVERSE(WS-String) TO WS-Reversed-String

Answered by: RAMESH on: Jul 3rd, 2012


How to remove the duplicate records present in a PS dataset using jcl?

Asked By: Radha | Asked On: Sep 13th, 2005

Answered by: Mahaveer on: Feb 1st, 2014


Answered by: Raja on: Sep 25th, 2007

Hi,The XSUM parameter cannot be given with the sort card. It should be given in the SUM FIELDS card. You should write as follows://SYSIN  DD * SORT FIELDS=(40,6,PD,A) SUM FIELDS=NONE,XSUM/*

Called and calling program for cobol with cursor

Asked By: harish.jamkhande | Asked On: Jun 11th, 2012

I have program a which is calling b first time. B program is feaching data using cursor , but some mess happened and the control went back to pro a without closing cursor . Once again program a called program b then what will happen to cursor. Will program fetch the data.

Answered by: TJ on: Jan 22nd, 2014

I think it will throw SQL error code -502 i.e. when it will try to open the cursor that is already open.

Answered by: Latha on: Jul 16th, 2012

Program B will throw an error while it is trying to open the cursor again, which is already opened.

How will you analyze a cobol program?

Asked By: ankoo | Asked On: Oct 25th, 2012

Hi, i was asked in interview how would you analyze a cobol program? i gave the ans as there are many kind of analyses -: requirement analysis root cause analysis impact analysis problem / logic analysis but in general we talk about problem finding in a program and told him we would first go in for...

Answered by: abhishek on: Jan 21st, 2014

Local-Storage is allocated each time the program is called and is de-allocated when the program returns via an EXIT PROGRAM, GOBACK, or STOP RUN. Any data items with a VALUE clauses are initialized to...

Answered by: davindersingh29 on: May 17th, 2013

Second part of your answer seems satisfactory. You should have asked the interviewer for what we need to analyze, if its just for document purpose, then your answer is right. If its for a change, then there are specific areas we need to analyze for the changes impact.

What is set to true all about, anyway?

Asked By: Interview Candidate | Asked On: Sep 29th, 2004

In cobol ii the 88 levels can be set rather than moving their associated values to the related data item. (web note: this change is not one of cobol ii's better specifications.)

Answered by: Nath on: Sep 13th, 2013

@poojaDeep & @gilbat82, As you said, I have three doubts. 1. While starting execution of the program after declaring in working storage as you said, what are the initial values (TRUE or FALSE) are s...

Answered by: gilbat82 on: Jul 15th, 2008

Last answer is correct and below example also.e.g. 05  ACCOUNT-TYPE         PIC X(01) VALUE 'N'.        &nb...

C1 c2 c3 are three conditions whose truth values are as folloes. C1-true c2-false c3-true a,b,c are defined as given below a:c1 and(not c2) or c3 b.(not c1) or (not c2 and not c3) c.(c1 or c2)and...

Asked By: Interview Candidate | Asked On: Aug 20th, 2002

Answered by: Chinnu Ann Jose on: Aug 21st, 2013


Answered by: charanjeet kaur on: Jun 9th, 2013


What is local storage section in cobol ?

Asked By: dtiwar | Asked On: Sep 27th, 2011

Answered by: davindersingh29 on: May 17th, 2013

Just to add, my two cents: Data items in the LOCAL-STORAGE SECTION are automatically allocated for each instance of a program invocation. When a program runs in multiple threads simultaneously, each ...

Answered by: Toleshwar on: Mar 14th, 2013

Local storage section is a section of Data Division of Cobol which is similar to the Working storage section. The only difference being that the variables in the Local Storage always get initialised w...

What is difference between initialize and value?

Asked By: p.srinivas | Asked On: Aug 30th, 2006

Answered by: nagaraju on: Apr 30th, 2013

value : value clause is used to initialize values at working storage section only. i.e.., giving the values at declaration time initialize : this verb is used in 2 ways. 1) used to supply the init...

Answered by: talluri on: Jul 27th, 2011

INITIALIZE verb is used to refresh the alphabetic & alphanumeric empty fields with SPACES and numeric empty fields with ZEROS

What is the use of level 49 in cobol?

Asked By: LC Sharma | Asked On: Jan 12th, 2007

Answered by: snehali on: Apr 2nd, 2013

The level number 02 to 49 are use to specify the group and elementary data items within a record.

Answered by: Vaneeshkhurana on: Mar 21st, 2010

Although level 02-49 level are group or elementry elements but sometimes 49 are used for dynmic SQL, i.e.01 WS-SQl-statement1-VARIABLE.    49  WS-SQL-STATEMENT1-LEN  &nbs...

First | Prev | | Next | Last Page





twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.