Online project with COBOL and Rexx

Hi guys, I got one real-time processing project with COBOL and Rexx. This project is using ISPF services to invoke the load module. we say this is an ultra mini project, since we do not have any complicated code or operations in it. Since we are invoking the load module dynamically (using ispf services), we cannot use jcl to allocate the data set for our program; so I have use “PUTENV” to allocate the vsam file for our program.

Bullet points of Project.

1. using Dynamic vsam file allocation.

2. Dynamically invoking load module using rexx.

Step 1 Download source and dependent data sets

I have xmitted the binary files of the project from my mainframe and uploaded to some file sharing service, you can download the zipped files from the below link.

We are no longer providing the download link in this page, the download link will be emailed everyone once they do the following steps.

1. Follow us on facebook

Click on the Like button on the facebook plugin.

image_thumb[1]

2. Follow the blog.

Enter your email ID on the textbox and signup for the mainframegeek.me updates. Your email id will be stored in a secured area and it will not be visible to anyone. By signing up you will be updated whenever new posts /projects are added to the website.

image_thumb[3]

Once these two steps are done, you will be receiving and automated email with the Project download links. The Project source codes are free of cost and there is nothing will stop you from downloading the code.

Step 2 Upload binary files to mainframe and expand them

Download the zip file from the above link, unzip into your local folder. then you can upload them using a mainframe emulator or FTP service of windows or Linux. Please read the Step 2. Uploading files and Step 3 Inflating binary files of our first project from the below link.

http://mainframegeek.wordpress.com/2011/04/25/mainframe-projects/

Files contained in the Zip file

INDEXFLE.SRCE
INDEXFLE.JCLS
INDEXFLE.EXECPGM

Once you did Step 3. inflating binary files, by default the files will be stored in the below names.

TSHRCI.INDEXFLE.EXECPGM
TSHRCI.INDEXFLE.JCLS
TSHRCI.INDEXFLE.SRCE

Step 3 lets have a look on data sets.

TSHRCI.INDEXFLE.EXECPGM is a ps and it is a Rexx code which is used to invoke the load module from TSHRCI.LOAD.LIB .

Following code is the heart of our program, which is invoking indxfle (load module) from TSHRCI.LOAD.LIB pds.

address ispexec
“libdef ispllib dataset id(‘TSHRCI.LOAD.LIB’)”
pgm=indxfle
“select pgm(“pgm”)”

TSHRCI.INDEXFLE.JCLS is a pds and contained fillowing members

BATCHCOB
COBCPL
VSAMGEN

Batchcob and COBCPL are two different compile JCL’s for Cobol compiler. BATCHCOB Since I’ve been working on a internal mainframe connection the proc was different So I had to use a customized JCL to compile my code, they have modified IGYWCL proc according to their needs. COBCPL   This should work on almost all mainframes with Cobol ver 4.1, since its making use of default IGYWCL.

VSAMGEN. Is used to generate the Vsam file which we are using in our project. Once you executed the JCL, you can see that the following files has been generated. which is a must before executing our program.

TSHRCI.INDXFLE.FILE1
TSHRCI.INDXFLE.FILE1.DATA
TSHRCI.INDXFLE.FILE1.INDEX

/* DELETE KSDS CLUSTER, IF IT EXISTS                      */
DELETE TSHRCI.INDXFLE.FILE1 CLUSTER PURGE
/* DEFINE KSDS CLUSTER                                    */
DEFINE CLUSTER (                                          –
NAME(TSHRCI.INDXFLE.FILE1)                   –
VOLUMES(ETRU06)                              –
RECORDSIZE(80 80)                            –
RECORDS(50 10)                               –
KEYS(02 0)                                   –
INDEXED )                                    –
DATA (                                             –
NAME(TSHRCI.INDXFLE.FILE1.DATA) )            –
INDEX (                                            –
NAME(TSHRCI.INDXFLE.FILE1.INDEX) )
IF LASTCC = 0 THEN                                        –
LISTCAT ALL LEVEL(TSHRCI.INDXFLE)

Above code is the important part of VSAMGEN, It will delete vsam cluster if existing, create new cluster, index and data data sets.If you are running the JCL for the first
time you will get Maxcc 8, since cluster is not existing in system. The line which marked in red color is not mandatory if your mainframe is  SMS managed. “ETRU06” is the DASD vol ser# where we need our vsam file. Read Redbook on below link to know more about SMS.

http://www.redbooks.ibm.com/abstracts/sg245484.html

TSHRCI.INDEXFLE.SRCE, is a pds and contained “INDXFLE” which is source code of our project. As I said this project is very small and does not have any complicated logics or functionalities in it. The advantages are we are using Dynamic vsam file allocation and invoking load module dynamically using ispexec service.

Step 4 Key parts of Program

.

Dynamic File allocation.

01  FILE-DATA.
05  FILE-PTR                POINTER.
05  FILE-NAME.
10                      PIC X(12)
VALUE ‘DYNVSAM=DSN(‘.
10  dsname              PIC X(60).
10                      PIC XX VALUE Z’ ‘.
05  RC                      PIC S9(9) BINARY VALUE 0.
05  in-name                 pic x(40).

In order to allocate file, we need to tell which file we need to allocate and how we need to do it (Disp) So we need to have the above code in working storage section. once the allocation is done the return code (from PUTENV) will be stores in RC. 10                      PIC XX VALUE Z’ ‘. is filler and says that it null terminated string.

move ‘TSHRCI.INDXFLE.FILE1’
to in-name.
string in-name delimited by space
‘) SHR’ delimited by size into dsname.

Above code will concatenate vsam cluster dsn with disposition and other data and move to fFILE-NAME data name.

set file-ptr                to address of file-name.
CALL ‘PUTENV’
USING BY VALUE FILE-PTR
RETURNING RC.

Above line sets the address pointer of file name to FILE-PTR and calls PUTENV using FILE-PTR. PUTENV will allocate the file wich FILE-PTR points and  return the status of allocation, which will be stored in RC, if RC is –1 then allocation was failure, 0 means allocation was success.

Step 5. Compile and execute the program

Compile

Run BATCHCOB and JCL should return MAXCC 0, and will happen with the provided source code.

Create TSHRCI.LOAD.LIB if not existing before you compile the project.

Executing project

Execute TSHRCI.INDEXFLE.EXECPGM rexx code by putting an “EX” before the file name.

image

and Press Enter which will invoke INDXFLE from TSHRCI.LOAD.LIB, if the compilation was failure then which will give you an error. Please verify that you have created TSHRCI.,LOAD.LIB before compiling the source code and the compilation was successful.

image

Its the fist line in our Project which is to bring up the options in a brand new screen, press enter to continue.

image

Chose any of the options by entering the number and hit enter.

image

image

image

image

image

press enter to come out of this screen. When ever we are performing some actions on data set, our program will set the return code of our Project based on the file status. And the rexx code will evaluate the return code of the project.

image

One thought on “Online project with COBOL and Rexx

Leave a Reply

Your email address will not be published. Required fields are marked *

nine + 19 =