What are subroutines ? and how do we pass data to the sub
routines?
Answers were Sorted based on User's Feedback
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 |
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 |
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.
How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning.
How can you submit a job from COBOL programs?
Difference between file status codes 02 and 22.... since both are for duplicate key detection.
How is sign stored in a COMP field ?
01 a pic s9(5) occupies how many bytes ?
How do pass the values to the parameters in cobol
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.
wht is load module and object module ?
is it possible to rename 01 level?
wht is the diff b/w if and evaluate stmts ?
Have you code any new programs in COBOL ? What is the functionality of the programs?