Page 1 of 1

Data availability in subprogram

PostPosted: Wed Mar 30, 2011 5:27 pm
by isai_22
Hi...

I have read a file & displayed the necessary field n the main program. The value s correct.
After tat i make a call to another pgm (sub pgm) and wen i try to dispaly the same field,it displays junk values.

Note:
Select clause is the same in both programs.
Both programs are compiled succesfully.
The control goes to the sub program.

Please help me solving this scenario.
Thank U!!!

Re: Data availability in subprogram

PostPosted: Wed Mar 30, 2011 5:56 pm
by BillyBoyo
You say you have a "select clause" in both programs. Don't. If you want to use a sub-program, don't try to read/write the same file as another program. Just asking for trouble.

What is your requirement, such that you feel the need to do this?

Re: Data availability in subprogram

PostPosted: Wed Mar 30, 2011 5:59 pm
by Robert Sample
Why do you have a SELECT clause in the subprogram? SELECT statements are used to identify files, and you normally pass data to a subprogram by using CALL <subprogram> USING <variable list> with the subprogram having PROCEDURE DIVISION USING <variable list> and LINKAGE SECTION variables to match. There's no reason to have a SELECT statement in the subprogram.