IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reading the input file in called program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Sat Feb 21, 2009 5:34 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Feb 21, 2009 6:02 pm
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 8
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top