This test covers the material on:
This test includes true-false and multiple-choice questions and questions with written answers, some short and some longer. It will be an open-book exam; you may bring your notes and books and your programs and a calculator. Do not bring a computer.
In studying: go over what you did in the homework, and go over the quizzes.
It is intended that most of the questions will be about material included on assignments 5 through 8.
On this particular test, there is nothing about QSAM or the other macros.
COBOL features
In particular, this includes Copy, Redefines, String and Unstring, and the Usage clause, but it may also include whatever else we have been doing in COBOL.
COBOL tables
How do we define a table? Subscripted or indexed? In order on a specific field? Variable-size?
How do we use Search and Search All? How do we change the value of an index?
Possible questions might involve defining a table or doing some elementary table processing.
COBOL Sort and Merge
What are the JCL requirements for using Sort or Merge? What is an SD and where does it appear?
You need to understand the elementary Sort with Using and Giving.
Also understand input and output procedures, and how to write them.
What are the various special registers we can use with Sort or Merge?
Possible questions might involve writing a Sort or Merge statement and/or writing an input or output procedure.
Linkage
Static and dynamic calls in COBOL, and the JCL requirements for each.
Passing arguments by reference or by content.
Linkage Section and Procedure Division statement.
Return code from a COBOL program
GoBack versus Stop Run.
Utilities
This refers to IEFBR14, IEBPTPCH, IEBGENER and DFSORT.
Understand the control statements for IEBGENER and for DFSORT. Also try to be familiar with their JCL.
Understand what each of the utilities is used for.
JCL Procedures
Understand the sequence of events in creating a JCL procedure.
Understand the kinds of changes we can make when we execute a procedure.
Our big example of a procedure is IGYWCG. Look at it.
A likely question is to execute a procedure making specific changes.
(1) you would need to use an input procedure or
(2) you would need an output procedure or
(3) you could use either one or
(4) it can't be done in one operation (or not by any simple
means we have covered).
These are all independent of each other. At least one is hard.
01 Test-Table.
05 Level-1 Occurs 10 times
10 Field-1-1 Pic X(16).
10 Level-2 Occurs 9 times.
15 Field-2-1 Pic 9(7)V99 Usage is Comp-3.
15 Field-2-2 Pic 99V99 Usage is Comp.
10 Field-1-3 Pic X(3).
How many bytes of space does Test-Table occupy? Show your calculation.
HOURS DS PL2
OVERTIME DS PL2
RATE DS PL3
TOTALPAY DS PL5
where HOURS = number of hours worked,
OVERTIME = number of overtime hours worked,
RATE = the hourly rate of pay in dollars and cents, and
TOTALPAY = the employee's total pay amount in dollars and cents.
TOTALPAY = (HOURS + 2 * OVERTIME) * RATE.
Write the complete Procedure Division code for MINOR. Do not change the values of HOURS, OVERTIME, or RATE.
//COMPL PROC CPARM=OFFSET, // SNAME='KC0SOB1.OLDPGM', // SSPACE='(TRK,(3,3))', // SUNIT=SYSALLDA, // SDISP= //COB EXEC PGM=IGYCRCTL,REGION=2048K,PARM='&CPARM' //STEPLIB DD DSN=IGY340.SIGYCOMP,DISP=SHR //SYSIN DD DSN=&SNAME,UNIT=SYSALLDA,DISP=SHR //SYSLIN DD DSN=&&MODULE,DISP=(NEW&SDISP),UNIT=&SUNIT,SPACE=&SSPACE //SYSUT1 DD DSN=&&SYSUT1,UNIT=&SUNIT,DISP=(NEW,DELETE,DELETE), // SPACE=(CYL,(1,1)) //SYSUT2 DD DSN=&&SYSUT1,UNIT=&SUNIT,DISP=(NEW,DELETE,DELETE), // SPACE=(CYL,(1,1)) //SYSUT3 DD DSN=&&SYSUT1,UNIT=&SUNIT,DISP=(NEW,DELETE,DELETE), // SPACE=(CYL,(1,1)) //SYSUT4 DD DSN=&&SYSUT1,UNIT=&SUNIT,DISP=(NEW,DELETE,DELETE), // SPACE=(CYL,(1,1)) //SYSUT5 DD DSN=&&SYSUT1,UNIT=&SUNIT,DISP=(NEW,DELETE,DELETE), // SPACE=(CYL,(1,1)) //SYSUT7 DD DSN=&&SYSUT1,UNIT=&SUNIT,DISP=(NEW,DELETE,DELETE), // SPACE=(TRK,(2,4)) //SYSPRINT DD SYSOUT=A // PEND
Write the IBM JCL that will execute the above procedure and make the following changes. If a symbolic parameter exists for that field, you must use it to make the change instead of overriding the existing parameter.
01 Salary Pic 9(5) Comp.
01 Overtime Pic 9(4) Comp.
01 Total-Salary Pic 9(6) Comp.
This is line 1 of EINS.
This is line 2 of EINS.
The second member is called ZWEI and should contain these two lines:
This is line 1 of ZWEI.
This is line 2 of ZWEI.
You will need to supply the data as in-stream data.
A. True B. False
01 S-W-Record.
05 S-W-Key Pic X(10).
05 S-W-Code Pic X(5).
05 Other-Data Pic X(85).
The Sort statement is this:
Sort S-W-File
On Descending Key S-W-Key
Using Old-Data
Giving Old-Data-Sorted.
Assume none of the files involved has been opened or closed yet.
Assume we have a Sort-Work-File as usual, with data record
01 S-W-Record.
05 Pic X(10).
05 S-W-Key Pic X(9).
05 Pic X(51).
We want to eliminate duplicates, keeping the first copy of each set of duplicates.
Write the Merge statement we need in the Procedure Division, and write the output procedure.
Instead, we could use the COBOL Sort verb to do the job. Assume we have a Sort-Work-File as usual, with data record
01 S-W-Record.
05 Pic X(39)
05 S-W-Key Pic X(8).
05 Pic X(33).
Assume KC0CSCI.SORTME and KC0CSCI.SORTED have COBOL names Sort-Me and Sort-Out.
Write the Sort statement we need in the Procedure Division with the Using and Giving options.
Now suppose we want accomplish exactly the same task, but we want to use the Sort verb with an input procedure and an output procedure.
Write the Sort statement we need in the Procedure Division. Also write the input procedure, the output procedure, and any Working- Storage items we may need to make this work.
HOURS DS PL2
OVERTIME DS PL2
RATE DS PL3
TOTALPAY DS PL5
where HOURS = number of hours worked,
OVERTIME = number of overtime hours worked,
RATE = the hourly rate of pay in dollars and cents, and
TOTALPAY = the employee's total pay amount in dollars and
cents.
TOTALPAY = (HOURS + 2 * OVERTIME) * RATE
Write the complete Procedure Division code for MINOR. Do not change the values of HOURS, OVERTIME, or RATE.
If FLAG = 'Y', MINION should set NET = RECEIPTS. If FLAG = 'N', MINION should set NET = RECEIPTS * 0.95. If FLAG is 'Y' or 'N', MINION should provide a return code of 0, but if FLAG is some other value, MINION should provide a return code of 99 and do nothing with NET.
A. The default is to pass all parameters By Content.
B. A parameter passed By Reference cannot have its value changed
by the subprogram.
C. Parameters can be passed By Content only if we are using the
CONTENT compiler option.
D. If we change the value of a parameter which has been passed
By Reference, then we are also changing the value of the
corresponding field in the calling program.
E. None of the above is true.
GENERATE MAXFLDS=7,MAXLITS=3
RECORD FIELD=(9,21,,1),
FIELD=(10,11,,10),
FIELD=(1,1,,20),
FIELD=(2,'19',,21),
FIELD=(6,41,,23),
FIELD=(1,30,,29),
FIELD=(1,'O',,30)
The input records are each 52 characters long. Each contains a first name (10 characters), a last name (10 characters), a Social Security Number (9 digits), a code indicating sex (1 character), a telephone number (10 digits), a date of birth (6 digits), and an account number (6 characters).
One of the records is:
JOHN PUBLIC 918320754M8155551234740516UVWXYZ
1234567890123456789012345678901234567890123456789012
(The line of numbers is a ruler so you can count columns easily.)
The output records are each 30 characters long.
When the above input record is processed, what will the resulting output record contain?
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
Which fields (how long and where) in the input record were not copied at all?
ABCDEF This is record 1.
GHIJKL This is record 2.
MNOPQR This is record 3.
STUVWX This is record 4.
YZABCD This is record 5.
EFGHIJ This is record 6.
KLMNOP This is record 7.
QRSTUV This is record 8.
WXYZAB This is record 9.
The records are each 25 bytes long.
We want to create 3 new members RHO, SIGMA and TAU of a new PDS. RHO should contain the the first 4 records, SIGMA should contain the next two records, and TAU should contain the last 3 records.
Write the IEBGENER control statements we need to do this.
Suppose I run the job twice. What will happen the second time?
Suppose I add a step to my job at its beginning, deleting EXTRACT.DATA. Now suppose I run my job, and then some helpful co-worker happens to delete EXTRACT.DATA. What will happen next time I run my job?
01 In-Record.
05 In-Key Pic X(10).
05 In-Data Pic X(110).
I want to be able to search the table using a binary search with the first 10 bytes in each record as the key field. I will be looking for a value which is in a field called Target-Key.
I need to do some of the following. (I may need to do other things as well.) Mark the ones which are not needed to do the search.
___ Use DFSORT to sort the input file in descending order on
the first 10 bytes in each record.
___ Define a table big enough to contain 50 entries. (Use T- as
a prefix for items in the table.)
___ The table should be indexed. (Call the index T-X.)
___ The table definition should say "On Descending Key T-Key".
___ The table definition should say "On Ascending Key T-Key".
___ Initialize the table to High-Values.
___ Initialize the table to Low-Values.
___ Set T-X to 1.
___ Move 1 to T-X.
___ Use a Perform...Varying loop to load the table from the sorted
input file.
___ Count the records.
___ Use Search All to do the actual search of the table.
___ Use Search to do the actual search of the table.
What COND should I put on LITTLE?