Follow Our FB Page << >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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

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

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


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.

call 'nodays' using date1,date2,nodays.

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

write your logic.
exit program.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More COBOL Interview Questions

can you declare redefine in level 01?

8 Answers   Patni,

when SE37 SB37 and sd37 occurs how to increase the volume , primary quantity and secondary quantity?

1 Answers   Hewitt,

What kind of error is trapped by on size error option?

0 Answers  

With in these three which one is the default one Call Reference, Call By Value, Call By Content.-Which one is default?

4 Answers   IBM,

Hi................... I have records like this aaaa cccc bbbb And i want output like this bbbb cccc aaaa How can it possible ?. Note:Please make sure records are in unsorted order. somebody plzzz help me.

1 Answers  

How many sections are there in data division in COBOL?

0 Answers   B-Ways TecnoSoft,

What is an in line PERFORM? When would you use it? Anything else to say about it?

4 Answers  

comp-3 field occupy?

5 Answers  

How do you set a return code to the JCL from a COBOL program?

4 Answers  

What is the linkage section?

4 Answers  

what is the advantage of sync class

3 Answers   ACS,

can we read records in a file from botom to top. if possible how can we read

12 Answers   ACS,