What are subroutines ? and how do we pass data to the sub
routines?

Answers were Sorted based on User's Feedback



What are subroutines ? and how do we pass data to the sub routines?..

Answer / harish

subroutines are normal cobol program called by another
program...

so data passed through linkake section

in main prog we have to code

call 'sub' using a1,a2

then in subprog accept these a1 and a2 with same name or
differnt doesnt matter

then in procedure division

procedure division using a1,a2.
.........

pls correct me if anything wrong


HARISH POOMGAME SHIVAPPA
NIIT TECHNOLOGY
KOLKATA

Is This Answer Correct ?    5 Yes 1 No

What are subroutines ? and how do we pass data to the sub routines?..

Answer / ramanuajam

subroutines are usefull, it can reduce the redendency.
and we can minimise code.

Ex. I have finance project. I need noof day calculation
between todates for every program.
I wont write this code in ever program.
i pass the date1, date2 and noof days through main program.
like

main1.cob
call 'nodays' using date1,date2,nodays.

sub.cob
linkage section.
01 wdate1 pic 9(8).
01 wdate2 pic 9(8).
01 wnodays pic 9(4).
procedure division using wdate1,wdate2,wnodays.
mm.

write your logic.
exit program.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More COBOL Interview Questions

if we have a 10 steps how to override the 4th step in jcl?

2 Answers   Hewitt,


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

5 Answers   iGate,


Describe the difference between subscripting and indexing ?

2 Answers  


We know that size of redefine and redefining need not to be same..Then does the below case true 01 ws-date pic 9(6). 01 ws-redf-date REDEFINES ws-date 05 ws-year pic 9(4) 05 ws-mon pic 9(2) 05 ws-day pic 9(2)

1 Answers   Cap Gemini,


I have a seq file with different fields one field is address with pic x(50) as input in a cobol program. In address there is 'PUNE' at any different positions in the address field ( form 1 t0 50) . My requirement is select the fields with address 'PUNE' by using cobol. Please suggest

2 Answers   IBM,






What is the difference between write & move in COBOL?

3 Answers   CSC, HHB,


In which area will you utilize 88 level items in cobol?

0 Answers  


Q:what is the difference between the variable length and fixed lenght.how it varies in the cobol.

12 Answers   CTS, Wipro,


What is difference between static and dynamic call in cobol?

0 Answers  


i have mainprogram and subgram...if i compile mainprogram without stop run..what will u get in compilation time?

1 Answers   HCL,


Why we are using comp and comp-3 in real time projects?

4 Answers   IBM,


If i initialize the 01 level variable in array, will it initialize all the array elements (occurs)?

8 Answers   CTS,


Categories