How to execute Cobol without JCL (for home practice)?

1.4k Views Asked by At

I'm in a fast Host training program to join a company, TSO, JCL, Cobol, SQL, etc to be learned at "the speed of light".

I'm having a little struggle with Cobol so I want to practise at home, with a virtualized GNUCobol, but in the training we were executing the programs and managing files through JCL Jobs so I have absolutely no idea about how to do this without JCL.

4

There are 4 best solutions below

0
On

GnuCOBOL is a POSIX (GNU/Linux for example) command line compiler (by and large, there are visual IDE wrappers).

Basically

prompt$ cobc -xj program.cob

cobc is the main compiler command. The -x option for executable. The -j for run job after compile.

We run an open Help getting started forum in the GnuCOBOL main project space on SourceForge.

https://sourceforge.net/p/open-cobol/discussion/help/

Opinion piece: Anyone that may have a bad taste for the forge; there has been a change of ownership, bad decisions corrected. Worthy a second look for anyone that, rightly, left the place while some packages were hijacked and had ads added. That is no longer a SourceForge practice.

0
On

Why waste time doing it differently from how you are trying to Learn?

Just go get Hercules and emulate a mainframe on your desktop, and use the JCL you are practicing with.

http://www.hercules-390.org

0
On

GnuCOBOL will get you compiled. If you have an old 8086 box there was MS-COBOL and MS-ISAM.

The substitute for JCL will be a script or batch file, presuming you are not coding screens in a CICS-like manner. This will not help you to learn JCL. As Brian says, the J switch will give you CLG (compile link and go) functionality in lieu of IGYWCLG.

So if you are running Linux (or WSL on Windows10), you want a shell script. For earlier versions of windows you want .cmd or .bat.

This is a means to an end. Substitute awk, cut, sort etc. for IEBGENER, DFSORT and the like. Use touch and rm for IEFBR14 DISP functions.

#!/bin/bash 
# delete file, could use variables for filenames.
touch outfile.dat && rm outfile.dat
# execute cobol program, could be in path, /usr/bin say.
./myprog parm1 parm2 parm3
# sort output file
sort outfile.dat -o outfile.dat

I have successfully ported a production z/OS Job stream to Ubuntu, and also to AIX, and the monolithic nature of JCL translates well to scripts.

For scheduling, scripts can be nested, and conditions can be emulated with semaphore files/tokens.

0
On

I recently was faced with a similar situation. I found a free course on LinkedIn. Whether you take the course is irrelevant, the first lesson of the course instructs you to set up a COBOL environment in a Windows [or Unix, I suspect] environment.

The teacher will instruct you to install Visual Studio, and a Unix Shell. [I got my pants twisted around the axle setting up the Unix Shell, so I just used Windows CMD to compile and run my source code.]

I hope this helps.