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

In COBOL CALL-CALLING,if a program A is calling 3 sub- programs, dynamically, then it is said sub-programs will always will always in Initial Mode. My question is : Do we need to code CANCEL or (IS INITIAL) for dynamically called sub-programs or it is the property of Dynamically called pgms so every time sub-pgms are called they will be in initial mode. ***This question is only Dynamic call****, Please reply. Thank you in advance.

4 Answers   Wipro,


How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning.

7 Answers   CGI, TCS,


How can you submit a job from COBOL programs?

2 Answers   ITC Infotech,


Difference between file status codes 02 and 22.... since both are for duplicate key detection.

1 Answers  


How is sign stored in a COMP field ?

3 Answers   Accenture,


01 a pic s9(5) occupies how many bytes ?

9 Answers   Wipro,


How do pass the values to the parameters in cobol

2 Answers  


01 a pic x(4) value 'abcd' 01 b pic 9(3) can we move from a to b.if possible what would be stored in b.

15 Answers   ACS,


wht is load module and object module ?

2 Answers   DELL, TCS,


is it possible to rename 01 level?

4 Answers  


wht is the diff b/w if and evaluate stmts ?

2 Answers   DELL,


Have you code any new programs in COBOL ? What is the functionality of the programs?

2 Answers   Patni, Xansa,


Categories