Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6970
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: 8201
Location: Dubuque, Iowa, 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
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us