View previous topic :: View next topic
|
Author |
Message |
jyothimenon1
New User
Joined: 16 Jul 2008 Posts: 9 Location: bangalore
|
|
|
|
here what will happen?
I have a doubt regarding open a file in one program and use it in its called program
Consider the scenario where I read 10 records from the file using the main program and if I gave a read in the called program then will I get the 11th record or the first record? (Here Im talking about the case that we are not carrying any key info from the main program to the sub program) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
batch or online.
if batch, you need two fd's, which means what you read in the second has nothing to do with the first.
if online, and you are passing keys, and you can only read vsam, you are going to have diddely in the second. |
|
Back to top |
|
|
sudhakar84
New User
Joined: 20 Jun 2008 Posts: 25 Location: chennai
|
|
|
|
dbzTHEdinosauer , Thanks for the info. |
|
Back to top |
|
|
jyothimenon1
New User
Joined: 16 Jul 2008 Posts: 9 Location: bangalore
|
|
|
|
hai dbzTHEdinosauer,
Thank you so much for the reply |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Is it a COBOL EXTERNAL file? Does the subprogram have a separate file definition and open? The answer will vary depending on the precise environment .... |
|
Back to top |
|
|
jyothimenon1
New User
Joined: 16 Jul 2008 Posts: 9 Location: bangalore
|
|
|
|
hai Robert
The sub program have seperate FD then what will happen?
please help me if there is no seperate FD for sub program, is it possible ?
In the case of external file declared in calling program , is there need to declare FD again in called program? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
If the file is declared external, both programs will have an FD with "external" in it. In this case if one program reads 10 records, then the next record read by either program will be the 11th record.
If the file is not external, both programs will have an FD, but each program must open the file and they are independent. If one program reads 10 records and then the other program reads a record, it will get record 1. |
|
Back to top |
|
|
|