You are on page 1of 16

Writing a COBOL DB2 Program.

Let us assume we are writing a cobol program to read EMPLOYEE table and get the details of employee with the name XXXXXXX. Let us go in step wise.. create the following table in db2 or assume it is there in db2 database. EMPLYEE EMPID 1000 1001 1002 EMPNAME XXXXXXX YYYYYYY ZZZZZZZ DEPARTMENT XX YY ZZ SALARY 10000 9000 20000 DESIGNATION SE SE MA

STEP 1.

We need to declare the table structure in the WORKING-STORAGE SECTION or LINKAGE SECTION. EXEC SQL DECLARE DSNXXX.EMPLOYEE ( EMPID EMPNAME DEPARTMENT SALARY DESIGNATION END-EXEC.

CHAR(10) CHAR(30) CHAR(2) DECIMAL(10,2) CHAR(4)

NOT NOT NOT NOT NOT

NULL, NULL, NULL, NULL, NULL )

we can use DB2 tool called DCLGEN to generate this declaration for us and can include that copy book here. if you create a copybook using DCLGEN. Use following sntax to include EXEC SQL INCLUDE < copybookname > END-EXEC.

STEP 2. se

Declare host variables in WORKING-STORAGE SECTION. HOST VARIABLES - A host variable is a data item declared in cobol to u it in embedded SQL. For EMPLOYEE table, host variable declaration is look like as follows.

.. 01 EMPOYEE-RECORD. 05 HV-EMPID 05 HV-EMPNAME PIC X(10). PIC X(30).

05 HV-DEPARTMENT 05 HV-SALARY 05 HV-DESIGNATION

PIC X(2). PIC S9(8)V99 COMP-3. PIC CHAR(4).

If you use db2 tool DCLGEN, it will automatically creates this structur e also along with table declaration specified in step1. STEP 3. Include SQLCA as follows in WORKING-STORAGE SECTION. EXEC SQL INCLUDE SQLCA END-EXEC. What is SQLCA? SQLCA - SQL communication area. When a SQL statement executes, DB2 places a value in SQLCODE A ND SQLSTATE host variables or any other fields of SQLCA. based o n the values in these variables we can know whether sql ran sucessfully or not. SQLCA contains a declartion of fields like SQLCODE,SQLSTATE an d SQLERRD etc....

STEP 4. Add a sql statement in procdure division to get the details of employee with the name XXXXXXX.

DISPLAY ' PROGRAM STARTED .... ' ......... EXEC SQL SELECT SALARY INTO :HV-SALARY FROM EMPLOYEE WHERE EMPNAME = 'XXXXXXX' END-EXEC. IF SQLCODE = 0 DISPLAY ' SQL EXECUTED SUCESSFULLY ' DISPLAY ' EMPLOYEE SALARY IS ' ELSE DISPLAY ' SQL FAILED ' DIAPLY ' SQL CODE ' SQLCODE END-IF. HV-SALARY

.... .... DISPLAY ' PROGRAM ENDED'.

Here SQLCODE = 0 means, sql ran sucessfully without any issues. Hence we are displaying the HV-SALARY into the spool. If SQLCODE NOT = 0 , there is issue in executing the sql statement.

Now we have compeleted coding a cobol-db2 program. our next step is to compile the program. SAMPLE COMPILE JCL Click here to see the compile JCL. Use this compile jcl to compile the program. //DB2COMP (XXX,XXX),'COMPILE JCL', // CLASS=A,MSGCLASS=A,NOTIFY=&SYSUID //******************************************************************** //* COMPILATION, LINK EDIT AND THE BIND STEP FOR A COBOL DB2 PROGRAM * //* WILL BE DONE BY SUBMITTING THIS JOB. * //* THE DB2 REGIONS AND CORRESPONDING PARAMETERS NEEDS TO BE CHANGED * //* WITH RESPECT TO THE PROGRAM * //******************************************************************** //* PRECOMPILE DB2 PROGRAM * //*-------------- LOCATION OF DBRM LIBRARY -------------------------* //******************************************************************** //PC EXEC PGM=DSNHPC, // PARM='HOST(COB2),APOST,SOURCE', // REGION=4096K //DBRMLIB DD DISP=SHR, // DSN=DEV.SURESH.DBRM(DB2PROG) <------------------------ (1) //STEPLIB DD DISP=SHR, // DSN=SYSX.DB2.XXX.XXXXX //******************************************************************** //*SYSIN -----------INPUT COBOL DB2 PROGRAM LOCATION-----------------* //******************************************************************** //SYSIN DD DISP=SHR, // DSN=DEV.SURESH.SRC(DB2PROG) <---------------------- (2) //SYSCIN DD DISP=(MOD,PASS), // DSN=&&TEMP, // SPACE=(800,(500,500)), // UNIT=SYSDA //******************************************************************** //* DCLGEN MEMBER LOCATION * //*SYSLIB-----------------INPUT SOURCE LIBRARY FOR SQL---------------* //******************************************************************** //SYSLIB DD DISP=SHR, // DSN=DEV.SURESH.DCL <---------------------- (3) // DD DISP=SHR, // DSN=DEV.SURESH.CPY //SYSPRINT DD SYSOUT=T

//SYSTERM DD SYSOUT=T //SYSUDUMP DD SYSOUT=* //SYSUT1 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //SYSUT2 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //* //******************************************************************** //* COMPILATION * //******************************************************************** //* //COB EXEC PGM=IGYCRCTL, // COND=(4,LT,PC), // PARM=('SIZE(4000K),BUFSIZE(32760),LIST,LIB,MAP,OBJECT', // 'DATA(31),XREF,RENT'), // REGION=4M //STEPLIB DD DISP=SHR, // DSN=XXXX.XXXXXX //SYSIN DD DISP=(OLD,DELETE), // DSN=&&TEMP //SYSLIN DD DISP=(MOD,PASS), // DSN=&&LOADTMP, // SPACE=(800,(500,500)), // UNIT=SYSDA //******************************************************************** //*--------------SOURCE LIBRARIES FOR COBOL DB2 CODE (COPY LIBRARIES)* //******************************************************************** //SYSLIB DD DISP=SHR, // DSN=DEV.SURESH.DCL <----------------- (4) // DD DSN=DEV.SURESH.CPY,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSUT1 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //SYSUT2 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //SYSUT3 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //SYSUT4 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //SYSUT5 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //SYSUT6 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //SYSUT7 DD SPACE=(800,(500,500),,,ROUND), // UNIT=SYSDA //* //* //******************************************************************** //* LINK EDIT * //******************************************************************** //* //LKED EXEC PGM=IEWL, // COND=((4,LT,COB),(4,LT,PC)), // PARM='XREF' //SYSLIB DD DISP=SHR, // DSN=SXXX.SXXXXXXX // DD DISP=SHR, // DSN=XXXX.DB2.XXX.XXXXLOAD // DD DISP=SHR,

// DSN=SYS1.VSCLLIB //SYSLIN DD DISP=(OLD,DELETE), // DSN=&&LOADTMP //* DD DDNAME=SYSIN //******************************************************************** //*----------------LOCATION OF LOAD LIBRARY--------------------------* //SYSLMOD DD DISP=SHR, // DSN=DEV.SURESH.LOADLIB(DB2PROG) <------------ (5)

//SYSPRINT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSUT1 DD SPACE=(1024,(50,50)), // UNIT=SYSDA //* //******************************************************************** //* BIND - BIND THE DB2 PACKAGE * //******************************************************************** //BIND EXEC PGM=IKJEFT01, // COND=(4,LT), // REGION=4096K //STEPLIB DD DISP=SHR, // DSN=XXX4.DB2.XXXX.XXXXLOAD //DBRMLIB DD DISP=SHR, // DSN=DEV.SURESH.DBRM(DB2PROG) <--------------- (6) //SYSPRINT DD SYSOUT=* //SYSTSPRT DD SYSOUT=* //SYSUDUMP DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM (DEVDB ) BIND MEMBER (DB2PROG) PACKAGE (PACKG11) LIBRARY ('DEV.SURESH.DBRM') <---------------- (7) ACTION ISOLATION VALIDATE RELEASE OWNER QUALIFIER (REP) (CS) (BIND)(COMMIT) (SURESH) (DEVQUALI)

END /* **************************** Bottom of Data **************************** (1) - When we precompiled, precompiler will create the DBRM, it will be placed in the pds specified here. (2) - Location of COBOL-DB2 program (3) - Needs to speficiy DCLGEN member locations (4) - Needs to specify DCLGEN and COPYBOOK locations here (5) - Load module location, load module will be created here. this location needs to be given in run jcl. (5) & (6) - specify the location of DBRM, ( same location used in step1 ).

SAMPLE RUN JCL Click here to see the sample run jcl. Use this run jcl to run the program.

COBOL Example Programs These pages contain a large number of example COBOL programs. The programs may b e downloaded, or viewed in your browser. Test data for the example COBOL program s is also provided where appropriate. The programs have been compiled and tested using Microfocus NetExpress but they should work on any COBOL-85 complient compiler with very few changes. You may have to reformat the programs if your compiler does not have the equival ent of the $ SET SOURCEFORMAT"FREE". This compiler directive frees Microfocus CO BOL programs from the normal COBOL formatting conventions. You may also have to remove the ORGANIZATION IS LINE SEQUENTIAL phrase in the SE LECT and ASSIGN clause of sequential files. In Microfocus COBOL, LINE SEQUENTIAL files terminate each record with a carriage return and line feed. Copyright Notice These programs are the copyright property of Michael Coughlan. You have permissi on to use these programs for your own personal use but you may not reproduce the m in any published work without written permission from the author. Beginners Programs - Simple programs using ACCEPT, DISPLAY and some arithmetic verbs. Selection and Iteration - Selection (IF, EVALUATE) and Iteration (PERFORM) examp le programs. Sequential Files - Programs that demonstrate how to process sequential files. Sorting and Merging - Examples that use INPUT PROCEDURE's and the SORT and MERGE verbs Direct Access Files - Example programs that show how to process Indexed and Rela tive files. CALLing sub-programs - Example programs that Demonstrate contained, and external , sub-programs. String handling - Example programs that show how to use Reference Modification, INSPECT and UNSTRING. The COBOL Report Writer - Example programs using the COBOL Report Writer. COBOL Tables - Example programs using tables.

Beginners programs Program Name

Description Major constructs Action Shortest.cbl This example program is almost the shortest COBOL program we can have. We could make it shorter still by leaving out the STOP RUN. DISPLAY Download View Accept.cbl The program accepts a simple student record from the user and displays the indiv idual fields. Also shows how the ACCEPT may be used to get and DISPLAY the syste m time and date. ACCEPT, DISPLAY, ACCEPT FROM DATE, ACCEPT FROM DAY, ACCEPT FROM TIME Download View Multiplier.cbl Accepts two single digit numbers from the user, multiplies them together and dis plays the result. ACCEPT, DISPLAY, MULTIPLY Download View

Selection and Interation Program Name Description Major constructs Action IterIf.cbl An example program that implements a primative calculator. The calculator only d oes additions and multiplications. IF, PERFORM..TIMES, ADD, MULTIPLY Download View Conditions.cbl An example program demonstrating the use of Condition Names (level 88's). Condition Names (level 88's), EVALUATE, PERFORM..UNTIL Download View Perform1.cbl An example program demonstrating how the first format of the PERFORM may be used to change the flow of control through a program. PERFORM Download

View Perform2.cbl Demonstrates the second format of the PERFORM. The PERFORM..TIMES may be used to execute a block of code x number of times. PERFORM..TIMES Download View Perform3.cbl Demonstrates how the PERFORM..UNTIL (third format) may be used to process a stre am of values where the length of the stream cannot be determined in advance (alt hough in this case there is a set maximum number of values in the stream). PERFORM..UNTI, ADD, COMPUTE, ON SIZE ERROR, INITIALIZE Download View Perform4.cbl Demonstrates how the PERFORM..VARYING and the PERFORM..VARYING..AFTER (fourth fo rmat) may be used for counting iteration. Also introduces the WITH TEST BEFORE a nd WITH TEST AFTER phrases. PERFORM..VARYING..AFTER, DISPLAY Download View MileageCount.cbl Demonstrates how the PERFORM..VARYING and the PERFORM..VARYING..AFTER (fourth fo rmat) may be used to simulate a mileage counter. PERFORM..VARYING..AFTER, DISPLAY Download View

Sequential Files Program Name Description Major constructs Action SeqWrite.cbl Example program demonstrating how to create a sequential file from data input by the user. Sequential Files, WRITE, OPEN, CLOSE, File Description (FD), SELECT..ASSIGN Download View SeqReadno88.cbl An example program that reads a sequential file and displays the records. This v ersion does not use level 88's to signal when the end of the file has been reach ed. To test the program download thistestdata file. Sequential Files, READ, OPEN, CLOSE, File Description (FD), SELECT..ASSIGN Download

View SeqRead.cbl An example program that reads a sequential file and displays the records. This i s the correct version which uses the Condition Name (level 88) "EndOfFile"to sig nal when the end of the file has been reached. To test the program download this testdata file. Sequential Files, Condition Names (level 88's) READ, OPEN, CLOSE, File Descripti on (FD), SELECT..ASSIGN Download View SeqInsert.cbl Demonstrates how to insert records into a sequential file from a file of transac tion records. A new file is created which contains the inserted records. To test this program you will need to download Student Masterfile - Students.Dat and the Transaction file Transins.dat. Sequential Files, Condition Names (level 88's) READ, WRITE Download View SeqRpt.cbl This program reads records from the student file, counts the total number of stu dent records in the file and the number records for females and males. Prints th e results in a very short report. To test the program download Students.Dat Sequential Files, Condition Names (level 88's) READ, WRITE, Writing to a report file. Download View

Sorting and Merging Program Name Description Major constructs Action InputSort.cbl Uses the SORT and an INPUT PROCEDURE to accept records from the user and sort th em on ascending StudentId. SORT, Input Procedure Download View MaleSort.cbl Sorts the student masterfile (sorted on ascending Student Id) and produces a new file, sorted on ascending student name, containing only the records of male stu dents. To test the program download Students.Dat SORT, Input Procedure Download View Merge.cbl

Uses the MERGE to insert records from a transaction file into a sequential maste r file. . To test this program you will need to download Student Masterfile - Students.Dat and the Transaction file Transins.dat. MERGE Download View AromaSalesRpt.Cbl Exam paper model answer. A program is required to produce a summary sales report from an unsorted sequential file containing the details of sales of essential a nd base oils to Aromamora customers. Read the program specification first. The required data files may be downloaded from there. SORT with Input Procedure and Output Procedure, Print Files, Sequential Files, C OMPUTE Download View CSISEmailDomain.Cbl Exam paper model answer. A program is required which will produce a file, sorted on ascending email domain, from the unsorted GraduateInfo file. Read the program specification first. The required data files may be downloaded from there. SORT with Input Procedure and Output Procedure, Sequential Files, Pre-Defined Ta bles, Run time filled tables, SEARCH Download View BestSellers.Cbl Exam paper model answer. The Folio Society is a Book Club that sells fine books to customers all over the world. A program is required to print a list of the te n best selling books (by copies sold) in the Book Club. Read the program specification first. The required data files may be downloaded from there. (Sequential Files, Print Files, SORT with Input Procedure and Output Procedure, Tables) Download View DueSubRpt.Cbl Exam paper model answer. NetNews is a company which runs an NNTP server carrying the complete USENET news feed with over 15,000 news groups. Access to this serv er is available to internet users all over the world. Users of the system pay a subscription fee for access. A program is required to produce a report showing t he subscriptions which are now due. The report will be based on the Due Subscrip tions file. (Sequential Files, Print Files, SORT with Input Procedure, Tables, SEARC H ALL) Download View

Direct Access Files Program Name Description

Major constructs Action Seq2Rel.cbl Creates a direct access Relative file from a Sequential File. Note that Relative files are not standard ASCII files and so cannot be created with an editor as S equential files can. To create the Relative file you will need to download the supplier file SEQSUPP. DAT Relative files, Sequential Files, ACCESS MODE, RELATIVE KEY, FILE STATUS, READ.. AT END, WRITE..INVALID KEY Download View ReadRel.cbl Reads the Relative file - RELSUPP.DAT - created in the previous example program and displays the records. Allows the user to choose to read through and display all the records in the file sequentially, or to use a key to read just one recor d directly. Relative files, ACCESS MODE, RELATIVE KEY, FILE STATUS, READ..NEXT RECORD, READ. .INVALID KEY, Condition Names, IF Download View Seq2Index.cbl Creates a direct access Indexed file from a Sequential file. Note that Microfocu s Indexed files actually consist of two files - the data file and the index file (.idx). To create the Indexed file you will need to download the supplier file SEQVIDEO. DAT Indexed files, Sequential Files, RECORD KEY, ALTERNATE KEY,READ..AT END, WRITE.. INVALID KEY Download View DirectReadIdx.cbl Does a direct read on the Indexed file created by the previous example program. Allows the user to choose which of the keys to use for the direct read. Indexed files, READ..KEY IS. Download View SeqReadIdx.cbl Reads the Indexed file sequentially on whichever key is chosen by the user. Disp lays all the records in the file. Indexed files, READ..NEXT RECORD, START Download View StudFees.cbl Exam paper model answer. A program which applies a transaction file of student p ayments to a Student Master File and which then produces a report showing those students whose fees are partially or wholly outstanding. Read the program specif ication first. The required data files may be downloaded from there. Indexed files, Print files, READ..NEXT RECORD, START, WRITE, REWRITE, IF, PERFOR M, ADD, SUBTRACT

Download View Aroma96.cbl Exam paper model answer. A program is required which will apply a file of sorted , validated transactions to the Oil-Stock-File and then produce a report based o n the contents of both the Oil-Details-File and the Oil-Stock-File. The report w riter must be used to produce the report which must be printed sequenced on asce nding Oil-Name. Read the program specification first. The required data files may be downloaded from there. Indexed files, Relative Files, Sequential Files, EVALUATE, COMPUTE, READ, WRITE, REWRITE, START, Report Writer, Report Section, INITIATE, GENERATE, TERMINATE, Download View BookshopRpt91.Cbl Exam paper model answer. A program is required to produce a Purchase Requirement s Report from the Publisher, Book and Purchase Requirements files. The report sh ould be sequenced on ascending Publisher Name and should only detail the purchas e requirements for the semester under scrutiny. Read the program specification first. The required data files may be downloaded from there. Indexed files, Report Writer, Report Section, INITIATE, GENERATE, TERMINATE, REA D, WRITE, REWRITE, START Download View LibRoyaltyRpt.Cbl Exam paper model answer. Each time a book is borrowed, the Pascal Memorial Libra ry pays the author a small sum of money as royalty.? Royalties are paid to autho rs through their agents. A report is required which processes the Authors file a nd the Books File to produce a report which shows the amount to be sent to each agent, shows the breakdown of the agent payment into author payments, and shows the breakdown of each author payment into royalty payments per book. Read the program specification first. The required data files may be downloaded from there. Indexed Files, Print Files, READ..NEXT RECORD, READ..KEY IS, START, REWRITE, WRI TE, MULTIPLY, SET Download View TopSuppliersRpt.Cbl Exam paper model answer. The manager of Metropolis Video s has asked you to write a program to produce a report showing the top three Vid eo Suppliers (by total store video earnings) and for each of the top three the m ost popular video title (by average earnings) must be shown. Read the program specification first. The required data files may be downloaded from there. Indexed Files, Relative Files, Print Files, READ, START, Tables, DIVIDE Download View

CALLing sub-programs Program Name Description

Major constructs Action DriverProg.cbl This program demonstrates the CALL verb by calling three external sub-programs. The "MultiplyNums" sub-program demonstrates flow of control - from caller to cal led and back again - and the use of parameters. The "Fickle" sub-program demonstrates State Memory. The "Steadfast" sub-program shows how a sub-program can use the IS INITIAL phras e to avoid State Memory. Calling external sub-programs. CALL..BY REFERENCE, CALL..BY CONTENT, COMP, CANCE L Download View MultiplyNums.cbl The "MultiplyNums" sub-program, called from the driver program above, demonstrat es the flow of control from the driver program to the called sub-program and bac k again. It uses numeric and string parameters and demonstrates the BY REFERENCE (the default) and BY CONTENT parameter passing mechanisms. Calling external sub-programs, LINKAGE SECTION, EXIT PROGRAM Download View Fickle.cbl Fickle is a sub-program called from DriverProg.cbl above. Fickle is a program th at demonstrates State Memory. Each time the program is called it remembers its s tate from the previous call. Calling external sub-programs, LINKAGE SECTION, EXIT PROGRAM Download View Steadfast.cbl Steadfast is a sub-program called from DriverProg.cbl above. Steadfast is identi cal to Fickle except that it uses the IS INITIAL phrase to avoid State Memory. Calling external sub-programs, IS INITIAL, LINKAGE SECTION, EXIT PROGRAM Download View DateDriver.cbl A driver program for the date validation sub-program below. Accepts a date from the user, passes it to the date validation sub-program and interprets and displa ys the result. External sub-programs, CALL, ACCEPT, DISPLAY, EVALUATE Download View ValiDate.cbl A date validation sub-program. Takes a date parameter in the form DDMMYYYY and r eturns a code indicating if the date was valid or not. If not valid, the code in dicates why the date was not valid (e.g. day to great for month). External sub-programs, IS INITIAL, LINKAGE SECTION, EVALUATE, IF..ELSE, DIVIDE.. REMAINDER, SET ConditionName, EXIT PROGRAM Download View DayDiffDriver.cbl A driver program that accepts two dates from the user and displays the differenc

e in days between them. This program uses the ValiDate.cbl sub-program above and also contains a number of contained sub-programs. CALL, LINKAGE SECTION, Contained Sub-Programs, External Sub-Programs, Intrinsic Functions, EXIT PROGRAM, END PROGRAM, FUNCTION INTEGER-OF-DATE Download View ACME99.cbl Exam paper model answer. A program is required which will process the Stock and Manufacturer files to create an Orders file containing ordering information for all the parts that need to be re-ordered (i.e. where the QtyInStock is less than the ReorderLevel). For EU countries only, the COSTOFITEMS and POSTAGE fields of each Orders file record must be calculated. The Postage rate is obtained by cal ling an existing program. Read the program specification first. The required data files may be downloaded from there. Indexed files, Relative Files, SubPrograms, CALL..USING, READ, WRITE, REWRITE, C ondition Names (level 88s), EVALUATE, UNSTRING, MULTIPLY..ON SIZE ERROR Download View SFbyMail.cbl Exam paper model answer. A program is required to apply the Orders file (contain ing customer orders) to the indexed Book Stock file and to produce the Processed Orders file. Read the program specification first. The required data files may be downloaded from there. CALL, subprograms, Sequential files, Indexed files, READ, WRITE, REWRITE, COMPUT E, UNSTRING Download View

String handling Program Name Description Major constructs Action RefMod.cbl Solves a number of string handling tasks such as : - Extracting a substring from a string given the start position and length of the substring. Extracting the first x number of chars from a string. Extracting the last x number of chars from a string. Removing trailing blanks from a string. Removing leading blanks from a string. Finding the location of the first occurrence of any of a substring's chars in a string Reference Modification, INSPECT, Intrinsic Functions, FUNCTION REVERSE Download View UnstringFileEg.cbl

An example showing the unpacking of comma separated records and the size validat ion of the unpacked fields. To test this program use the data file VarLen.dat. UNSTRING, Reference Modification, IF, Condition Names, Sequential files Download View FileConv.Cbl Exam paper model answer. A program is required to convert the unsorted Client-Na mes file of free-format, variable length, records into a sorted file of fixed le ngth records. The sorted file must be sorted into ascending Client-Name within a scending County-Name. In addition to converting and sorting the file, the progra m must ensure that the county name is valid and must convert it to a county numb er. Read the program specification first. The required data files may be downloaded from there. Sequential files, SORT with Input Procedure, Pre-Defined Table of values, STRING , UNSTRING, INSPECT, SEARCH ALL Download View

The COBOL Report Writer Program Name Description Major constructs Action RepWriteA.cbl A simplified version of RepWriteFull.cbl using only one control break. All four of these Report Writer programs use the GBsales.dat data file. Report Writer, Report Section, INITIATE, GENERATE, TERMINATE Download View RepWriteB.cbl A simplified version of RepWriteFull.cbl containing all the control breaks but n ot using Declaratives. All four of these Report Writer programs use the GBsales.dat data file. Report Writer, Report Section, INITIATE, GENERATE, TERMINATE Download View RepWriteFull.cbl The full version of the report program containing all the control breaks and usi ng Declaratives to calculate the salesperson salary and commission. All four of these Report Writer programs use the GBsales.dat data file. Report Writer, Report Section, INITIATE, GENERATE, TERMINATE, Declaratives, USE BEFORE REPORTING Download View RepWriteSumm.cbl The summary version of the full report program containing all the control breaks

and using Declaratives to calculate the salesperson salary and commission. All four of these Report Writer programs use the GBsales.dat data file. Report Writer, Report Section, INITIATE, GENERATE, TERMINATE, Declaratives, USE BEFORE REPORTING Download View COBOL Tables Program Name Description Major constructs Action MonthTable.cbl This program counts the number of students born in each month and displays the r esult. The program uses a pre-filled table of month names. This program is the solution to one of the programming exercises. Read the program specification first. Pre-Filled Tables, Sequential files, PERFORM..VARYING, PERFORM..UNTIL Download View FlyByNight.cbl Exam paper model answer. A program is required which will read the Booking Maste r file to produce a Summary file sequenced upon ascending Destination-Name. Read the program specification first. The required data files may be downloaded from there. Pre-Filled Tables, Sequential Files, SORT with Input Procedure, SEARCH, INSPECT Download View USSRship.cbl Exam paper model answer. A program is required to produce a report detailing the major vessels (Vessels of tonnage 3,500 or greater and all submarines) in each of oceans and major seas of the world. Read the program specification first. The required data files may be downloaded from there. Sequential files, SORT with Input Procedure, Print Files, Pre-defined tables, Co ndition Names Download View

To Student Resources Evaluation Form Search CSIS Web Site Selectable Site Contents Last updated : June 2002 e-mail : CSISwebeditor@ul.ie

You might also like