Can we EXECUTE a program in COBOL, thanks a lot



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Can we EXECUTE a program in COBOL, thanks a lot

Postby Kevin Q M Cai » Mon Mar 18, 2013 8:02 am

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
Kevin Q M Cai
 
Posts: 17
Joined: Fri Mar 15, 2013 3:39 pm
Has thanked: 11 times
Been thanked: 0 time

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

 

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

Postby BillyBoyo » Mon Mar 18, 2013 9:23 am

Please ensure you post in an appropriate forum.

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

These users thanked the author BillyBoyo for the post:
Kevin Q M Cai (Tue May 07, 2013 3:42 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

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

Postby Kevin Q M Cai » Mon Mar 18, 2013 12:32 pm

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?
Kevin Q M Cai
 
Posts: 17
Joined: Fri Mar 15, 2013 3:39 pm
Has thanked: 11 times
Been thanked: 0 time

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

Postby BillyBoyo » Mon Mar 18, 2013 1:01 pm

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.

These users thanked the author BillyBoyo for the post:
Kevin Q M Cai (Tue May 07, 2013 3:42 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

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

Postby Robert Sample » Mon Mar 18, 2013 2:39 pm

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.

These users thanked the author Robert Sample for the post:
Kevin Q M Cai (Tue May 07, 2013 3:43 pm)
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

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

Postby Kevin Q M Cai » Tue May 07, 2013 3:44 pm

Thanks all,

Maybe I need more learning about Mainframe.

Thanks
Kevin
Kevin Q M Cai
 
Posts: 17
Joined: Fri Mar 15, 2013 3:39 pm
Has thanked: 11 times
Been thanked: 0 time

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

Postby Robert Sample » Tue May 07, 2013 4:33 pm

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.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

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

Postby dick scherrer » Tue May 07, 2013 9:33 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post