Documente Academic
Documente Profesional
Documente Cultură
Version 1.0
Prepared By
Madhavi Kadari
38736952.doc Page 1 of 16
Version History
38736952.doc Page 2 of 16
TABLE OF CONTENT
1. INTRODUCTION................................................................................4
2. REQUIREMENTS...............................................................................4
3. BROAD SYSTEM SPECIFICATION...............................................4
4. INPUT AND OUTPUT FILES............................................................5
5. TABLE LAYOUTS..............................................................................6
6. RECORD STRUCTURE OF THE DB2 TABLES..........................10
7. GUIDELINES.....................................................................................10
8. MODULES..........................................................................................12
9. TEST PREPARATION.....................................................................13
38736952.doc Page 3 of 16
1. INTRODUCTION
Purpose of this case study is to provide hands on experience for trainees by covering most of the programming
concepts in COBOL with DB2. This case study is designed in Bank application domain.
2. REQUIREMENTS
XYZ Bank Ltd maintains the current and personal accounts of the customers. To open an account, the customer
needs to provide valid personal information and deposit Rs500 if it is a savings account. For a current account, no
deposit is required. A third party captures the data and generates the customer id and the account number. All the
transactions will be maintained on these with these 2 ids. The captured data will be loaded into the DB2 database.
The data that is captured and being passed to the XYZ Bank Ltd can be grouped into 3 main functional areas
• Personal Data
• Account Data
• Transaction data
Develop a system incorporating the above features with COBOL/DB2 programs
• Main Program : Reads the input file and calls the appropriate module to insert or modify based on the
request type.
• Insert Program: Handles the records insertion for Personal and Account data.
• Update Program: Handles the updates/deletes made on the Personal information and account information. It
also handles the Transaction records insertion.
• Report Program: Generates the report to list the customers with less than the required minimum balance.
<Program 1> to read input file and call the insert or update program.
<Program 2> to handle the functions of New customer insert process. This program validates the data and insert the
record into the corresponding db2 table based on the table type given in the file. If the record insert fails, then the
program will attach the error code, customer id and writes it into error file or spool.
<Program 3> to handle record updates/deletes based on transaction type. If the record update fails the program will
attach the error code, customer id and writes it into error file or spool.
38736952.doc Page 4 of 16
4. Input and Output Files
File Name Open Type Record Access Remarks
Mode length
Customer Master Input Sequential 100 Sequential Read First 4 char will be the trans
File type ISRT. Remaining 96 char
is the table data.
Transaction File Input Sequential 100 Sequential Read First 4 char will be the trans
type REPL/DLET. Remaining
96 char is the table data.
Error File Output Sequential 80 Sequential Write
Report File Output Sequential 80 Sequential Write
38736952.doc Page 5 of 16
4.1.4. Transaction Record
5. Table Layouts
Logical column name Physical column Name Field Type Length Remarks
Customer Identifier CUST_ID CHAR 10 Primary Key
Customer name CUST_NAME CHAR 14 NOT NULL
Social security number SSN_NO CHAR 10 UNIQUE NOT NULL
Address1 CUST_ADDR1 CHAR 10 NOT NULL
Address2 CUST_ADDR2 CHAR 10 NOT NULL
Mail ID MAIL_ID CHAR 20 NOT NULL
Phone Number PHONE_NO CHAR 10 NOT NULL
38736952.doc Page 6 of 16
IN TRNG
USING STOGROUP TRNG
PRIQTY 10000
SECQTY 5000
ERASE NO
BUFFERPOOL BP0
LOCKSIZE ANY
CLOSE YES;
Logical column name Physical column Name Field Type Length Remarks
Customer Identifier CUST_ID CHAR 10 Foreign Key
Current Account CURR_ACCT_NO CHAR 10 Primary Key
38736952.doc Page 7 of 16
Logical column name Physical column Name Field Type Length Remarks
Number
Current Balance amount CURR_BAL INTEGER 10
Branch name BRANCH_NAME CHAR 10 NOT NULL
Routing Number BRANCH_CITY CHAR 10 NOT NULL
Logical column name Physical column Name Field Type Length Remarks
Customer Identifier CUST_ID CHAR 10 Foreign Key
Savings Account SAVE_ACCT_NO CHAR 10 Primary Key
Number
Savings Balance amount SAVE_BAL INTEGER 10
Branch name BRANCH_NAME CHAR 10 NOT NULL
Branch City BRANCH_CITY CHAR 10 NOT NULL
38736952.doc Page 8 of 16
BRANCH_CITY CHAR(10) NOT NULL,
PRIMARY KEY(SAVE_ACCT_NO),
CONSTRAINT FK_CUST FOREIGN KEY(CUST_ID) REFERENCES
userid.CUST_TB ON DELETE CASCADE )
IN TRNG.BANKnnn;
Logical column name Physical column Name Field Type Length Remarks
Customer Identifier CUST_ID CHAR 10 Foreign Key
Account Number ACCT_NO CHAR 10 Foreign Key
Account Type ACCT _TYPE CHAR 2 NOT NULL
Transaction Type TRANS_TYPE CHAR 2 NOT NULL
Date of transaction TRANS_DATE DATE 10 NOT NULL WITH
DEFAULT VALUE
CURRENTDATE
Amount TRANS_AMT INTEGER 10 NOT NULL
Balance CLOSING_BAL INTEGER 10 NOT NULL
38736952.doc Page 9 of 16
SECQTY 500
ERASE NO
BUFFERPOOL BP0
CLOSE YES
FREEPAGE 0
PCTFREE 5;
7. Guidelines
The following SQLCODES that may be encountered during execution. For other SQL codes check
literature.
38736952.doc Page 10 of 16
• +000 – The SQL call was successful
• +100 – No record found or End of database was reached
• -803 – The record already exists in database
• DB2I main panel can be accessed through option M.13 or D2 from TSO main panel.
• In DB2I menu, the SSID should be DB8G. It can be verified at top right corner of DB2I main panel.
• SSID can be modified through DB2I Defaults panel. The panel can be accessed through option D on
the DB2I main panel.
• Database to be used is TRNG.
• Each user to create and work in separate Tablespace. Creators of tablespace will be the owners of
the Tablespace and the objects created in it.
• Tablespace to be named as BANKnnn where nnn is the last four digits of the users TSO login ID.
• Each user to bind packages under their respective collection ID’s. Collection ID’s to be named as
COLLBANKnnn where nnn is the last three digits of the users TSO login ID
• Model JCL’s for Compile, Bind Package/plan and execution are provided
• Sample SQL statements to create and drop Tablespaces and Tables are provided.
• Modify the SQLs accordingly and run in SPUFI
• Create ‘userid.BANK.DDL’ to store the DDLs of the tables to be created. The attributes are
Record Format = FB, Record Length = 80
• Create ‘userid.BANK.COBOL’ to store programs. The attributes are Record Format = FB, Record
Length = 80
• Create ‘userid..BANK.CPY’ to store Copybooks if any. The attributes are Record Format = FB,
Record Length = 80
• Create ‘userid..BANK.JCL’ to store JCLs. The attributes are Record Format = FB, Record Length
= 80
• Create ‘userid..BANK.LOAD’ to store load modules. The attributes are Record Format = U,
Record Length = 80
38736952.doc Page 11 of 16
8. Modules
• In this program check the table type to insert the records into the corresponding tables.
• Before inserting the Transaction record, the remaining amount needs be calculated based on the
transaction type (CR or DB) to update the closing balance.
• In this program check the table type to do the necessary action on the corresponding table
• No Updates will be made to the transaction records as they are history. Only deletes and inserts can be
done on the transaction table.
• Before inserting the Transaction record, the remaining amount needs be calculated based on the
transaction type (CR or DB) to update the closing balance.
• In this program read the required tables to get the data and check if the closing balance of the customer is
above the required minimum balance. If not write the customer information into the report
Report Layout :
38736952.doc Page 12 of 16
XXXXXXXXXX XXXXXXXXXXXX 9999999999 $9999999999
XXXXXXXXXX XXXXXXXXXXXX 9999999999 $9999999999
9. Test Preparation
Copy the below statements into a member by name DSNHCOB in PROCLIB library. No changes are
required to the below jcl
//**********************************************************************
//* DSNHCOB - COMPILE AND LINKEDIT A COBOL PROGRAM
//*
//DSNHCOB PROC WSPC=500,MEMBER=TEMPNAME
//*
//* PRECOMPILE THE COBOL PROGRAM
//**********************************************************************
//PC EXEC PGM=DSNHPC,PARM='HOST(COBOL)',REGION=4096K
//DBRMLIB DD DSN=&DBRMLIB(&MEMBER),
// DISP=SHR
//STEPLIB DD DISP=SHR,DSN=DSN810.SDSNEXIT
// DD DISP=SHR,DSN=DSN810.SDSNLOAD
//SYSCIN DD DSN=&&DSNHOUT,DISP=(MOD,PASS),UNIT=SYSDA,
// SPACE=(800,(&WSPC,&WSPC))
//SYSIN DD DSN=&SRCELIB(&MEMBER),DISP=SHR
//SYSLIB DD DSN=&INCLLIB,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTERM DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSUT1 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT2 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//*
//* COMPILE THE COBOL PROGRAM IF THE PRECOMPILE
//* RETURN CODE IS 4 OR LESS
//*
//COB EXEC PGM=IGYCRCTL,PARM='LIB',COND=(4,LT,PC)
//STEPLIB DD DSN=IGY320.SIGYCOMP,DISP=SHR
//SYSIN DD DSN=&&DSNHOUT,DISP=(OLD,DELETE)
//SYSLIB DD DSN=GDDM.SADMSAM,DISP=SHR
//* DD DSN=©LIB,DISP=SHR
// DD DSN=&INCLLIB,DISP=SHR
38736952.doc Page 13 of 16
//SYSLIN DD DSN=&&LOADSET,DISP=(MOD,PASS),UNIT=SYSDA,
// SPACE=(800,(&WSPC,&WSPC))
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSUT1 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT2 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT3 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT4 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT5 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT6 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//SYSUT7 DD SPACE=(800,(&WSPC,&WSPC),,,ROUND),UNIT=SYSDA
//*
//* LINKEDIT IF THE PRECOMPILE AND COMPILE
//* RETURN CODES ARE 4 OR LESS
//*
//LKED EXEC PGM=IEWL,PARM='XREF',
// COND=((4,LT,COB),(4,LT,PC))
//SYSLIB DD DSN=CEE.SCEELKED,DISP=SHR
// DD DISP=SHR,
// DSN=DSN810.SDSNLOAD
// DD DISP=SHR,DSN=ISP.SISPLOAD
// DD DISP=SHR,DSN=GDDM.SADMMOD
//SYSLIN DD DSN=&&LOADSET,DISP=(OLD,DELETE)
// DD DDNAME=SYSIN
//SYSLMOD DD DSN=&LOADLIB(&MEMBER),DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSUT1 DD SPACE=(1024,(50,50)),UNIT=SYSDA
38736952.doc Page 14 of 16
//*************************************************************
//LKED EXEC PGM=HEWL,COND=(8,LT,NCALLIB),REGION=1024K
//SYSLIB DD DSNAME=CEE.SCEELKED,DISP=SHR
// DD DSNAME=userid.bank.load,
// DISP=SHR
//RESLIB DD DSN=IMS910.SDFSRESL,DISP=SHR
//SYSPRINT DD SYSOUT=*
//*SYSLIN DD DSNAME=&&LOADSET,DISP=(OLD,DELETE)
//* DD DDNAME=SYSIN
//SYSLMOD DD DSNAME=userid.bank.load(membername),
// SPACE=(TRK,(10,10,1)),
// UNIT=SYSDA,DISP=(MOD,PASS)
//SYSUT1 DD UNIT=SYSDA,SPACE=(TRK,(10,10))
//SYSIN DD DUMMY
//SYSLIN DD *
INCLUDE SYSLIB(membername)
NAME membername (R)
/*
38736952.doc Page 15 of 16
9.5. Run JCL
//xxxxxxx JOB (ACCT#,&SYSUID),,
// MSGCLASS=A,CLASS=A,MSGLEVEL=(1,1),NOTIFY=&SYSUID
//JOBLIB DD DISP=SHR,DSN=DSN810.SDSNLOAD
// DD DISP=SHR,DSN=userid.bank.load
//DB2EXEC EXEC PGM=IKJEFT01,DYNAMNBR=20
//SYSTSPRT DD SYSOUT=*
//DBRMLIB DD DSN=userid.bank.dbrmlib,DISP=SHR
//ddname1 DD DSN=userid.bank.master/transfile,DISP=SHR
//ddname2 DD DSN=userid.bank.errorfile,DISP=SHR
//SYSTSIN DD *
DSN SYSTEM(DB8G)
RUN PROGRAM(mainmodule)
PLAN(planname) -
LIB('userid.bank.load')
END
/*
38736952.doc Page 16 of 16