Page 1 of 1

Can we EXECUTE a program in COBOL, thanks a lot

PostPosted: Mon Mar 18, 2013 8:02 am
by Kevin Q M Cai
Hello Guys,
we all know that if we want to execute a program, we need to use JCL, JCL can be below:
//XXX JOB ...
//...
//STEP1 EXEC PGM=ABC
//FILEIN DD DSN=DS1, DISP=XXX
//FILEOUT DD DSN=DS2, DISP=XXX
//SYSIN DD *
...
/*
and we know we also can execute a program using CALL in COBOL, and the FILEIN, FILEOUT, SYSIN in COBOL are something that are used to be
input-output files, so my question is, Can we call ABC and configure it with FILEIN, FILEOUT AND SYSIN in COBOL to make it run?

Many thanks all

Re: Can we EXECUTE a program in COBOL, thanks a lot

PostPosted: Mon Mar 18, 2013 9:23 am
by BillyBoyo
Please ensure you post in an appropriate forum.

Yes. Use the same JCL, just say EXEC PGM=-program which CALLs ABC-.

Re: Can we EXECUTE a program in COBOL, thanks a lot

PostPosted: Mon Mar 18, 2013 12:32 pm
by Kevin Q M Cai
Thanks Billy for you reply, my question is not JCL, what I want to say is that when we call a LOAD MODULE ABC in cobol to execute, but ABC need some DATASETs as input or output files( for example SYSIN, FILEIN), so how can we code this in COBOL?

Re: Can we EXECUTE a program in COBOL, thanks a lot

PostPosted: Mon Mar 18, 2013 1:01 pm
by BillyBoyo
Well, the standard, obvious and well-understood way is with JCL.

If you want to cloud everything up, then you can attempt "dynamic file allocation", try Google.

Re: Can we EXECUTE a program in COBOL, thanks a lot

PostPosted: Mon Mar 18, 2013 2:39 pm
by Robert Sample
when we call a LOAD MODULE ABC in cobol to execute, but ABC need some DATASETs as input or output files( for example SYSIN, FILEIN), so how can we code this in COBOL?
You do NOT code this in COBOL. You could use BPXWDYN for dynamic allocation, but usually you would just allocate the files in your JCL just as if directly executing the program.

Re: Can we EXECUTE a program in COBOL, thanks a lot

PostPosted: Tue May 07, 2013 3:44 pm
by Kevin Q M Cai
Thanks all,

Maybe I need more learning about Mainframe.

Thanks
Kevin

Re: Can we EXECUTE a program in COBOL, thanks a lot

PostPosted: Tue May 07, 2013 4:33 pm
by Robert Sample
Can we call ABC and configure it with FILEIN, FILEOUT AND SYSIN in COBOL to make it run?
It is not clear what you are asking. If you are asking about ABC calling COBOL program XYZ, and ABC opens the files for XYZ -- then the answer is no, this cannot be done. A COBOL program pretty much needs to define and use its own files. If you are asking about ABC calling COBOL program XYZ, and where to place the DD statements for XYZ -- then the answer is in the JCL that executes ABC. What happens if programs ABC and XYZ use the same DD name? Then you have to change one of them so each DD name is unique -- or you accept that ABC cannot call XYZ.

Re: Can we EXECUTE a program in COBOL, thanks a lot

PostPosted: Tue May 07, 2013 9:33 pm
by dick scherrer
Hello,

Maybe I need more learning about Mainframe.
Yup . . . probably.

Suggest you read thru different topics here and then do some experimenting on your system.

Strongly suggest you do all of this experimenting with test data of your own - not anything that others use. Make copies of small files (or part of files) so nothnig can be damaged.

Come back here when there is something where you have a doubt.