Page 1 of 1

How to pass input sequential file through JCL to Cobol Subpr

PostPosted: Wed Jul 30, 2014 12:15 am
by gouravar
I have a requirement as below
Cobol Program P1 is calling Cobol subprogram S1 And Subprogram require sequential file as an input. Please advice how i can pass sequential file from JCL of Main program P1 to the Subprogram S1.

Also is there any other way to meet this requirement ?

Thanks in Advance..

Re: How to pass input sequential file through JCL to Cobol S

PostPosted: Wed Jul 30, 2014 12:37 am
by BillyBoyo
You don't have to do anything. In your sub-program, you need to know when to open the file, process the file and close the file. The main program does not need to know a thing (unless you want it to) and the JCL is for everthing in the run-unit, not just the main program.

Re: How to pass input sequential file through JCL to Cobol S

PostPosted: Wed Jul 30, 2014 12:42 am
by Terry Heinze
If your subprogram needs only parts of some of the records of the file, you can get those parts using the main program and pass that data to the subprogram via the Linkage Section. If you want the entire file, do as BillyBoyo said.

Re: How to pass input sequential file through JCL to Cobol S

PostPosted: Wed Jul 30, 2014 12:47 am
by gouravar
Terry, my requirement is to read the entire file. I will try as BillyBoyo suggested. Thanks for your quick responses. You guys are really appreciable..

Re: How to pass input sequential file through JCL to Cobol S

PostPosted: Wed Jul 30, 2014 1:09 am
by Terry Heinze
Sometimes I depreciate. :lol: