Page 1 of 2

how to run a cobol prog?

PostPosted: Mon Jan 10, 2011 11:14 am
by Deepak kumar25
any one give me suggestion to how i run a cobol program.

Re: how to run a cobol prog? thanx in advance

PostPosted: Mon Jan 10, 2011 11:21 am
by steve-myers
You might be better off asking this question in the Cobol area, unless what you really want to know is how to run a Cobol program from a C/C++ program. If this is true the question should be asked in those terms.

Re: how to run a cobol prog? thanx in advance

PostPosted: Mon Jan 10, 2011 12:59 pm
by dick scherrer
Hello and welcome to the forum,

To prevent wasting people's time you need to make sure that your tpoic is posted in the appropriate part of the forum. Your topic has been moved to the COBOL part of the forum.

To learn how to run a program on your system, you should ask a co-worker, your supervisor/mentor, or the technical support people for the system. If you do not understand what they tell you, post what they tell you and your doubt. Someone should be able to clarify.

Re: how to run a cobol prog? thanx in advance

PostPosted: Sat Jan 15, 2011 12:11 am
by DOS/VS COBOL Guy
It depends on the system. On a DOS/VS system on an old IBM mainframe (or on Hercules) you'd code a JCL/JECL script like this:
* $$ JOB JNM=CMPLNKGO,DISP=D,PRI=3,CLASS=0,USER='PROGRAMMER' <== if you are running with POWER/VS, code JECL such as this.
* $$ LST LST=00E,DISP=D,PRI=3,CLASS=Z,FNO=W001,JSEP=1<== if you are running with POWER/VS, code JECL such as this.
// JOB CMPLNKGO
// ASSGN SYSLNK,X'537' <== or wherever your SYSLNK file resides in your standard labels
// ASSGN SYS001,X'537'
// ASSGN SYS002,X'537'
// ASSGN SYS003,X'537'
// ASSGN SYS004,X'537' <== SYS001 - SYS004 are for compiler work files the locations of which must also be defined in your standard labels
// OPTION LINK
// EXEC FCOBOL <== produces a relocatable module input to the linkage editor (LNKEDT)
[Your COBOL source code goes here]
/*
// EXEC LNKEDT <== produces a temporary phase for execution
[if your program uses any files, the // ASSGN, // DLBL and // EXTENT statements for them must be coded here and MUST
match up with the system-names in your COBOL source code]
// EXEC
[any data for a card file goes here]
/*
/&
* $$ EOJ <== if you are running with POWER/VS, code JECL such as this.

z/VSE JCL might be similar to this, but I am 40+ years out of style!

...

Re: how to run a cobol prog? thanx in advance

PostPosted: Sat Jan 15, 2011 12:22 am
by steve-myers
It is not possible to answer your question with no knowledge of the data requirements of the program, though z/OS JCL should be simpler than the VSE JCL from DOS/VS COBOL Guy.

You start with an EXEC statement -

// EXEC PGM=your-program

You will probably need a DD statement for the load library where the program has been linked.

//STEPLIB DD DISP=SHR,DSN=your-program-library

You will need more DD statements that depend on the data requirements of your program, which we do not know.

You will need a JOB statement at the start of this JCL, but its contents depend on your site's standards, which we do not know.

Re: how to run a cobol prog? thanx in advance

PostPosted: Sat Jan 15, 2011 12:42 am
by DOS/VS COBOL Guy
steve-myers wrote:It is not possible to answer your question with no knowledge of the data requirements of the program, though z/OS JCL should be simpler than the VSE JCL from DOS/VS COBOL Guy.

You start with an EXEC statement -

// EXEC PGM=your-program

You will probably need a DD statement for the load library where the program has been linked.

//STEPLIB DD DISP=SHR,DSN=your-program-library

You will need more DD statements that depend on the data requirements of your program, which we do not know.

You will need a JOB statement at the start of this JCL, but its contents depend on your site's standards, which we do not know.


I don't normally have to code the // ASSGNs for the compiler work files because my supervisor has those assignments built in and the IPL JCL deck contains an // EXEC for the standard label procedure. Also, the partition initialization JCL contains still more standard assignments, so you don't have to code // ASSGN statements for the card reader, punch or printer so long as you use SYS005, SYS006 and SYS007 respectively for these devices. This makes the JCL simpler than what I have depicted here...

Re: how to run a cobol prog? thanx in advance

PostPosted: Fri Jan 20, 2012 7:02 pm
by enrico-sorichetti
how can You criticize the answer You received without knowing ? :evil:

anyhow the way You asked was the worst one ...

why not tell the operating system under which You want to run the <thing>

in any case whatever the operating system You need to provide
the info about the datasets/files being used

the syntax on how to provide the above info and the statement to use to run/execute You program depend on the system being used

Re: how to run a cobol prog? thanx in advance

PostPosted: Fri Jan 20, 2012 8:46 pm
by NicC
Suggest reading the JCL manual for your OS.

Re: how to run a cobol prog?

PostPosted: Tue Jan 24, 2012 2:12 pm
by jakeferren
Depends on the compiler : if u r using cobol-74 u need to go to the DOS prompt : type COBOL <filename>.cob to create executable file then to compile type CRUN <filename> no extension needed this time.

Re: how to run a cobol prog?

PostPosted: Tue Jan 24, 2012 2:23 pm
by BillyBoyo
jakeferren, this is a forum for IBM Mainframes. It is unlikely that anyone is using Cobol-74. It is certain that no-one has a "DOS prompt". ".cob" is meaningless in this context. Executable files we call something else. I have no idea as to what you regard as the difference between "creating an executable file" and "compiling".

Next you'll be suggesting we go to PC Cobol fora and start giving useful tips about JCL?

On top of that, there is absolutely no need for the commands you specify being the same in someone-elses system, even ignoring the unlikelihood that they, either, are using Cobol-74.