Program A calls program B. Will the working storage
variables declared in program B be initialized every time
it is called by program A or will the values be retained
until the end of program A?
Answers were Sorted based on User's Feedback
Answer / vinod babu bachina
when PROGA made a call to PROGB, if it is first time then
the execution in PROGB start from workign storage
section.suppose progA calls again PROGB then the execution
will start from procedure division only .So when we made a
second call to anu subprogram we have to intialize the
working storage section variables.otherwise second call
retains the values of first call.
Is This Answer Correct ? | 22 Yes | 2 No |
Answer / rajagopalan
The variables in the working-storage section of prog-b will
be initialized only if prog-a has given a CANCEL statement
after CALL statement. Othrwise the WS variables of prog-B
will retain the latest contents of the previous call.
Is This Answer Correct ? | 13 Yes | 1 No |
Answer / s.rajagopalan
none of the above answer is correct.
In static call the working storage varibales is not
initialised when the sub program is called. It retains the
latest values of ws variables in the subrpogram.
In case of dynamic call if you use "cancel" stament then
the ws variables of the sub program are initialised.
if you dont use cancel statement and call the subprogram
then the latest values are retained for the WS vriables.
Is This Answer Correct ? | 7 Yes | 2 No |
Answer / vivek
Rajagopalan's answer is the correct one.
Refer the IBM documentation.
http://publib.boulder.ibm.com/infocenter/pdthelp/v1r1/index.
jsp?topic=/com.ibm.entcobol.doc_3.4/tpsub04.htm
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / nagesh
Well, it depends on the type of call u r making, if it's
dynamic call working storage variable will be initialized
every time automatically.
But if it's static call u can use either 'cancel' or
'is initial' .
Is This Answer Correct ? | 7 Yes | 4 No |
Answer / ramanujam
Everything will be cleared in Program B.
once it returns
Is This Answer Correct ? | 1 Yes | 15 No |
WORKING-STORAGE SECTION. 01 A PIC X(3) VALUE 'ABC' 01 B PIC 9(3). PROCEDURE DIVISION. MOVE A TO B. STOP RUN. OUTPUT IS: AB3 WHY AND HOW THIS IS HAPPENING.
What is report-item in COBOL?
Did anybody attend the walkin of TCS on 31st July in Gurgaon for any technology,If u have completed 3 round i.e till the HR round,have u received the Offer letter yet? Please let me know.Thanks.
01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i need to get the miuns sign in the result?
can i use multiple when statements in search & search all ? justify ur answer?
Have you used comp and comp-3 in your project? And how?
How to read a 100 record from a file through cobol?
what is subscript in cobol?give realtime example?
How many sections are there in data division?.
can I copy book which contain db2 statment in procedure divion?
what is the diff b/w select stsmt and cursor ?
What is the difference between COMP & COMP-3 ?