MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

file status when subprogram back to main program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
issac1029
Intermediate


Joined: 10 Dec 2005
Posts: 159
Topics: 75

PostPosted: Thu Jun 29, 2006 1:54 am    Post subject: file status when subprogram back to main program Reply with quote

Hi all,

I read some post about the external clause and the reference,then I have some idea to confirm:

Quote:
Using external files has these benefits:

Your main program can reference the record area of the file, although the main program does not contain any input or output statements.

Each subprogram can control a single input or output function, such as OPEN or READ.

Each program has access to the file.
Program B could access that data item by having the identical data description in its WORKING-STORAGE SECTION.


1)If I do not defined as EXTERNAL ,then,for example,SUB PROG A open file x,then return to MAIN PROG B without close file,if I want to access file x in B,I must open it again?
2)If B wants to access the external item define in A,then I sould code a variable has the same name and format?For example,A has
01 wk-o pic 9(1) external then in B should code 01 wk-o pic 9(1) ?
And if B call another subprog C,can C use external variable used
in A?Or I should define in B again with external clause again the same as
in A.

Quote:
Using external files has these benefits:

Your main program can reference the record area of the file, although the main program does not contain any input or output statements.

Each subprogram can control a single input or output function, such as OPEN or READ.

Each program has access to the file.


3) For red item,Does that means one subprog can only have one function??
Back to top
View user's profile Send private message Send e-mail MSN Messenger
issac1029
Intermediate


Joined: 10 Dec 2005
Posts: 159
Topics: 75

PostPosted: Thu Jun 29, 2006 2:09 am    Post subject: Reply with quote

For question 2),rectified,My understand is : 'External' means put the VARIABLE into a common area,then any program wants to access this VARIABLE also need to define a VARIABLE EXTERNAL with a same name.A has a external VARIABLE,then
A call B,B do not use it,B call C,C wants to use it, B don't need to define it again,Right?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Thu Jun 29, 2006 7:01 am    Post subject: Reply with quote

issac1029,

Check this link which explains in detail about the EXTERNAL files with an example

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/4.2.6?DT=20020923143836

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group