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

I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?

0 Answers  


How to delete the records of a dataset through cobol programme?We should not use jcl utilitities like IDCAMS.

2 Answers  


There are two flat files one having 10 records and other having 5 records. write a cobol pgm to find the duplicate records(matching records)from both files.

1 Answers   Mind Tree,


Hi, My interviewer ask A calls B and C calls B, a and b are static c and b are dynamic.what happens if they compile and execute at same time.

3 Answers   iGate,


S9(5)V9(2) occupies how many bytes memory ?

6 Answers   Cap Gemini,






Determine the total no of bytes in the following. 01 rec1. 02 a pic x(6) 02 b redefines a. 03 c occus 6 times pic 9. 02 d occurs 6 times pic 9. 03 e pic x(5) 03 f pic 999.

12 Answers  


what is the basic concept of mainframe? what knowledge is needed for learn this mainframe?

4 Answers   CSE, TCS, Wipro,


what is the difference between Plan & package?

1 Answers   IBM,


hai friends ,i have HSBc exam on this sunday,my platform is Mainframe,i have 1 year exp,pls any one send me placement papers of Hsbc and technical questions on mainframe

6 Answers   Citi Bank, CitiGroup, HSBC, iNautix, Wipro,


If we use GO BACK instead of STOP RUN in cobol?

2 Answers   Temenos,


A cobol program to read a file , match it with other if. If match occurs then write it to an output file. If no match then no need to write it.Error log created by program to track any error.

1 Answers  


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 C3 D.C1 AND C2 OR C3 given the above information which of the following statements are valid? a.only A,B and C are TRUE b.only A,C and D are TRUE c.A,B,C and D are TRUE d.only C and D are TRUE

1 Answers   TCS,


Categories