GeekInterview.com
Series: Subject: Topic:

COBOL Interview Questions

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

Cobol divisions

Asked By: mearle | Asked On: Jan 11th, 2009

What are the four divisions in cobol

Star Read Best Answer

Editorial / Best Answer

Answered by: venkat65318

Member Since Sep-2009 | Answered On : Sep 13th, 2009

In Cobol there are 4 divisions.

1. Identification division or ID division
In this no setions are there. It has 5 paragraphs.
a. Progaram-id. programname
b. Author
c. Writen-date
d. Compiled-date
e. Installer

2. Environment Division
Under this there are two sub-sections
a. Configuration-section.
     Source compter.
     Object computer.
b. Input-Output section.
     File control.
     IO control.

3. Data Division
File-section.
Working-storage section.
Linkage section.
Report section.
Screen section.

4. Procedure Division

Answered by: saurabh bandyopadhyay on: May 25th, 2012

There is another section in Data division; named as LOCAL-STORAGE SECTION.

For a recursive cobol program, you need to use that section to hold the current values of each variable while the program run.

Regards,
Saurabh Bandyopadhyay.
Mainframe Developer, India.

Answered by: Nithya on: May 10th, 2012

IDENTIFICATION DIVISION */ mandatory */should contain PROGRAM-ID ENVIRONMENT DIVISION ...

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: Nik on: May 14th, 2012

Have you tried doing this -

Code
  1. MOVE FUNCTION REVERSE(WS-A) TO WS-B

Answered by: abdul muneer on: Feb 17th, 2012

Yes we can reverse a string by using move reference modification concept
eg:01 name pic x(4).
01 rname pic x(4).
move name(1:1) to rname(4:1).
move name(2:1) to rname(3:1).
move name(3:1) to rname(2:1).
move name(4:1) to rname(1:1).

Can redefines clause be used in file section, if yes at which level number ?

Asked By: Interview Candidate | Asked On: Sep 1st, 2005

Answered by: BALASUKUMAR on: May 10th, 2012

Cant used redefines clause in file-section.

Answered by: vardhan.frd on: Dec 21st, 2011

Code
  1. 01 CUSTOMER-DATA.
  2.    05 CUSTOMER-ID                          PIC X(10).
  3.    05 CUSTOMER-ID-PARTS REDEFINES CUSTOMER-ID.
  4.       10 LOCATION                          PIC X(3).
  5.       10 NAME-ABREV                        PIC X(5).

Can we use redefine clause in occurs clause?

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

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

NO.occurs cant be redefined.

Answered by: balasukumar on: May 10th, 2012

no. why because occurs cant be used for redefines clause.

Chkpt and commit in cobol-ims pgm.

Asked By: vardhan.frd | Asked On: Apr 27th, 2012

How to create chkpnt and commit in imsdb-ocobol pgm.?

Answered by: jithinraghav on: May 3rd, 2012

This Checkpoint/Restart logic is for the commit for the 100 ISRT/DLET IMS calls. In Data Division first we need to give both restart length and checkpoint length as below. 01 RESTART-SEGMENT-LENGTH ...

How to pass the parameter in parm using linkage section ? (syntax)?

Asked By: kapilymca | Asked On: Nov 14th, 2006

Answered by: gandikotasiva on: Apr 27th, 2012

PARM is used to pass data from JCL to COBOL
we can pass max of 100 bytes
first 2 bytes are reserved to length
thus we can pass only 98 bytes of data
--------------
Let me know if u need more information

Answered by: raghava on: Apr 12th, 2012

in jcl:

Code
  1. step1 execf pgm=xyz,parm=raghava

in cobol :

Code
  1. linkage section
  2.                 05 ln-var.
  3.                      10 ln-temp pic x(10).
  4.              procedure division using ln-var.

Usage of copy statement in cobol

Asked By: rpg0247 | Asked On: Dec 25th, 2011

Hi, can any one tell how to use copybook in cobol, and please explain with file structure(means I am using 5 fields of file and I want to declare them in copybook and and I want use it in cobol programming)

Answered by: gandikotasiva on: Apr 27th, 2012

Don't forget to specify the library where that copy book resides ie.., in SYSLIB

Answered by: rasheeed17 on: Jan 3rd, 2012

Workinfg-storage section. pds: TEST.RASH.LIB.ABC.COPY(COPYBK1) 02 VAR-LIST. 05 VAR1 PIC X(10) 05 VAR2 PIC X(10) 05 VAR3 PIC X(10) 05 VAR4 PIC X(10) 05 VAR5 PIC X(10) TEST.RASH.LIB.ABC.PROG(TESTP...

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: vardhan.frd on: Apr 4th, 2012

SOC7 ERROR bcaz whenever ws-var1 is redefined by ws-var2 (num),the numeric pic 9(5) stands in-front of Alphanumeric pic x(5) and so it takes the values anything that comes to ws-var1.if once any varia...

Answered by: guptavik1 on: Aug 27th, 2011

WS-VAR1='ABCDE' and WS-VAR2=Junk or LOW-Values.

If we will MOVE 'ABCDE' TO WS-VAR2. Then it will give SOC abend.

What is xref?

Asked By: vardhan.frd | Asked On: Jan 19th, 2012

Answered by: Lokesh M on: Feb 10th, 2012

XRef data is written for Assembler, COBOL, or PL/I programs. XREF makes the Compiler produce a cross-reference listing. XRef data is written for the file and each field in the file that are accessed in the program using an
EXEC ADABAS GENERATE or a COPY statement.

Where do use low-value and high-value in cobol. Also explain which kind of values they represent?

Asked By: sekhargupta | Asked On: Jul 8th, 2007

Answered by: Meetal on: Feb 6th, 2012

One correction in example given above post ofr Ifrank. We can not move HIGH-VALUES/LOW-VALUES to PIC 9 (NUMERIC FIELD) . We can onlye move in PIC X (ALPHANUMERIC)

Answered by: lfrank on: Jan 8th, 2008

LOW-VALUE represents X'00' and HIGH-VALUE represents X'FF'. These equate to  the lower and upper limits of the collating sequence. All other values fall in between. There are...

There are 2 files. These 2 files contains some common (duplicate) records. How do you copy these common (matching) records into third file. Suggest the answer using cobol as well as through jcl.

Asked By: sekhargupta | Asked On: Jul 8th, 2007

Answered by: Praful on: Jan 31st, 2012

In COBOL :=> Before execution get both the files in sorted order say Ascending. In PGM use Evaluate statement as Evaluate when Rec_key_ file_1 = Rec_key_ file_2 Write rec. read file1. Read file2. ...

Answered by: Madhavi Chava on: Jan 21st, 2012

"cobol //SORT1 EXEC PGM=SORT //SORTJNF1 DD * 00000111111 000001234567 LOCAL ===== 00000333333 000003456789 LOCAL ===== 00000555555 000005678901 EXTRN ===== 00000666666 0000067...

Which division in a cobol program contains the description of incoming and outgoing data?

Asked By: ljalt514 | Asked On: Jan 24th, 2012

Answered by: madhavi_csit on: Jan 27th, 2012

Data Division

How do you delete specific record using cobol

Asked By: raju_68 | Asked On: May 7th, 2008

I want delete one record from the file that is50 th record how can we delete ...?

Answered by: Hussain on: Jan 25th, 2012

In normal dasds the data cant be deleted where we like for that ksds vsam files are used there we have option of index and randomly picking of data we want.So by file handling we can delete the 50th r...

Answered by: Madhavi Chava on: Jan 19th, 2012

It is NOT possible to delete records of a seq file. If you do not want a specific record to be kept in a seq file any more, all you can do is to modify the contents of the record so that it contains s...

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: 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...

Answered by: burelamanohar on: Dec 13th, 2011

I tried REVERSE and REVERSED, but compiler is not recognizing them as keywords. We can achieve this by using SORT.

What is inspect in cobol ?

Asked By: valimasthan | Asked On: Oct 6th, 2011

Answered by: rasheeed17 on: Jan 19th, 2012

Inspect is a kind String function in COBOL, examples given by PKK are pretty good

Answered by: PKK on: Dec 9th, 2011

Individual characters in a field can be accessed and possibly changed by use of the INSPECT verb. INSPECT is used with TALLYING option to count designated characters. eg: INSPECT WS-A TALLYING...

What is file status 39 in cobol?

Asked By: vardhan.frd | Asked On: Jan 8th, 2012

Lrecl and block size mismatch .Can anyone explain in detail...

Answered by: R.Rajeshwari on: Jan 13th, 2012

Mismatch in LRECL or BLOCKSIZE or RECFM between your COBOL pgm & the JCL (or the dataset label). You will get file status 39 on an OPEN.

What is an index for tables?

Asked By: sprabodhini | Asked On: May 7th, 2008

Answered by: vivek on: Dec 30th, 2011

Actually Index is a register variable in COBOL, which will tell about the displacement ; as Subscripts are telling about the occurrences only. And there will be no need to declare them in Working Storage section.

Answered by: ramesh4greek on: Jun 11th, 2010

Index can be used to search the data in tables. Here Index represents the searching coloumn or field value of the table.

Move x to xx

Asked By: katar_s | Asked On: May 6th, 2011

A pic x(1) value a.B pic x(2) value spaces.If move a to b. What is the value of b. Is it ' a' or 'a '.

Answered by: vardhan.frd on: Dec 21st, 2011

The answer is A

Answered by: talluri on: Jul 27th, 2011

alpha numeric data insertion is write justification so the answer is "a "

What is difference between comp & comp-4?

Asked By: Interview Candidate | Asked On: Sep 3rd, 2005

Answered by: ansgar on: Dec 13th, 2011

Not always correct. In our computer Comp = Comp-3.
So always check the manual of the compiler.

Answered by: Kamal on: Nov 16th, 2007

For all of you out who have not heard about comp-4. Wake up. Comp-4 does exist and it is just like comp - ie. it is a half-word (2 bytes).This might help those of you who are confused about comp ...

What is the difference between copy and include

Asked By: itsme20 | Asked On: Mar 19th, 2007

Answered by: burelamanohar on: Dec 13th, 2011

I have used COPY in simple COBOL program (without DB2) and my program got compiled with return code 0. I think we can use the COPY for programs which doesnt use DCLGEN? Plz correct me if I am wrong.

Answered by: sankar on: Jul 27th, 2011

include means it expands the statements in the precompilation time but copy means it just retrieves the statements at compile time.

First | Prev | | Next | Last Page

 

 

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Career Counselling

 Have Career Question?

 Ask Chandra

 Ask Only Career questions.

Follow us:
 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, click "Subscribe".