cobol/cobol ii questionnaire - geocities  · web viewcobol/cobol ii questionnaire. q.1 cobol is an...

49
COBOL/COBOL II Questionnaire COBOL/COBOL II QUESTIONNAIRE Q.1 COBOL is an acronym. What does it stand for? A Common Business-Oriented Language. Q.2 What are the structured development aids introduced in COBOL II? A COBOL II offers the following options : a. EVALUATE : permits CASE construction. b. The in-line PERFORM : permits 'do’ construction. c. TEST BEFORE and TEST AFTER in the PERFORM statements : permit 'do while' and 'do until' constructions. Q.3 What feature in COBOL II is Similar to features in other programming languages? A The most obvious are the explicit scope terminators for most processing actions. An alphabetical list indicates the variety : end-add end-if end-search end-call end-multiply end-start end-compute end-perform end-string end-delete end-read end-subtract end-divide end-return end-unstring end-evaluate end-rewrite end-write The scope terminator ',' (as well as the period '.') is still available. Q.4 What are the three categories of data defined in the DATA division? A The three categories of data defined in DATA division are : The file section (FD) information Working storage information Linkage-section data definitions Q.5 When is using READ INTO not advisable? A READ INTO performs two actions : the file is read into the buffer and the record is moved to working storage. The construct assumes that the LRECL of every record is the same. When used with variable-length records, the results may be "unexpected". Q.6 What are the techniques for achieving "top-down" programming? A Top-down is an effort to avoid spaghetti code and is sometimes referred to as "go to less" programming. Processing is performed from beginning to the end of paragraphs. Performs rather than "go tos" are used to move through code. The PERFORM... THRU structure should be used only when THRU is to an EXIT paragraph. Q.7 What is the EVALUATE statement? A EVALUATE is the alternative to the nested IF statements and is used to select from a list of processing actions. WHEN is used instead of IF to determine if the action is to be taken. Like the IF statement, the WHEN statement should be coded from the most likely to the least likely occurrence. Like the nested IF, once the condition is true, control passes from evaluate statement to the next statement in the program. Page 1 of 49

Upload: others

Post on 21-Mar-2020

151 views

Category:

Documents


13 download

TRANSCRIPT

COBOL/COBOL II Questionnaire

COBOL/COBOL II QUESTIONNAIRE

Q.1 COBOL is an acronym. What does it stand for?A Common Business-Oriented Language.

Q.2 What are the structured development aids introduced in COBOL II?A COBOL II offers the following options :

a. EVALUATE : permits CASE construction.b. The in-line PERFORM : permits 'do’ construction.c. TEST BEFORE and TEST AFTER in the PERFORM statements : permit 'do

while' and 'do until' constructions.

Q.3 What feature in COBOL II is Similar to features in other programming languages?

A The most obvious are the explicit scope terminators for most processing actions. An alphabetical list indicates the variety :end-add end-if end-searchend-call end-multiply end-startend-compute end-perform end-stringend-delete end-read end-subtractend-divide end-return end-unstringend-evaluate end-rewrite end-write

The scope terminator ',' (as well as the period '.') is still available.

Q.4 What are the three categories of data defined in the DATA division?A The three categories of data defined in DATA division are :

The file section (FD) information Working storage information Linkage-section data definitions

Q.5 When is using READ INTO not advisable?A READ INTO performs two actions : the file is read into the buffer and the

record is moved to working storage. The construct assumes that the LRECL of every record is the same. When used with variable-length records, the results may be "unexpected".

Q.6 What are the techniques for achieving "top-down" programming?A Top-down is an effort to avoid spaghetti code and is sometimes referred to as

"go to less" programming. Processing is performed from beginning to the end of paragraphs. Performs rather than "go tos" are used to move through code. The PERFORM... THRU structure should be used only when THRU is to an EXIT paragraph.

Q.7 What is the EVALUATE statement?A EVALUATE is the alternative to the nested IF statements and is used to select

from a list of processing actions. WHEN is used instead of IF to determine if the action is to be taken. Like the IF statement, the WHEN statement should be coded from the most likely to the least likely occurrence. Like the nested IF, once the condition is true, control passes from evaluate statement to the next statement in the program.

Q.8 What are the two most common forms of the EVALUATE statement?A The two most common forms of the EVALUATE statement are :

1. EVALUATE TRUE, which allows multiple variables to be checked for a true condition. The list of options being tested must be prioritized, as the EVALUATE statement selects only the first TRUE condition per statement.

2. EVALUATE VARIABLE-NAME checks multiple options for TRUE condition of a variable.

Page 1 of 40

COBOL/COBOL II Questionnaire

Q.9 What does the INITIALIZE statement do?A The INITIALIZE statement initializes data areas to zeros and spaces.

Q.10 How can you use INITIALIZE for specifying specific values?A INITIALIZE GROUP-ITEM REPLACING ALPHANUMERIC DATA By HIGH-VALUES. When the

REPLACING option is used, only specific type will be initialized.

Q.11 What is reference modification?A Reference modification is the name for substring manipulations. The ‘:’

allows part of a data item to be used without defining data item in the data division.

Q.12 Give two examples of how you would use reference modification?A 1. In a list of ZIP codes, the first three digits define a geographic area

:IF ZIP ( I : 3 ) = '100'

AREA = MANHATTAN END - IF

2. MOVE 'MEXICO' TO STATE ( 5 : 6 ) could change NEW JERSEY to NEW MEXICO.

Q.13 What is a nested program?A A nested program is a program that allows coding of multiple procedure

division within a single program. It is like a CALL, but it is more efficient.

Q.14 What is the difference between a directly contained and an indirectly contained program in a nested program?

A A directly contained program is in the next-lower nesting, while the indirectly contained program is more than one nesting below.

Q.15 Can there be a problem using ROUNDED in a compute statement?A Yes. The compute rounds each intermediate result in a compute statement and

not just the final result.

Q.16 Name some of the advantages of COBOL II?A VS-COBOL II makes the operation of computer programs more efficient :

It allows code to be shared. It optimizes code. It allows faster sorting. It eases program bugging and maintenance namely :

Supports a debugging tool: COBTEST. Program listings provide information in a user-oriented way.

Formatted dumps display status of programs and files in COBOL format, including data names and content.

VS-COBOL/CICS interaction is easier to work with because of defined interfaces.

Q.17 What are VS-COBOL II special features?A The support of 31-bit addressing permits programs to operate “above the line”

and to use larger tables in larger programs. This added space allows VSAM buffers to be placed above the 16-meg line, therefore the buffer can be larger.

Q.18 What options have been removed in COBOL II?A COBOL II does not support ISAM and BDAM access methods and clauses which are

specific to them. In addition, the following have been eliminated such as : REPORTWRITER EXAMINE TRANSFORM READY TRACE and RESET TRACE

Page 2 of 40

COBOL/COBOL II Questionnaire

REMARKS paragraph and NOTES statement The ON statement (ON 1 PERFORM ...)

Q.19 What is a nested-copy statement?A Independent blocks of code can be copied into the main sections of a program

during compilation. COBOL II allows copied code to copy other code.

Q.20 What is an example of application efficiency provided by COBOL II?A COBOL II will allow a program to be compiled as RE-ENTRANT. A re-entrant

program can be placed in a shared virtual storage area, so that one copy of program is used to satisfy all concurrent requests for the program.

Q.21 What is COBTEST?A COBTEST is a debugging tool for examining, monitoring and controlling VS-

COBOL II programs in a test environment. Programs can be debugged by using a full-screen interactive mode, as well as a line interactive or batch mode. DATA may be altered, logic may be changed and results can be viewed on-line.

Q.22 How has the return code for VSAM files been changed in COBOL II?A The return code has been enlarged to 6 bytes and returns the VSAM return code

when the FILE STATUS is not 00. The format of the expanded return code is as follows : REGISTER 15 Return Code PIC 9(2) COMP. FUNCTION CODE PIC 9(1) COMP. FEEDBACK CODE PIC 9(3) COMP.

Q.23 What type of documentation would you recommend for a COBOL program?A Document code changes at the beginning of the Program. The documentation

should include chronological references following the date compiled statement and should include date in a fixed position and a brief description of the change in a fixed position.

Programming techniques such as the use of copybooks, meaningful variable name, use of 88 levels and top-down code also provide informative documentation.

Q.24 What is the file organization clause?A The file organization clause identifies logical structure of a file.

Q.25 Can the logical structure of a file be changed once it has been created?A No.

Q.26 What is file organization indexed?A The file organization indexed is where the position of each logical record

within a file is determined by indexes created with the file and embedded in a key in each record.

Q.27 What is file organization sequential?A The file organization sequential indicates that records are loaded into a

file based on a record-to-record relationship of data sequence. Sequential is the default file organization.

Q.28 What is file organization relative?A The position of each logical record in the file is determined by its relative

record number.

Page 3 of 40

COBOL/COBOL II Questionnaire

Q.29 What is the dynamic access mode?A The dynamic access mode permits reading and writing file records by a

specific read or write statement which can be sequential and/or random. The dynamic access mode assumes that a file is indexed.

Q.30 What access modes are permitted with sequential organization?A The sequential access mode only.

Q.31 What access modes are permitted with indexed organization?A All three access modes-sequential, random and dynamic-are permitted. In

dynamic access mode, the file can be accessed sequentially and/or randomly.

Q.32 What access modes are permitted with relative organization?A All three access modes-sequential, random and dynamic-are permitted.

Q.33 What is a START statement?A The START statement is used with an indexed or relative organization file for

positioning within the file for subsequent sequential record retrieval. The access key may be qualified to provide a record equal to the key, greater than the key, less than the key, greater than or equal to the key.

Q.34 Who t is a subscript?A A subscript is a positive integer that represents an occurrence within a

table that has been redefined with an occurs clause. A subscript must be defined in working storage and can be manipulated like any numeric variable.

Q.35 What is an index for tables?A An index references data in a table, but does it differently than a

subscript. The index is defined with the table and represents a displacement into the table.

Q.36 What are the advantages of indexes?A Indexes are more efficient when used with the SEARCH verb because the

computer does not have to generate displacement from the beginning of the table.

Q.37 What are two SEARCH techniques?A The sequential or serial search moves through a table one record at a time

until a match has been made. For example, in a table of 10 numbers (1 to 10), to find the number 8, the search must check and eliminate numbers 1 to 7. The process is initiated by verb SEARCH.

The binary is a dichotomizing search and must have a key that is in ascending or descending order. At each step of search, half of the records in the table are eliminated. For example, in SEARCH for the number 8, the first division would locate the number 5 and eliminate records 1 to 5. The second division would locate the number 8. The process is initiated by the very SEARCH ALL.

Q.38 What COBOL verbs can change table indexes?A SET, SEARCH and PERFORM can change the value of a table index.

Q.39 Is a binary search efficient when compared to a sequential search?A The binary search is more efficient because it finds the answer with fewer

data checks. However the process for each data check is less efficient because of the machine code generated. If the list/table of variables has fewer than 100 entries, a sequential search would be a better choice.

Page 4 of 40

COBOL/COBOL II Questionnaire

Q.40 What is the most efficient method for locating data in a table?A If you know the location of the data in the table, use it. For example, in a

table of names of months, use numeric value of the month to locate the name. To convert 04/01/93 to April 01 1993, the 04 would be used as the subscript to locate the word April.

Q.41 How could one subscript sequentially through a table of 50 states, looking for NY?

A Given the subscript SUB-1 PIC 99, the following COBOL II code could be used :

PERFORM TABLE - LOOK - UP THRU TABLE - EXIT VARYING SUB 1 FORM 1BY 1 UNTIL SUB - 1 > 50 OR MATCH - FOUND.

CONTINUE 1. (CONTINUE WITH PROGRAM)

TABLE - LOOK - UP.

IF STATE (SUB - 1) = ‘NY’SET MATCH - FOUND TO TRUEMOVE TABLE-DATA (SUB-1) TO OUTPUT DATA

END-IF

TABLE - EXIT. EXIT.

Q.42 Recode the foregoing table lookup using an in-line perform.

PERFORM VARYING SUB - 1 FROM 1 BY 1 UNTIL MATCH - FOUND OR SUB - 1 > 50IF STATE (SUB - 1) = ‘NY’

SET MATCH - FOUND TO TRUEMOVE TABLE - DATA (SUB - 1) TO OUTPUT - DATA

END - IF.END - PERFORM.

Q.43 Give answer to the previous question using a binary search, given the 01 level table name as 01 TABLE-NAME, the occurs clause indexed by table-index, ascending key is table-item.

SEARCH ALL TABLE - NAMEAT END

MOVE ‘FILE-ITEM NOT FOUND’ TO FILE - ITEM - DESCWHEN TABLE - ITEM (TABLE - INDEX) EQUALS FILE - ITEM

MOVE TABLE - ITEM - A (TABLE - ITEM) TO FILE - ITEM - DESCEND - SEARCH.

Q.44 Describe a paragraph - naming convention that would assist navigation through a COBOL program?

A Paragraph names should be descriptive of what is contained within the paragraph and preceded by a sequential number according to their position within the program. For example :

100 - OPEN - FILLS; 500 - READ MASTER etc,

Q.45 What is one major advantage of COBOL II when operating in an MVS/XA environment?

A COBOL II can utilize 31-bit addressing and therefore operate “above the line” (above 17-MB virtual memory restriction) in an MVS/XA environment-an advantage not available in VS-COBOL.

Page 5 of 40

COBOL/COBOL II Questionnaire

Q.46 What is the format of a COBOL internal sort using an input procedure and an output procedure?A. SELECT SORT-FILE

SD SORT - FILESORT RECORD IS SORT - WORk - RFC.

01 SORT - WORK REC.05 SORT-DATA.

07 DATA - PART - 1 PIC X(10).07 FIRST - SORT - KEY PIC X(5).

(continue with record description for fields necessary for sorting and fields to be sent to sort, the entire record need to be sorted unless required by the program)

PROCEDURE DIVISION.SORT SORT - FILE

ASCENDING KEY FIRST - SORT - KEYINPUT PROCEDURE SORT - INPUT - PROCEDURE - 0200OUTPUT PROCEDURE SORT - OUTPUT - PROCEDURE - 0500

SORT - INPUT - PROCEDURE - 0200 SECTION.SORT - INPUT - READ - SELECT.

fuse the input procedure to read the file to be sorted, select all or portion of data, process the data in any way and move the data to the sort - work - rec for subsequent release to the sort.)

RELEASE SORT - WORK - REC.

SORT - OUTPUT - PROCEDURE - 0500 SECTION.SORT - OUTPUT - PROCESSING.

(use the output procedure to return and process the sorted records)

RETURN SORT - FILE AT END ...

Q.47 What are come advantages of a COBOL internal sort?A. The advantages of a COBOL internal sort are :

You can select only the records required by the program, reducing sort resource requirements

Records can be processed before and after the sort One or more sorts may be performed on the same data for different

functions within the program The program will document the criteria for record selection and sort

criteria Data from separate files can be combined

Q.48 Is the SORT utility a responsible alternative to the internal sort?A. The sort utility would require an extra step in the JCL and would select,

sort and document criteria. It could not manipulate the data before sort. The final decision depends on installation standards.

Q.49 What is a bubble sort?A. A bubble sort is an efficient way of resequencing a small table that already

resides in memory. The sorting algorithm that can be used is referred to as a bubble sort. The bubble sort compares the key of first item in a table with the keys of all other items in the table, each time moving the item with the

Page 6 of 40

COBOL/COBOL II Questionnaire

lowest key to the first item’s position. The process is continued, starting with the second item, comparing it to the third item, swapping pairs of items until the entire table is in order.

Q.50 What is an in-line perform?A COBOL II allows a performed procedure to be, coded in-line. The perform

statements is coded without a paragraph name, followed directly by the code to be performed. An END - PERFORM statement is required and coded at the end of an in-line perform.

PERFORM :END - PERFORM

Q.51 What Is COBOL II statement WITH TEST AFTER?A In a PERFORM, the UNTIL clause is examined before the PERFORM, not after.

COBOL II allows programmer to specify PERFORM WITH TEST AFTER, which will always execute a paragraph at least once.

Q.52 How could 88 levels be used for validation of data for valid values and valid ranges?

A. The 88 level is used to specify the valid values and/or rings of values and then the 88 data name is used in an if statement to test the data.

Q.53 Give an example of how you would code an “88”.A 02 INPUT - LOCATION PICTURE 9(3).

88 VALID - LOCATIONS VALUES ARE 100, 200 THRU 299.

Q.54 How could 88 levels be used to determine the next step in navigating through a program?

A The 88-level data name can be used to specify a condition in both if and evaluate statements.

IF VALID - LOCATIONsPERFORM PARA - A

END - IF

EVALUATE TRUEWHEN VALID -LOCATIONS

PERFORM PARA - AWHEN OTHER

PERFORM PARA - BEND-EVALUATE

Q.55 What is a CALL statement in COBOL?A A CALL is a statement that transfers control from one object program to

another object program within the same run-unit..

Q.56 What does the COBOL “CANCEL” statement do?A The CANCEL statement ensures that next time the referenced sub- program is

called it will be entered in its original state.

Q.57 What is the LINKAGE SECTION in COBOL?A The LINKAGE SECTION of a called program defines the data that is available

(from a calling program) to a called program.

Q.58 Which program can reference the data items described in the LINKAGE SECTION?A The data items in a LINKAGE SECTION may be referenced by the calling program

as well as by the called program.

Page 7 of 40

COBOL/COBOL II Questionnaire

Q.59 What is the USING phrase of CALL statement?A The USING phrase makes available data items from calling to the called

programs.

Q.60 When can the USING phrase be included in the CALL statement?A The USING phrase can be included in the CALL statement only if there is a

USING phrase in the Procedure Division header or the ENTER statement through which the called program is invoked.

Q.61 Can the number of operands in the USING phrase in called program be different than the number of operands in the USING statement of calling programs?

A The number of operands in the calling program USING phrase and the called program USING phrase must be identical.

Q.62 How do file operands of the calling program USING phrase align with the operands of the called program USING phrase?

A The correspondence is by position - not by name.

Q.63 Can a called program contain CALL statements?A: Yes. However, a called program may not CALL the calling program directly or indirectly.

Q.64 What is a COPY statement?A The COPY statement copies existing text from a copy library into a COBOL

program. For example :COPY text - name.

Q.65 What is a copy library?A. A copy library is basically a COBOL source library containing members that

can be, copied into COBOL source programs.

Q.66 What type of text can be copied using the COPY statement?A. The type of text that can be copied into a COBOL program includes all types

of components of a COBOL program, including file definitions, working storage and procedure division code.

Q.67 What is the REPLACING option of a COPY statement?A The REPLACING option of a COPY statement contains two operands and performs

the COPY, replacing all occurrences of the first operand within the copied library member text by the second operand.

Q.68 Can the text of a copy library member contain nested COPY statements?A In COBOL II a copy library member may contain nested COPY statements. This is

not the case in VS-COBOL.

Q.69 Can a copy member with nested COPY statements contain the REPLACING option?A No, a nested COPY statement cannot contain the REPLACING option.

Q.70 Can a COPY statement with the REPLACING option contain nested COPY statements?

A No, a COPY statement with the REPLACING option cannot contain nested COPY statements.

Q.71 What are some advantages to using COPY statements?A An installation can develop standard file descriptions and mandate their use

for standardization and ease of testing and maintenance. Also, standard working storage descriptions, record descriptions and procedure division code can be developed, enhancing development and maintenance efforts.

Page 8 of 40

COBOL/COBOL II Questionnaire

Q.72 What is the BY CONTENT phrase in COBOL II?A The BY CONTENT phrase permits constants to be passed to a called program by

using the CALL statement.

Q.73 What is the BY CONTENT LENGTH phrase in COBOL II?A: The BY CONTENT LENGTH phrase permits the length of a data item to be passed

to a called program by using the CALL statement.

Q.74 What is the PICTURE clause?A The PICTURE clause defines an elementary items basic characteristics and

editing requirements.

Q.75 What would be the result of moving 030193 to a PICTURE clause of PICTURE 99/99/99?

A The result would be 03/01/93 - but only if the month, day and year were moved separately.

Q.76 How are numbers stored in the computer?A: Each digit is stored in a single byte; the first 4 bits contain the “zone”.

The last 4 bits contain the digit. For numbers the zone indicates positive numbers (a C or an F) and negative numbers (D).

Q.77 What is EBCDIC?A: EBCDIC is an acronym for Extended Binary Coded Decimal Interchange Code.

Q.78 In EBCDIC, how would the number 1234 be stored?A The number 1234 would be stored as : Fl F2 F3 F4.

Q.79 What is packed decimal?A. It is a method of storing numbers in less space. The zone is eliminated from

each of the digits except for the last digit which contains sign for number. Packed decimals are always stored in an even number of bytes and the last byte is always the sign. The number of bytes used is determined by adding 1 to the total bytes requested and dividing by 2. The answer is always an even number.

Q.80 How would the number +1234 be stored if a PIC clause of PICTURE S9(4) COMP-3 were used?

A The answer will use 3 bytes (4 + 1 = 5 / 2 = 2.5 or 3), so a leading 0 will pad the answer : 01234F.

Q.81 What are binary numbers?A Binary numbers are strings of 0s and 1s which are stored in half word, full

word, or double word, depending on the size of the number. Up to 4 digits are stored in 2 bytes or a half word. 5-9 digits are stored in 4 bytes or a word. 10-18 digits are stored in 8bytes or a double word.

Q.82 What is a common problem when doing a table lookup?A The maximum occurrences of the table are exceeded as a result of exiting

perform based on testing the subscript for "equal to" the maximum number of occurrences rather than "greater than" the number of occurrences. By manipulating subscript, the subscript can become greater than the maximum number of occurrences, permitting the perform to continue beyond bounds of the table.

Q.83 What will be the result of executing a VS-COBOL II program when a subscript exceeds the table limits?

A The table data overwrites program code and will continue to do so until there is an abend. The abend message will reference gibberish code rather than a subscript out of range.

Page 9 of 40

COBOL/COBOL II Questionnaire

Q.84 What will be the result of executing a VS-COBOL II program that was compiled with the SSRANGE option, when a subscript exceeds the table limits?

A The program will terminate.

Q.85 What is a common problem associated with reading a datafile in a test environment?

A A read is executed on a file that has not been opened by the program.

Q.86 What problem could occur when a file is read with an incorrect file definition?

A A data exception could occur causing the program to terminate.

Q.87 In a production environment, what should be programmed when an abnormal condition is encountered and it is undesirable to continue processing?

A The program should go to a programmed abnormal exit and pass a condition code to the job control language via. an installation standard abend procedure. The job control language should in turn test the condition code and force the job to terminate with an abnormal condition code.

COBOL TEST

Instructions : Do not write on this quiz paper.Please answer on the sheet provided.

Time : 1hr. Marks : 80

1. Which one of the following is an INCORRECT specification for a data-nme?

a) LAST-NAMEb) 1234c) 12A3d) SALES

2. Which of the following is an INVALID paragraph name ?

a) 999b) A-1c) A+1d) XX9

3. Level numbers range from _____ to _____ .

a) 00, 49b) 01, 50c) 01, 49d) 00, 50

4. Two data names at the same level within a record must

a) be unique

b) not necessarily unique

c) necessarily unique

d) none of the above5. With COBOL 85 the use of the word FILLER.

a) cannot be ommittedb) is used to report memory usage c) can be omitted entirelyd) is a form feed control command to the printer

Page 10 of 40

COBOL/COBOL II Questionnaire

6. The maximum number of digits in a numeric item is

a) 16b) 17c) 18d) 20

7. Which of the following is not a VALID COBOL figurative constant

a) ZEROb) ZEROSc) ONESd) QUOTES

8. A STOP RUN statement

a) must appear only once in a programb) can appear in several places in a programc) was not available in COBOL 74d) is used to stop the printer.

9. The VALUE clause

a) is used to obtain the value of a variable.b) is used to initialise a variable to a certain value.c) cannot be used in the data division of a program.d) cannot be used to initialise a nonnumeric varaible.

10. Which of the following declarations is essential in the IDENTIFICATION DIVISION.

a) DATE-COMPILED.b) PROGRAM-ID.c) AUTHOR.

a) INSTALLATION.

11. When the UNTIL option is used with PERFORM verb, the condition is tested a) before

b) afterc) before and afterd) not at all

the object of PERFORM is executed.

12. The association between a file-name and physical device on which the file reside is established by the select statement which should appear in :

(a) FILE section. ENVIRONMENT division.(b) FILE-CONTROL paragraph, INPUT-OUTPUT section, ENVIRONMENT, division.(c) CONFIGURATION section, ENVIRONMENT division.(d) FILE section, DATA division.

13. The BLANK WHEN ZERO clause can be applied to a)Numeric edited itemsb)Alphanumeric edited items

Page 11 of 40

COBOL/COBOL II Questionnaire

c) Both of the above

d) is not a valid clause in COBOL - 85.

14. One of the following correctly describe the concepts of ‘statement’ and ‘sentence’ in COBOL:

(a) A COBOL sentence is a sequence of COBOL sentences, the last of which is terminated by a period.(b) A COBOL sentence is a sequence of COBOL statements, the last of which is terminated by a period.(c) There is no concept of ‘sentence’ in COBOL. English sentences can,

however, appear in comment lines.(d) The concept of ‘sentence’ and ‘statement’ are identical in COBOL.

15. Use of the EXTEND option with the OPEN verb causes thefile to be positioned

a) at the first recordb) at the last recordc) after the last recordd) before the last record

16. The Procedure Division entry for the called program includes a ______ clause.

a) GIVINGb) USINGc) VALUEd) PIC

The following table gives the PICTURE declarations of the values assumed (immediately preceeding the arithmetic statement given in each question ) by four data names DATA1, DATA2, DATA3 and DATA4.

Data Name PICTURE Value immediately prior to the execution of the statement.in bytes numerical value

DATA1 999 024 24

DATA2 999V9 0199 19.9

DATA3 99V99 0018 0.18

DATA4 999V9 012.0 12

Answer the following four questions with reference to the above table :

17. The statement ADD DATA1 DATA2 TO 23

results in

a) values of 47 and 42.9 for DATA1 and DATA2 respectively.b) values of 22 and 11.2 for DATA1 and DATA2 respectively.c) all the data-names retain their values.d) a syntax error.

18. The statement

Page 12 of 40

COBOL/COBOL II Questionnaire

SUBTRACT DATA3 0.79 FROM 100.0 GIVING DATA2 ROUNDEDresults in

a) values of 0.18 and 99.1 for DATA3 and DATA2 respectively.b) values of 0.18 and 99.0 for DATA3 and DATA2 respectively.c) values of 99.03 and 99.0 for DATA3 and DATA 2 respectively.d) a syntax error.

19. The statement MULTIPLY DATA2 by 10.0 GIVING DATA3 ROUNDED

ON SIZE ERROR NEXT SENTENCEresults in

a) values of 19.9 and 199.0 for DATA2 and DATA3 respectively.b) values of 19.9 and 99.0 for DATA2 and DATA3 respectively.c) all the data-names retaining their valuesd) a syntax error.

20. The statement DIVIDE DATA4 INTO DATA1

ON SIZE ERROR MOVE 0 TO DATA1.results in

a) values of 2 and 12.0 in DATA1 and DATA4 respectively.b) values of 0 and 12.0 in DATA1 and DATA4 respectively.c) all the data-names retaining their valuesd) a syntax error.

21. Data-names BAL1, BAL2, BAL3 and BAL4 have the following definitions in the WORKING-STORAGE section.

01 BAL1 PIC 9-01 BAL2 PIC 9+01 BAL3 PIC 9CR01 BAL4 PIC ZZZ

the statement

MOVE -5 TO BAL1, BAL2, BAL3, BAL4.

will produce the following bytes in BAL1, BAL2, BAL3 and BAL4 respectively :

(b stands for space)

a) 5b 5- 5CR 5bbb) 5- 5- 5bb 005c) 5- 5- 5CR bb5d) 5- 5b 5bb 500

22. Data names A,B and C assume values 2, 3 and 4 respectively , at some stage in the computation, when the following PROCEDURE DIVISION statement is executed. What is the resulting value of D ?

IF (A > B) OR (B < C)COMPUTE D = A + B * C

ELSE COMPUTE D = A * B + C .

a) 14

Page 13 of 40

COBOL/COBOL II Questionnaire

b) 20c) 10d) none of the above.

23. IF CHAR-1 < CHAR-2 WRITE LINE-1

ELSEWRITE LINE-2

If before executing this statement, CHAR-1 contains alphanumeric literal ‘1’ and CHAR-2 contains alphanumeric literl ‘A’ then ...

a) LINE-1 is always written.b) LINE-2 is always written.c) Action depends on the computer system on which the program is run.d) compiler error results.

24. IF PAY-CODE = ‘A’IF PAY-BASIC < 500 MOVE 0 TO PAY-DEDUCT

ELSE IF PAY-BASIC < 1000 MOVE 120 TO PAY-DEDUCTELSE MOVE 150 TO PAY-DEDUCTELSE MOVE 80 TO PAY-DEDUCT.COMPUTE PAY-DEDUCT = PAY-DEDUCT * 0.9.

If this program segment is entered with PAY-CODE = ‘B’,PAY-BASIC = 900 AND PAY-DEDUCT = 90

the resulting value of PAY-DEDUCT will be ...

a) 0b) 72c) 108d) 135

25. What is the correct interpretation of the statement

PERFORM B010-PROCESS-PARA UNTIL STATUS = 1.

a) Do the paragraph B010-PROCESS-PARA once if STATUS has a value of 1.

b) Keep repeating paragraph B010-PROCESS-PARA as long as STATUS has a value 1.c) Keep repeating paragraph B010-PROCESS-PARA as long as STATUS has a value other than 1.d) Do the paragraph B010-PROCESS-PARA once if STATUS has a value other than 1.

26. The statement

PERFORM B010-CALC-PARA VARYING I FROM 1 BY 1 UNTIL I = 5

causes this paragraph to be entered .

a) in a continous loop, at least until I overflowsb) thricec) four times

d) none of the above

Page 14 of 40

COBOL/COBOL II Questionnaire

27. In the choices below, a level number is followed by a COBOL clause is expected to go with the data descrtption at that level. Which of them is an incorrect pair?(a) 01PICTURE(b) 10REDEFINES(c) 20RENAMES(d) 88VALUES

28. The function of the SYNCHRONIZED clause is to ensure that:(a) The data-name begins or/and ends at a word boundary for word oriented computers.(b) The record begins or/and ends at a word boundary for word oriented computers.(c) The record always stays at a disk sector (disk segment) boundary for disk files.(d) The data-name assumes binary and not DISPLAYnumber representation.

29. The data-name LINE-1 has following FILE section entry:05 LINE-1 PIC X(25)The effect fo the statement ...MOVE SPACE TO LINE-1would be to :

(a) Move spaces to all the bytes of LINE-1.(b) Move a single space to the first byte of LINE-1 leaving the others unchanged.(c) Move a single space to the last byte of LINE-1 leaving the others unchanged.(d) Nove of the above.

30. Indicate which one of the following is not a valid form of PERFORM statement.(a) PERFORM P1 THREE TIMES.(b) PERFORM P1 VARYING I FROM 1 BY 1 UNTIL I > 3.(c) PERFORM P1 UNTIL MORETHAN3.(d) PERFORM P1 THRICE.(e) PERFORM P1 UNTIL THREE > 3.

31. The following statement is used in a COBOL program:PERFORM UPDATE-INPUT UNTIL DONE.(a) DONE is a data-name whose value gets decremented at each entry of the paragraph.(b) DONE is a data-name whose value gets decremented at each exit of the paragraph.(c) DONE is a data-name whose value gets defined in an exception heading section.(d) DONE is a condition name.

32. Which one of the following is NOTcorrect?(a) ADD A, B GIVING C, D.(b) ADD CORRESPONDING A TO C.(c) ADD A TO B GIVING C.(d) ADD A TO B, C TO D.

33. Which of the following is incorrect?(a) MULTIPLY A BY B GIVING C.(b) MULTIPLY A INTO B.(c) DIVIDE A BY B GIVING C.(d) DIVIDE A INTO B.

34. Which one of the following if NOT a PROCEDURE DIVISION verb?(a) ADD

Page 15 of 40

COBOL/COBOL II Questionnaire

(b) SUBTRACT(c) INSERT(d) DELETE

35. Which of the following PICTURE clauses is invalid as a floating symbol?(a) -(b) $(c) S(d) +

36. In COBOL-85, the minimal set of clauses that are necessary to set up and initialise a table of integer values to all zeros in the WORKING-STORAGE section consists of

a) VALUEb) VALUE, OCCURSc) VALUE, OCCURS, REDEFINESd) VALUE, OCCURS, REDEFINES, INDEXED BY

37. Assuming a 32-bit word , how many words does the following occupy.

01 BILLS.05 INDIVIDUAL-BILL occurs 10 times.10 BILL-NO PIC 9(5)V99 SYNC.

10 BILL-AMOUNT PIC 9(3) SYNC.

a) 1 word.b) 2 words.c) 3 words.d) 4 words

38. Study the following WORKING_STORGAGE SECTION entries:

01 TABLE-ENTRY OCCURS 100 TIMES INDEXED BY ITAB.10 TAG-NO PIC 99.10 TAG-NAME PIC X(20).

01 TAG-DATA PIC 99.

Which of the four choices can be considered as the best description of the SEARCH statement.

SEARCH TABLE-ENTRYAT END PERFORM PRINT-TAG-ERROR

WHEN TAG-DATA = TAG-NO(ITAB)PERFORM PROCESS-TAG.

a) There is a syntax error in the SEARCH statement.b) Statement is syntactically correct but may fail to do the search

correctly if ITAG is not initailised before the SEARCH statement.c) There is a syntax error in the table definition.d) Statement is syntactically correct; the index value gets automatically

initialised.

39. A table GRADE-TABLE has the following record description in a COBOL program.

01 GRADE-TABLE.05 GRADE OCCURS 5 TIMES.

10 CLASS-TYPE OCCURS 9 TIMES.

Page 16 of 40

COBOL/COBOL II Questionnaire

15 YEAR OCCURS 9 TIMES.

It is desired to pick up the first grade in the 9th class-type in the 7th year. Which of the following will give the correct field ?

a) GRADE(7,9,1)b) YEAR (1,9,7)c) GRADE(1,9,7)d) YEAR (7,9,1)

40. A MOVE CORRESPONDING is not usually used because :

a) it is a very time-consuming way of moving data.b) it uses more memory compared to moving each field using

MOVE instead of MOVE CORR .c) A MOVE CORR may produce unintended results if data names

are altered during program modification.d) none of the above.

41. A data-name HRD-WORD meant for holding the text for a report header is specified in the WORKIN-STORAGE SECTION as :

HRD-WORD PIC X(30)VALUE “---------REPORT LIST---------”.

The value of HRD-WORD is changed at execution time by the statements .

INSPECT HRD-WORD REPLACING LEADING “-” BY “*”.INSPECT HRD-WORDTALLYING COUNT-1 FOR ALL “-” BEFORE INITIAL “ “COUNT-2 FOR ALL “-” AFTER “ “.

After the two INSPECT statements are executed in the given order the data-names COUNT-1 and COUNT-2 will assume values

a) 9 and 9 respectively.b) 0 and 9 respectively.c) 0 and 0 respectively.d) 9 and 0 respectively.

42. A COBOL program contains the WORKING-STORAGE SECTION declaration

01 A-1.05 B1 OCCURS 10 TIMES.

10 C OCCURS 5 TIMES PIC X.05 D PIC 99.

01 A-2.05 B2 OCCURS 10 TIMES.

10 C OCCURS 5 TIMES PIC X.05 D PIC 99.

43. Which of the following statement is INCORRECT .

a) MOVE SPACES TO B2(5).b) MOVE SPACE TO C OF B1 OF A-1(1,1).c) MOVE SPACE TO C(1,1) OF B1 OF A-1.d) MOVE SPACE TO B2(D OF A-1).

44. Which of the following is not necessarily true .

Page 17 of 40

COBOL/COBOL II Questionnaire

a) Structured programming improves the maintainability of a program.

b) Structured programming is possible in COBOL.c) Structured programming reduces the execution timings.d) Structured programming enables a programmer to concentrate

on one function at one time.

45. IN-QNT is a formal parameter in a subprogram. Which one of the following is NOT true about IN-QNT ?

a) IN-QNTshould appear in the PROCEDURE DIVISION header of the subprogram.

b) The actual parameter in the CALL statement corresponding to the IN-QNT should have the same name .

c) IN_QNT should appear in the LINKAGE SECTION of the subprogram.d) none of the above.e)

46. The COBOL verb that is not directly concerned with an index name is ...

(a) SET(b) SEARCH(c) PERFORM(d) SORT

47. The PROCEDURE DIVISION of a program contains the statementWRITE MASTER-RECThis clearly suggests that the OPEN statement for this file must NOT be(a) OPEN I-O(b) OPEN INPUT(c)OPEN OUTPUT(d) OPEN EXTEND

48. The PROCEDURE DIVISION OF a program contains the statement ...START MASTER-FILE KEY IS > REC-KEY.This clearly suggests that the SELECT clause specification for MASTER-FILE must be(a) ORGANIZATION IS INDEXED with ACCESS MODE RANDOM.(b) ORGANIZATION IS INDEXED with ACCESS MODE DYNAMIC. (c) SEQUENTIAL with ACCESS MODE SEQUENTIAL(d) SEQUENTIAL with ACCESS MODE RANDOM.

49. Which of the following is true about the file which is referenced in a DELETE statement?(a) It must be opened in INPUT mode.(b) It must be opened in OUTPUT mode.(c) It must be in I-O mode.(d) File Access mode must be RANDOM.

True or False

50. The END-PERFORM is present in the COBOL-74 standard.

51. In the COBOL-85 standard, the END-IF must always be used to terminate an IF statement.

52. SEARCH ALL denotes a binary search.

53. An index can be manipulated by a MOVE statement

54. The ASCENDING or DESCENDING KEY clause is required whenever the SEARCH ALL is

Page 18 of 40

COBOL/COBOL II Questionnaire

applied to a table.

55. A SEARCH statement automatically initializes the index to 1 in the case of a sequential search.

56. The statement CLOSE INPUT BIO-DATA-FILE is valid.

57. WRITE EMP-DATA-RECORD AT END MOVE 1 TO CODE.The above is not valid in COBOL.

58. KOUNT PIC 9.FIRST-NAME PIC X(10)

VALUE 'EDS'.

MOVE 1 TO KOUNT.STRING FIRST-NAME DELIMITED BY SPACES

INTO NAME-OUT WITH POINTER KOUNT.

After the STRING operation the value of KOUNT is 7

59. If the OUTPUT PROCEDURE is specified with the SORT verb, then the INPUT PROCEDURE is required

60. The order of the parameters passed to the program is determined by the order of their declaration in the LINKAGE SECTION.

61. The ALTERNATE KEY associated with a record must be a unique key value in the file.

62. Relative files can be opened in EXTEND mode.

63. The instructions

MOVE 08 TO EMP-NO START FILE1

KEY IS > EMP-NOINVALID KEY DISPLAY "ERR".

will read a record into storage with a key greater than 8.

64. If you code a USE AFTER ERROR PROCEDURE ON filename statement, you need not use an INVALID KEY with the READ or WRITE statement to dislay error messages.

65. COBOL takes care of collision resolution in case of relative files.

66. With the MERGE statement, pre-processing is done with the help of INPUT PROCEDURE and post-processing is taken care of by the OUTPUT PROCEDURE.

67. Records stored randomly in a relative file can be accessed sequentially.

68. A table described by a DEPENDING ON CLAUSE is allocated space dynamically on execution.

69. If we require that the instructions in a loop are to be executed at least once before testing the condition COBOL provides the TEST AFTER option with the PERFORM ... UNTIL.

Page 19 of 40

COBOL/COBOL II Questionnaire

70. The sign is not normally allocated a separate storage unit.

71. Indexed files have lower access times as compared to relative files.

72. For a relative file, the RELATIVE KEY is part of the data record.

73. SYNC results in compact storage of data items with no wastage between the data items

74. COMP increases the speed of computation as compared to DISPLAY.

75. REDEFINES clause allocates another storage area for the item being redefined.

76. A RELATIVE KEY is optional when reading from or writing to a realtive file sequentially

77. The FILE STATUS clause can be used with the SELECT statement to determine the specific type of error that occured when reading or writing to a file

The next three questions pertain to the following :

The content of a data item stored with a picture clause of 9(7)v99 is 1234567.89. What will be the resulting numbers printed in each of the following cases:

78. 9(6)v99

79. *(8).**

80. $(5).$$

Page 20 of 40

COBOL/COBOL II Questionnaire

ADVANCED JCL FEATURES

ADVANCED JCL FEATURES

• PARMS, Referbacks and Concatenations

• Using the OUTPUT statement

• Coding the COND parameter

PARMs, Referbacks and Concatenations

• Coding PARM parameter

• Concatenating data sets

• Coding Referbacks within a Job Step

• Coding Referbacks to other Job Steps or Procedures

PARM PARAMETER

• Function of PARM parameter

• Coding PARM parameter

Function of PARM parameter

• Passes small amount of info from JCL to Program

• May contain info that may change each time when program executes

• Example : In monthly reports, we can pass the month in the heading of a report.

Coding PARM parameter

• Keyword parameter

• Code PARM in EXEC statement

Page 21 of 40

COBOL/COBOL II Questionnaire

• //step1 EXEC ……., PARM=value

• //step1 EXEC …, PARM=(val1, ‘val+2’)

• //step1 EXEC …, PARM=‘val1, val2’

Coding PARM parameter

• value must not exceed 100 characters

• ( ) ‘ ‘ are not included in 100

• , is included

• Special char should be enclosed in quotes.

• E.g. ‘REP.NO’ ‘VAL+UE’

Concatenating data sets

• Function of data set concatenation

• Coding concatenated data sets

FUNCTION

• Naming two or more data sets in a single input file without physically combining the data sets

• Data sets may reside on different devices and also on different device types

CODING

//DD1 DD DSN=A,DISP=SHR

Page 22 of 40

COBOL/COBOL II Questionnaire

// DD DSN=B,DISP=SHR

• The order of DD statements determines the order in which the program accesses the data sets

• If the record length of the first DD statement is not MAX then an abend will occur. To avoid this either

• Code the DCB parameter with largest block size in first DD statement if the first data set is not the one with largest block size or LRECL.

// DD2 DD DSN=A,DISP=SHR,

// DCB=LRECL=131

// DD DSN=B,DISP=OLD

OR

Page 23 of 40

COBOL/COBOL II Questionnaire

//DD2 DD DSN=A,DISP=SHR,

// DCB=BLKSIZE=23200

// DD DSN=B,DISP=OLD

// DD DSN=C,DISP=OLD

BACKWARD REFERENCE

• Function and position of referback

• Coding DCB, DSN, and VOLUME referbacks

• Referbacks will improve consistency

• Referbacks make coding easier.

BACKWARD REFERENCE

• Lets you copy previously coded info by referring back to an earlier statement

• Can reference the statement in

- the same step

- previous step in the same job

- an in-stream PROC

- a cataloged PROC

• Can be in DCB, DSN, VOL parameters

CODING DCB

// JOB Statement.…….

//STEP1 EXEC ……

Page 24 of 40

COBOL/COBOL II Questionnaire

//INPF DD DSN=TEST.INFILE,DISP=OLD

//INTF DD DSN=TEST.INTFILE,

// DISP=(,CATLG),DCB=BLKSIZE=8000

……

//OUTF DD DSN=TEST.OUTF,

// DISP=(,CATLG,DELETE),

// DCB=*.INTF

Page 25 of 40

COBOL/COBOL II Questionnaire

CODING DSN

• Same procedure for DSN

CODING VOL using dd name

//DD1 DD DSN=NAME1,

// VOL=SER=VOL1

//DD2 DD DSN=NAME2,

// VOL=REF=*.DD1

CODING VOL using dsname

• Can also reference by data set name with only CATLG, PASS data sets option in DISP

• VOL=REF=dsname

• VOL=REF=NAME1

• When using generation data sets, this cannot be used.

REFERBACKS IN THE SAME JOB STEP

• When referring to DD name in same job step code

• DCB=*.ddname

• DSN=*.ddname

• VOL=REF=*ddname

• VOL=REF=dsname

REFERBACKS TO OTHER JOB STEPS

Page 26 of 40

COBOL/COBOL II Questionnaire

• DCB=*.stepname.ddname

• DSN=*.stepname.ddname

//Step1 EXEC PGM=pgm1

//infile1 DD DSN=name1,DISP=shr,

//Step2 EXEC PGM=pgm2

//outfile2 DD DSN=name2,DISP=(new,catlg),

// DCB=*.Step1.infile1

REFERBACKS TO PROCEDURES

• When referring procedures (in-stream/catalog)

• DCB=*.stepname.procstepname.ddname

• DSN=*.stepname.procstepname.ddname

OUTPUT STATEMENT

• Referencing the OUTPUT statement

• Coding the COPIES ,OUTLIM and CLASS parameters

• Coding the DEST, FORMS and GROUPID parameters

• Coding implicit and explicit references

ADVANTAGES OF OUTPUT

• Combine common output characteristics

Page 27 of 40

COBOL/COBOL II Questionnaire

• Create multiple printouts with different output characteristics

• Combine several SYSOUT DDs into groups

COPIES PARAMETER

// OUTPUT COPIES=nnn

• nnn is from 1 to 254

• Default value is 1

CLASS PARAMETER

Certain attributes are defined at system startup. Few are:

• How to process report

• Report line is 80 or 132 character

• NO of lines per page

• What time the report should print etc

• E.g : A=line print, 132 char, B=card punch

//OUT2 OUTPUT CLASS=n

where n =A to Z or 0 to 9.

• CLASS=* requests output from MSGCLASS in JOB statement.

• CLASS on SYSOUT DD overrides CLASS on OUTPUT statement.

• To nullify CLASS parameter in SYSOUT DD

• //DD2 DD SYSOUT=(,), OUTPUT=*.OUT2

OUTLIM Parameter

• The outlim parameter limits the no of print lines.

Page 28 of 40

COBOL/COBOL II Questionnaire

• The limit range range from 1 to 16777215 lines. The job is terminated if the limit is exceeded.

• //name DD SYSOUT=A,OUTLIM=3000

DEST PARAMETER

• Routes the data set to a destination, device or location

//REMT2 OUTPUT DEST=type

• type is 2 to eight alphanumeric or national character

• If not coded default is taken.

FORMS PARAMETER

• Specifies the type of forms on which the sysout data set is to be printed or punched.

• //PRT2 OUTPUT FORMS=form name

• Form name is2 to eight alphanumeric or national character

• SYSOUT DD FORMS parameter overrides OUTPUT FORMS parameter.

• SYSOUT DD FORMS is only 4 character

Combine common output characteristics (contd)

//JOBNAME JOB ….

/OUTRPT OUTPUT DEST=HQS,COPIES=3,FORMS=PQ

//STEP1 EXEC PGM=A

//NAME1 OUTPUT DEST=LP

//DD1 DD SYSOUT=A,OUTPUT=*.OUTPRT

//STEP2 EXEC PGM=B

//DD2 DD SYSOUT=A,OUTPUT=*. OUTPRT

Page 29 of 40

COBOL/COBOL II Questionnaire

//STEP3 EXEC PGM=C

//DD3 DD SYSOUT=A,OUTPUT=*.OUTPRT

Combine common output characteristics

//JOBNAME JOB ….

//STEP1 EXEC PGM=A

//DD1 DD SYSOUT=A,DEST=LP

//STEP2 EXEC PGM=B

//DD2 DD SYSOUT=A,DEST=LP

//STEP3 EXEC PGM=C

//DD3 DD SYSOUT=A,DEST=LP

//JOBNAME JOB ….

//NAME 1 OUTPUT DEST=LP

//STEP1 EXEC PGM=A

//DD1 DD

SYSSOUT=A,OUTPUT=*.NAME1

//STEP2 EXEC PGM=B

//DD2 DD SYSOUT=A,OUTPUT=*.NAME1

//STEP3 EXEC PGM=C

//DD3 DD

SYSOUT=A,OUTPUT=*.NAME1

CREATE MULTIPLE PRINTOUTS WITH DIFFERENT OUTPUT CHARACTERISTICS

//JOBNAME JOB ….

/OUT1 OUTPUT DEST=HQS,COPIES=3,FORMS=STDPRT

//OUT2 OUTPUT DEST=BRNOFE,COPIES=3,FORMS=UPDATE

//STEP2 EXEC PGM=A

//DD2 DD SYSOUT=C,OUTPUT=(*.OUT1,*.OUT2)

Page 30 of 40

COBOL/COBOL II Questionnaire

CODING EXPLICIT AND IMPLICIT REFERENCES

EXPLICIT REFERENCES

//OUT2 OUTPUT CLASS=H

…….

//DD2 DD SYSOUT=(,), OUTPUT=*.OUT2

IMPLICIT REFERENCES

• Code DEFAULT=YES

• JOB or STREP has a default output JCL statement

//OUT2 OUTPUT DEFAULT=YES

…….

//REP2 DD SYSOUT=A

CODING EXPLICIT AND IMPLICIT REFERENCES

//JNAME JOB , MSGCLASS=A

//WKOUT OUTPUT DEFAULT=YES, DEST=HQS,FORMS=PQ

//OUTA OUTPUT DEST=LOCAL,FORMS=STD

//STEP2 EXEC PGM=OUTWRTE

//RPT1 DD SYSOUT=A

//RPT2 DD SYSOUT=A

//STEP2 EXEC PGM=INWRTE

//RPT3 DD SYSOUT=B,OUTPUT=*.OUTA

//RPT4 DD SYSOUT=B

……..

Page 31 of 40

COBOL/COBOL II Questionnaire

* STEP LEVEL DEFAULT=Y OVERRIDES JOB LEVEL

GROUPID PARAMETER

• Combines SYSOUT data sets into an output group.

• Data sets are processed together at the same time and location.

• Supported only for JES2 systems.

• Data sets grouped together should have same CLASS & DEST parameters

GROUPID PARAMETER

//OUT2 OUTPUT GROUPID=name

• 2 to eight alphanumeric or national character

GROUPID Parameter

• //job statement

//name OUTPUT GROUPID=gp1,

// Default=yes,DEST=HQS //step EXEC PGM=pgm1

//REP1 DD SYSOUT=B

//REP2 DD SYSOUT=B

COMBINE SEVERAL SYSOUT DDS INTO GROUPS

//JOBNAME JOB , MSGCLASS=A

//WKOUT OUTPUT GROUPID=GRP2,

// COPIES=3,FORMS=PQ

//STEP1 EXEC PGM=OUTWRITE

//OUTA OUTPUT DEST=LOCAL,FORMS=STD

//DD1 DD SYSOUT=A,OUTPUT=(*.OUTA,*.WKOUT)

Page 32 of 40

COBOL/COBOL II Questionnaire

//STEP2 EXEC PGM=INWRITE

//OUTB OUTPUT DEST=LOCAL,FORMS=222

//DD2 DD SYSOUT=A,OUTPUT=(*. OUTB,*.WKOUT)

//DD3 DD SYSOUT=A

COND PARAMETER

Definition

Condition (COND) is a keyword parameter that tests a return code against a test code.

• The result of this test determines if a job or step will be executed or bypassed.

• Format COND=(tcode,oper)

• tcode=test code, oper = operator

COND PARAMETER

• If condition is true the step is bypassed.

• Can be coded on JOB or EXEC statements

• If condition in JOB is true the job ends after executing the first step.

• COND on JOB takes precedence over any EXEC.

• JOB may have only test code and operator.

COND PARAMETER

Test code (tcode)

• tcode is numeric and ranges from 0 to 4095.

Page 33 of 40

COBOL/COBOL II Questionnaire

• Can be system generated numbers or set by programmer. Also called condition code.

• After execution the value is moved to a special register- RETURN-CODE and can be checked for conditions.

• 0=No errors, 4=minor errors, 8/12/16=more serious

COND PARAMETER

Operator (oper)

• GT, GE, EQ, NE, LT, LE.

• Can code up to 8 tests on one statement.

COND PARAMETER

For previously executed step within a JOB

COND=(tcode,oper,stepname).

• Return code is drawn from the name of the step.

• If step name is not specified, return code from all previous steps will be tested.

COND PARAMETER

Previously executed step within a JOB

COND=(tcode,oper,stepname).

Example :

//JOB2 JOB ……

//STEP1 EXEC ……

Page 34 of 40

COBOL/COBOL II Questionnaire

//STEP2…..

//STEP3 EXEC PGM=ABC,COND=(4,GT,STEP1)

COND PARAMETER

• A previously executed in-stream or cataloged procedure

COND=(tcode,oper,stepname.procstepname)

COND PARAMETER

COND=(tcode,oper,stepname.procstepname)

Example :

//PROC2 PROC

//HRCAL EXEC …..

//STEP2 EXEC PROC2

……

//STEP5 EXEC PGM=A,COND=(0,GT,STEP2.HRCAL)

COND PARAMETER

Compound Conditions

• Can test for a range of values or multiple steps.

• Not for testing multiple conditions on one job step.

• Maximum of eight conditions can be coded.

COND=((4,GT),(8,LT))

COND=((0,NE,STEP03),(0,NE,STP04))

COND PARAMETER - EVEN and ONLY

Page 35 of 40

COBOL/COBOL II Questionnaire

• Unlike JOB , EXEC can have several subparameters

• EVEN and ONLY are used only in the case of abend.

• Can be included along with condition code test or can be coded alone.

• COND=((tcode,oper),EVEN/ONLY)

• COND=EVEN/ONLY (Executes job step even if a program ABENDs/only if an ABEND occurs)

Additional features in MVS 4.0 version

• If /Then/Else conditional JCL

• INCLUDING jcl from a PDS

• SEGMENT, SPIN & CLOSE keyword parameters on DD statement

• Enhancement in TIME PARAMETER

• New keywords on JOB statement (BYTES, CARDS, LINES, PAGES)

USING IF / THEN/ ELSE

• This statement is used in JCL for conditions instead of COND parameter.

• //Name IF ( condition or text) THEN

// jcl statements to be executed if the condition met

//Name ELSE

// jcl statements to be executed if the condition is not met

//Name ENDIF.

USING IF / THEN/ ELSE

// IF RC = 4 THEN

//STEP1 EXEC statement

Page 36 of 40

COBOL/COBOL II Questionnaire

// ELSE

// STEP2 EXEC statement

// ENDIF

*All mnemonic & character operators are allowed

USING IF / THEN/ ELSE

• // IF ((RC GE 1) or (RC LT 4)) THEN

//STEP1 EXEC PGM=pgm1

// ELSE

//STEP2 EXEC PGM=pgm2

// ENDIF

• // IF (STEP1.RC = 8) THEN

//STEP3 EXEC PGM=pgm3

// ENDIF

USING IF / THEN/ ELSE

// IF (STEP1.ABEND = TRUE) THEN

//STEP2 EXEC PGM=error

// ELSE

//STEP3 EXEC PGM=pgm3

// ENDIF

• RUN, NOT RUN, ABENDCC etc can be used

INCLUDE IN JCL

Page 37 of 40

COBOL/COBOL II Questionnaire

• We can include JCL’s from other than procedure libraries through INCLUDE statement

• //name JCLLIB ORDER=(PDS1,PDS2)

• // INCLUDE MEMBER=JCL member

• Only one JCLLIB name is allowed in a job

SEGMENT ON DD statement

• This allows a portion of a dataset to be printed even though the job is still running & generating output

• // DD SYSOUT=X,SEGMENT=Value

where value is no of pages in a segment

SPIN on DD statement

• This allows an output dataset to be printed at the end of a step or at the end of a job

• // DD SYSOUT=X,SPIN=Value

value = UNALLOC or NO

• UNALLOC - the dataset to be printed once that is unallocated

• NO - the dataset is not printed until the end of the job even it is closed

Page 38 of 40

COBOL/COBOL II Questionnaire

FREE Parameter on DD statement

• This deallocates a dataset when it is closed rather than at the end of a job step

• // DD SYSOUT=X, FREE=CLOSE

Advantages of FREE Parameter

• A dataset is freed for other program usage as soon as a program has finished using it

• Tape drives are freed for other programs use

• Sysout data can be released for printing before a job has finished

TIME Parameter

//job card ,TIME=Value

Value - LIMIT (Min,Sec)

- NOLIMIT

- MAX (357912 minutes)

- 1440

Page 39 of 40

COBOL/COBOL II Questionnaire

NEW KEYWORDS ON JOB

• These are used to control the amount of sysout produced by the job

• BYTES

• CARDS

• LINES

• PAGES

• We can also specify an action if the limit exceeds this parameter value

NEW KEYWORDS ON JOB

//jobname JOB……,LINES=(100,ACTION)

CANCEL cancel job without dump

DUMP cancel job with dump

WARNING continue job but send warning messages to the operator

Page 40 of 40