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
 

 

Open input file in subroutine?

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

New User


Joined: 07 Feb 2006
Posts: 18

PostPosted: Tue Jul 11, 2006 1:38 pm    Post subject: Open input file in subroutine?
Reply with quote

Hi,

Could you please let me know, whether I can open a file in the subroutine, do process and close the file in there itself.

The actual requirement is ...I have to process a common logic for , different input files, contains some thousands of records. If I open this file in the calling program, for each and every record , the new subroutine will be called i.e. thousands of times this sub routine will be called. I don't want to do like that...I want to open the input file in the subroutine and do the process.

If you have got any questions about this please let me know.

Thanks.
Back to top
View user's profile Send private message

Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Tue Jul 11, 2006 1:50 pm    Post subject: Re: Open input file in subroutine?
Reply with quote

Hi

The entire process(open-read-close) has to be done in a single programitself (ie In your case the called program). If your doubt is not cleared, please explain in detail about your requirement.

Regards

Aji Cherian
Back to top
View user's profile Send private message
Mohan Makana

New User


Joined: 07 Feb 2006
Posts: 18

PostPosted: Tue Jul 11, 2006 5:41 pm    Post subject:
Reply with quote

Tes you are right, Could you please explain me the process. How do you pass the input file name to the subroutine from main routine and how do you send the resulted output file back top the calling program etc.
Back to top
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Thu Jul 13, 2006 12:04 pm    Post subject: Re: Open input file in subroutine?
Reply with quote

Hi

I didn'y understand your requirement. Please expalin.

ie Why to pass input file name to called program and get the filename back to called program.

You can simply open the input file name in the second program itself.The resultant file in the called program. And if you want the file name from one program to other use linkage section.


Regards

Aji Cherian
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Thu Jul 13, 2006 12:30 pm    Post subject:
Reply with quote

Well, even I didnt understand the requirement correctly.
However if the issue is only to do file processing ( Open Close Write ) in Sub program, then it has to be done in the same way as main program.

In JCL too we need to give the same DD name and just open in Sub routine.

If this is not what you are looking for, then please send the exact details.

Thanks
ap_mainframes
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Thu Jul 13, 2006 2:49 pm    Post subject: Re: Open input file in subroutine?
Reply with quote

Hi,
Even though there is similar logic in processing of different files of different Layouts, You can't open them in the Called programs.I,e (DYNAMICALLY).

You need to Declare the Layout In FD section in the subroutine, and that can't be changed dynamically(You can't change FD in a program), u should have different subroutines for at least for files of Different layouts.

Plz let me know if u r not clear with what i mean.

~Vamsi
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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