Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reading the input file in called program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sarath16581

New User


Joined: 11 Jun 2005
Posts: 8

PostPosted: Sat Feb 21, 2009 4:42 pm    Post subject: Reading the input file in called program
Reply with quote

Hi Everyone,

I have come across a requirement where in i have to call a sub program from the main program. There is an input file in the main program and the file is read in the main program. By the way the file is sequential. After i called the subprogram i realised there is a need to read the input file in the called program. Is there a way i can accomplish this? I know that i can have the read part in the main program and perform the remaining functionality in called program. But i want to know if there is way using which i can read the file in called program?
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Sat Feb 21, 2009 5:34 pm    Post subject:
Reply with quote

This should be moved to applications. Is this a COBOL program?

this topic has nothing to do with DB2. Depending on the COBOL, you can look at external. or redesign..........
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Sat Feb 21, 2009 5:52 pm    Post subject:
Reply with quote

Quote:
But i want to know if there is way using which i can read the file in called program?


Files can't be shared by calling and the called programs.
If the same file is to be used by both the programs then it must be closed by the calling program before it can be opened by the called program and vice-versa
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8117
Location: East Dubuque, Illinois, USA

PostPosted: Sat Feb 21, 2009 6:02 pm    Post subject:
Reply with quote

ykishor: if this is a COBOL program, your statement is wrong. Check out the manuals link at the top of the page and use the COBOL manuals to check out the GLOBAL and EXTERNAL attributes, which allow files to be used between programs and subprograms.
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Sat Feb 21, 2009 6:30 pm    Post subject:
Reply with quote

yes robert
u r absoulutely correct....I posted this one in the context of the question..

Quote:
There is an input file in the main program and the file is read in the main program.


This is because the storage associated with an EXTERNAL object is not a part of any particular program in the run unit...Rather the EXTERNAL storage item is associated with run unit itself...The run ubit in that case has seperate storage for all the programs...Here that was not the case...

guess I should have been more specific.... for putting things in perspective.... Am I correct now icon_smile.gif
Back to top
View user's profile Send private message
ykishor
Currently Banned

New User


Joined: 11 Aug 2007
Posts: 24
Location: my pc

PostPosted: Sat Feb 21, 2009 7:20 pm    Post subject:
Reply with quote

Quote:
If the same file is to be used by both the programs then it must be closed by the calling program before it can be opened by the called program and vice-versa


This not wrong either as claimed by u .This technique serves as a means of data linkage,but in a totally different form from the use of arguments... by the way thanks for showing me the doors of IBM Manuals... icon_smile.gif

Good Day
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Could we identify the called modules ... elixir1986 COBOL Programming 5 Fri Jul 14, 2017 1:53 am
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us