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

Open input file in subroutine?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 0
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top