Sreejobs Logo
   For Latest Job Updates  
sreenutech.com Online Exams
Home Govt Jobs IT Fresher Jobs IT Exp Jobs IT Walk-Ins MBA Jobs BPO Jobs Register FAQ’s Post Job Contact Us
Hot Jobs
COBOL

Q1)  Name the divisions in a COBOL program ?.
A1)  IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION.

Q2)  What are the different data types available in COBOL?
A2)  Alpha-numeric (X), alphabetic (A) and numeric (9).

Q3)  What does the INITIALIZE verb do?  - GS
A3)  Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES. Numeric, Numeric edited items set to ZERO. FILLER , OCCURS DEPENDING ON items left untouched.

Q4)  What is 77 level used for ?
A4)  Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

Q5)  What is 88 level used for ?
A5)  For condition names.

Q6)  What is level 66 used for ?
A6)  For RENAMES clause.

Q7)  What does the IS NUMERIC clause establish ?
A7)  IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed decimal  items. IS NUMERIC returns TRUE if the item only consists of 0-9. However, if the item being tested is a signed  item, then it may contain 0-9,  + and - .

 

Q31)    What do you do to resolve SOC-7 error? - GS
A31)      Basically you need to correcting the offending data. Many times the reason for SOC7 is an un-initialized numeric item.
Examine that possibility first. Many installations provide you a dump for run time abend’s ( it can be generated also
by calling some subroutines or OS services thru  assembly language).  These dumps provide the offset of the last 
instruction at which the abend occurred.  Examine the compilation output XREF listing to get the verb and the line
number of the source  code at this offset.  Then you can look at the source code to find the  bug.  To get capture the
runtime dumps,  you will have to define some  datasets (SYSABOUT etc ) in the JCL. If none of these are helpful,  use
judgement and DISPLAY to localize  the source of error. Some installation might have batch program debugging
tools.  Use them.

Q32)    How is sign stored in Packed Decimal fields and Zoned Decimal fields?
A32)      Packed Decimal fields:             Sign is stored as a hex value in the last nibble (4 bits ) of the storage.
Zoned Decimal fields:              As a default, sign is over punched with the numeric value stored in the last bite.

Q33)    How is sign stored in a comp-3 field? - GS
A33)      It is stored in the last nibble. For example if your number is +100, it stores hex 0C in the last byte, hex 1C if 
your number is 101, hex 2C if your number is 102, hex 1D if the number is -101, hex 2D if the number is –102 etc...              

Q34)    How is sign stored in a COMP field ? - GS
A34)      In the most significant bit.  Bit is ON if -ve, OFF if +ve.

Q35)    What is the difference between COMP & COMP-3  ?
A35)      COMP is a binary storage format while COMP-3 is packed decimal format.

Q36)    What is COMP-1? COMP-2?
A36)      COMP-1  - Single precision floating point. Uses 4 bytes.
COMP-2 - Double precision floating point. Uses 8 bytes.

Q37)    How do you define a variable of COMP-1?  COMP-2?
A37)      No picture clause to be given. Example 01 WS-VAR USAGE COMP-1.

Q38)    How many bytes does a S9(7) COMP-3 field occupy ?
A38)      Will take 4 bytes. Sign is stored as hex value in the last nibble. General formula is INT((n/2) + 1)), where n=7 in this
example.

Q39)    How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy ?
A39)      Will occupy 8 bytes (one extra byte for sign).

Q40)    How many bytes will a S9(8) COMP field occupy ?
A40)      4 bytes.

Q41)    What is the maximum value that can be stored in S9(8) COMP?
A41)      99999999

Q42)    What is COMP SYNC?
A42)      Causes the item to be aligned on natural boundaries. Can be SYNCHRONIZED LEFT or RIGHT. For binary data
items, the address resolution is faster if they are located at word boundaries in the memory.  For example, on main
frame the memory word size is 4 bytes.  This means that each word will start from an address divisible by 4.  If my
first variable is x(3) and next one is s9(4) comp, then if you do not specify the SYNC clause, S9(4) COMP will start
from byte 3 ( assuming that it starts from 0 ).  If you specify SYNC, then the binary data item will start from address 4.
You might see some wastage of memory, but the access to this computational field is faster.                                                                                                                                                                  

Q43)    What is the maximum size of a 01 level item in COBOL I?  in COBOL II?
A43)      In COBOL II: 16777215

Q44)    How do you reference the following file formats from COBOL programs:
A44)       
Fixed Block File  -                     Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F,
BLOCK CONTAINS 0 .
Fixed Unblocked  -  Use ORGANISATION IS SEQUENTIAL. Use RECORDING   MODE IS F,
do not use BLOCK CONTAINS
Variable Block File -                 Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS V, BLOCK
CONTAINS 0. Do not code the 4 bytes for record length in FD ie JCL rec length will be max rec length in pgm + 4
Variable Unblocked -               Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS V, do not use
BLOCK CONTAINS. Do not code 4 bytes for record length in FD ie JCL reclength will
be max rec length in pgm + 4.
ESDS VSAM file -                    Use ORGANISATION IS SEQUENTIAL.
KSDS VSAM file -   Use ORGANISATION IS INDEXED, RECORD KEY IS, ALTERNATE RECORD KEY IS RRDS File - Use ORGANISATION IS RELATIVE, RELATIVE KEY IS
Printer File -                               Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, BLOCK
CONTAINS 0. (Use RECFM=FBA in JCL DCB).

Q45)    What are different file OPEN modes available in COBOL?
A45)      Open for INPUT, OUTPUT, I-O, EXTEND.

Q46)    What is the mode in which you will OPEN a file for writing? - GS
A46)      OUTPUT, EXTEND

Q47)    In the JCL, how do you define the files referred to in a subroutine ?
A47)      Supply the DD cards just as you would for files referred to in the main program.

Q48)    Can you REWRITE a record in an ESDS file?  Can you DELETE a record from it?
A48)      Can rewrite (record length must be same), but not delete.

Q49)    What is file status 92? - GS
A49)      Logic error. e.g., a file is opened for input and an attempt is made to write to it.

Q50)    What is file status 39 ?
A50)      Mismatch in LRECL or BLOCKSIZE or RECFM between your COBOL pgm & the JCL (or the dataset label). You
will get file status 39 on an OPEN.

Q51)    What is Static and Dynamic linking ?
A51)      In static linking, the called subroutine is link-edited into the calling program , while in dynamic linking, the subroutine
& the main program will exist as separate load modules. You choose static/dynamic linking by choosing either the
DYNAM or NODYNAM link edit option. (Even if you choose NODYNAM, a CALL identifier (as opposed to a
CALL literal), will translate to a DYNAMIC call).
A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL
or you do a CANCEL. A dynamically called routine will always be in its initial state.

Q52)    What is AMODE(24), AMODE(31), RMODE(24) and RMODE(ANY)?  (applicable to only MVS/ESA
Enterprise Server).
A52)      These are compile/link edit options. Basically AMODE  stands for Addressing mode and RMODE for Residency
mode.
AMODE(24) - 24 bit addressing;
AMODE(31) - 31 bit addressing
AMODE(ANY) - Either 24 bit or 31 bit addressing depending on RMODE.
RMODE(24) - Resides in virtual storage below 16 Meg line. Use this for 31 bit programs that call 24 bit programs.
(OS/VS Cobol pgms use 24 bit addresses only).
RMODE(ANY) - Can reside above or below 16 Meg line.

Q53)    What compiler option would you use for dynamic linking?
A53)      DYNAM.

Q54)    What is SSRANGE, NOSSRANGE ?
A54)      These are compiler options with respect to subscript out of range checking. NOSSRANGE is the default and if chosen,
no run time error will be flagged if your index or subscript goes out of the permissible range.

Q55)    How do you set a return code to the JCL from a COBOL program?
A55)      Move a value to RETURN-CODE register. RETURN-CODE should not be declared in your program.

Q56)    How can you submit a job from COBOL programs?
A56)      Write JCL cards to a dataset with //xxxxxxx SYSOUT= (A,INTRDR) where 'A' is output class, and dataset should be
opened for output in the program. Define a 80 byte record layout for the file.

Q57)    What are the differences between OS VS COBOL and VS COBOL II?
A57)      OS/VS Cobol pgms can only run in 24 bit addressing mode, VS Cobol II pgms can run either in 24 bit or 31 bit
addressing modes.

I.         Report writer is supported only in OS/VS Cobol.
II.       USAGE IS POINTER is supported only in VS COBOL II.
III.     Reference modification e.g.: WS-VAR(1:2) is supported only in VS COBOL II.
IV.     EVALUATE is supported only in VS COBOL II.
V.       Scope terminators are supported only in VS COBOL II.
VI.     OS/VS Cobol follows ANSI 74 stds while VS COBOL II follows ANSI 85 stds.
VII.   Under CICS Calls between VS COBOL II programs are supported.

Q58)    What are the steps you go through while creating a COBOL program executable?
A58)      DB2 precompiler (if embedded SQL used), CICS translator (if CICS pgm), Cobol compiler, Link editor. If DB2
program, create plan by binding the DBRMs.

Q59)    Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?
A59)      In non-CICS environment, it is possible. In CICS, this is not possible. 

Q60)    What are the differences between COBOL and COBOL II?
A60)     There are at least five differences: 
COBOL II supports structured programming by using in line Performs and explicit scope terminators, It introduces
new features (EVALUATE, SET. TO TRUE, CALL. BY CONTEXT, etc) It permits programs to be loaded and
addressed above the 16-megabyte line It does not support many old features (READY TRACE, REPORT-WRITER,
ISAM, Etc.), and It offers enhanced CICS support.

Q61)    What is an explicit scope terminator?
A61)     A scope terminator brackets its preceding verb, e.g. IF .. END-IF, so that all statements between the verb and its scope terminator are grouped together. Other common COBOL II verbs are READ, PERFORM,EVALUATE, SEARCH and STRING.

Q62)    What is an in line PERFORM?  When would you use it?  Anything else to say about it?

A62)     The PERFORM and END-PERFORM statements bracket all COBOL II statements between them. The COBOL equivalent is to PERFORM or PERFORM THRU a paragraph.  In line PERFORMs work as long as there are no internal GO TOs, not even to an exit.  The in line PERFORM for readability should not exceed a page length - often it will reference other PERFORM paragraphs.

Q63)    What is the difference between NEXT SENTENCE and CONTINUE?

A63)     NEXT SENTENCE gives control to the verb following the next period.  CONTINUE gives control to the next verb after the explicit scope terminator.  (This is not one of COBOL II's finer implementations).  It's safest to use CONTINUE rather than NEXT SENTENCE in COBOL II.

Q64)    What COBOL construct is the COBOL II EVALUATE meant to replace?

A64)     EVALUATE can be used in place of the nested IF THEN ELSE statements.

Q65)    What is the significance of 'above the line' and 'below the line'?

A65)     Before IBM introduced MVS/XA architecture in the 1980's a program's virtual storage was limited to 16 megs. Programs compiled with a 24 bit mode can only address 16 Mb of space, as though they were kept under an imaginary storage line. With COBOL II a program compiled with a 31 bit mode can be 'above the 16 Mb line. (This 'below the line', 'above the line' imagery confuses most mainframe programmers, who tend to be a literal minded group.)

Q66)    What was removed from COBOL in the COBOL II implementation?

A66)     Partial list:  REMARKS,  NOMINAL KEY, PAGE-COUNTER, CURRENT-DAY, TIME-OF-DAY,  STATE, FLOW, COUNT, EXAMINE, EXHIBIT, READY TRACE and RESET TRACE.

Q67)    Explain call by context by comparing it to other calls.
A67)     The parameters passed in a call by context are protected from modification by the called program. In a normal call they are able to be modified.

Q68)    What is the linkage section?

A68)     The linkage section is part of a called program that 'links' or maps to data items in the calling program's working storage.  It is the part of the called program where these share items are defined.

Q69)    What is the difference between a subscript and an index in a table definition?

A69)     A subscript is a working storage data definition item, typically a PIC (999) where a value must be moved to the subscript and then incremented or decrements by ADD TO and SUBTRACT FROM statements. An index is a register item that exists outside the program's working storage.  You SET an index to a value and SET it UP BY value and DOWN BY value.

Q70)    If you were passing a table via linkage, which is preferable - a subscript or an index?

A70)     Wake up - you haven't been paying attention!  It's not possible to pass an index via linkage.  The index is not part of the calling programs working storage.  Those of us who've made this mistake, appreciate the lesson more than others. 

Q71)    Explain the difference between an internal and an external sort, the pros and cons, internal sort syntax etc.
A71)     An external sort is not COBOL; it is performed through JCL and PGM=SORT.  It is understandable without any code reference. An internal sort can use two different syntax’s: 1.) USING, GIVING sorts are comparable to external sorts with no extra file processing;  2) INPUT PROCEDURE, OUTPUT PROCEDURE sorts allow for data manipulation before and/or after the sort.

Q72)    What is the difference between comp and comp-3 usage? Explain other COBOL usage’s.
A72)     Comp is a binary usage, while comp-3 indicates packed decimal.  The other common usage’s are binary and display.  Display is the default.

Q73)    When is a scope terminator mandatory?

A73)     Scope terminators are mandatory for in-line PERFORMS and EVALUATE statements.  For readability, it's recommended coding practice to always make scope terminators explicit.

Q74)    In a COBOL II PERFORM statement, when is the conditional tested, before or after the perform execution?
A74)     In COBOL II the optional clause WITH TEST BEFORE or WITH TEST AFTER can be added to all perform statements.  By default the test is performed before the perform.

Q75)    In an EVALUTE statement is the order of the WHEN clauses significant?

A75)     Absolutely.  Evaluation of the WHEN clauses proceeds from top to bottom and their sequence can determine results.

Q76)    What is the default value(s) for an INITIALIZE and what keyword allows for an override of the default.
A76)     INITIALIZE moves spaces to alphabetic fields and zeros to alphanumeric fields.  The REPLACING option can be used to override these defaults.

Q77)    What is SET TO TRUE all about, anyway?
A77)     In COBOL II the 88 levels can be set rather than moving their associated values to the related data item.  (Web note:  This change is not one of COBOL II's better specifications.)Q78)    What is LENGTH in COBOL II?
A78)     LENGTH acts like a special register to tell the length of a group or elementary item.

Q79)    What is the difference between a binary search and a sequential search?  What are the pertinent COBOL
commands?

A79)     In a binary search the table element key values must be in ascending or descending sequence.  The table is 'halved' to search for equal to, greater than or less than conditions until the element is found.  In a sequential search the table is searched from top to bottom, so (ironically) the elements do not have to be in a specific sequence. The binary search is much faster for larger tables, while sequential works well with smaller ones.  SEARCH ALL is used for binary searches; SEARCH for sequential.

Q80)    What is the point of the REPLACING option of a copy statement?
A80)     REPLACING allows for the same copy to be used more than once in the same code by changing the replace value.

1.Name the divisions in a COBOL program. 
IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION.

2.What are the different data types available in COBOL?
Alpha-numeric (X), alphabetic (A) and numeric (9).

3.What does the INITIALIZE verb do? 
Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES.
Numeric, Numeric edited items set to ZERO.
FILLER , OCCURS DEPENDING ON items left untouched.

4.What is 77 level used for ?
Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

5.What is 88 level used for ?
For condition names.

6.What is level 66 used for ?
For RENAMES clause.

7.What does the IS NUMERIC clause establish ?
IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed decimal items. IS NUMERIC returns TRUE if the item only consists of 0-9. However, if the item being tested is a signed item, then it may contain 0-9, + and - .

8.How do you define a table/array in COBOL?
01 ARRAYS.
05 ARRAY1 PIC X(9) OCCURS 10 TIMES.
05 ARRAY2 PIC X(6) OCCURS 20 TIMES INDEXED BY WS-INDEX.

9.Can the OCCURS clause be at the 01 level?
No.

10.What is the difference between index and subscript? 
Subscript refers to the array occurrence while index is the displacement (in no of bytes) from the beginning of the array. An index can only be modified using PERFORM, SEARCH & SET.
Need to have index for a table in order to use SEARCH, SEARCH ALL.

11.What is the difference between SEARCH and SEARCH ALL? 
SEARCH - is a serial search.
SEARCH ALL - is a binary search & the table must be sorted ( ASCENDING/DESCENDING KEY clause to be used & data loaded in this order) before using SEARCH ALL.

12.What should be the sorting order for SEARCH ALL? 
It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the search to be done on an array sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (You must load the table in the specified order).

13.What is binary search?
Search on a sorted array. Compare the item to be searched with the item at the center. If it matches, fine else repeat the process with the left half or the right half depending on where the item lies.

14.My program has an array defined to have 10 items. Due to a bug, I find that even if the program access the 11th item in this array, the program does not abend. What is wrong with it?
Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE.

15.How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning. 
Syntax:
SORT file-1 ON ASCENDING/DESCENDING KEY key....
USING file-2
GIVING file-3.
USING can be substituted by INPUT PROCEDURE IS para-1 THRU para-2
GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2.
file-1 is the sort workfile and must be described using SD entry in FILE SECTION.
file-2 is the input file for the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL. 
file-3 is the outfile from the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL.
file-1, file-2 & file-3 should not be opened explicitly.
INPUT PROCEDURE is executed before the sort and records must be RELEASEd to the sort work file from the input procedure.
OUTPUT PROCEDURE is executed after all records have been sorted. Records from the sort work file must be RETURNed one at a time to the output procedure.

16.How do you define a sort file in JCL that runs the COBOL program?
Use the SORTWK01, SORTWK02,..... dd names in the step. Number of sort datasets depends on the volume of data being sorted, but a minimum of 3 is required.

17.What are the two ways of doing sorting in a COBOL program? Give the formats. 
See question 16.

18.Give the format of USING and GIVING in SORT statement. What are the restrictions with it? 
See question 16. Restrictions - Cannot massage records, canot select records to be sorted.

19.What is the difference between performing a SECTION and a PARAGRAPH? - 
Performing a SECTION will cause all the paragraphs that are part of the section, to be performed. 
Performing a PARAGRAPH will cause only that paragraph to be performed.

20.What is the use of EVALUATE statement? 
Evaluate is like a case statement and can be used to replace nested Ifs. The difference between EVALUATE and case is that no 'break' is required for EVALUATE i.e. control comes out of the EVALUATE as soon as one match is made.

21.What are the different forms of EVALUATE statement?
EVALUATE VALUATE SQLCODE ALSO FILE-STATUS
WHEN A=B AND C=D WHEN 100 ALSO '00'
imperative stmt imperative stmt 
WHEN (D+X)/Y = 4 WHEN -305 ALSO '32'
imperative stmt imperative stmt
WHEN OTHER WHEN OTHER
imperative stmt imperative stmt
END-EVALUATE END-EVALUATE
 
 
EVALUATE SQLCODE ALSO A=B EVALUATE SQLCODE ALSO TRUE
WHEN 100 ALSO TRUE WHEN 100 ALSO A=B
imperative stmt imperative stmt
WHEN -305 ALSO FALSE WHEN -305 ALSO (A/C=4)
imperative stmt imperative stmt
END-EVALUATE END-EVALUATE

22.How do you come out of an EVALUATE statement? 
After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement. There is no need of any extra code.

23.In an EVALUATE statement, can I give a complex condition on a when clause?
Yes.

24.What is a scope terminator? Give examples.
Scope terminator is used to mark the end of a verb e.g. EVALUATE, END-EVALUATE; IF, END-IF.

25.How do you do in-line PERFORM? 
PERFORM ... <UNTIL> ... 
<sentences>
END PERFORM

26.When would you use in-line perform?
When the body of the perform will not be used in other paragraphs. If the body of the perform is a generic type of code (used from various other places in the program), it would be better to put the code in a separate para and use PERFORM paraname rather than in-line perform.

27.What is the difference between CONTINUE & NEXT SENTENCE ?
CONTINUE is like a null statement (do nothing) , while NEXT SENTENCE transfers control to the next sentence (!!) (A sentence is terminated by a period)

28.What does EXIT do ?
Does nothing ! If used, must be the only sentence within a paragraph.

29.Can I redefine an X(100) field with a field of X(200)?
Yes. Redefines just causes both fields to start at the same location. For example:
01 WS-TOP PIC X(1)
01 WS-TOP-RED REDEFINES WS-TOP PIC X(2).
If you MOVE '12' to WS-TOP-RED, 
DISPLAY WS-TOP will show 1 while 
DISPLAY WS-TOP-RED will show 12. 

30.Can I redefine an X(200) field with a field of X(100) ?
Yes.

30.What do you do to resolve SOC-7 error? 
Basically you need to correcting the offending data.

Many times the reason for SOC7 is an un-initialized numeric item. Examine that possibility first.

Many installations provide you a dump for run time abends ( it can be generated also by calling some subroutines or OS services thru assembly language). These dumps provide the offset of the last instruction at which the abend occurred. Examine the compilation 
output XREF listing to get the verb and the line number of the source code at this offset. Then you can look at the source code to find the bug. To get capture the runtime dumps, you will have to define some datasets (SYSABOUT etc ) in the JCL.

If none of these are helpful, use judgement and DISPLAY to localize the source of error.

Some installtion might have batch program debugging tools. Use them.

31.How is sign stored in Packed Decimal fields and Zoned Decimal fields?
Packed Decimal fields: Sign is stored as a hex value in the last nibble (4 bits ) of the storage.
Zoned Decimal fields: As a default, sign is over punched with the numeric value stored in the last bite.

32.How is sign stored in a comp-3 field? 
It is stored in the last nibble. For example if your number is +100, it stores hex 0C in the last byte, hex 1C if your number is 101, hex 2C if your number is 102, hex 1D if the number is -101, hex 2D if the number is -102 etc... 

33. How is sign stored in a COMP field ? 
In the most significant bit. Bit is on if -ve, off if +ve.

34.What is the difference between COMP & COMP-3 ?
COMP is a binary storage format while COMP-3 is packed decimal format.

35.What is COMP-1? COMP-2?
COMP-1 - Single precision floating point. Uses 4 bytes.
COMP-2 - Double precision floating point. Uses 8 bytes.

36.How do you define a variable of COMP-1? COMP-2?
No picture clause to be given. Example 01 WS-VAR USAGE COMP-1.

37.How many bytes does a S9(7) COMP-3 field occupy ?
Will take 4 bytes. Sign is stored as hex value in the last nibble.
General formula is INT((n/2) + 1)), where n=7 in this example.

38.How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy ?
Will occupy 8 bytes (one extra byte for sign).

39.How many bytes will a S9(8) COMP field occupy ?
4 bytes. 

40.What is the maximum value that can be stored in S9(8) COMP?
99999999

41.What is COMP SYNC?
Causes the item to be aligned on natural boundaries. Can be SYNCHRONIZED LEFT or RIGHT.
For binary data items, the address resolution is faster if they are located at word boundaries in the memory. For example, on main frame the memory word size is 4 bytes. This means that each word will start from an address divisible by 4. If my first variable is x(3) and next one is s9(4) comp, then if you do not specify the SYNC clause, S9(4) COMP will start from byte 3 ( assuming that it starts from 0 ). If you specify SYNC, then the binary data item will start from address 4. You might see some wastage of memory, but the access to this computational field is faster. 

42.What is the maximum size of a 01 level item in COBOL I? in COBOL II?
In COBOL II: 16777215

43.How do you reference the following file formats from COBOL programs:
Fixed Block File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, BLOCK CONTAINS 0 .
Fixed Unblocked - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, do not use BLOCK CONTAINS
Variable Block File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS V, BLOCK CONTAINS 0. Do not code the 4 bytes for record length in FD ie JCL rec length will be max rec length in pgm + 4
Variable Unblocked - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS V, do not use BLOCK CONTAINS. Do not code 4 bytes for record length in FD ie JCL rec length will be max rec length in pgm + 4.
ESDS VSAM file - Use ORGANISATION IS SEQUENTIAL. 
KSDS VSAM file - Use ORGANISATION IS INDEXED, RECORD KEY IS, ALTERNATE RECORD KEY IS
RRDS File - Use ORGANISATION IS RELATIVE, RELATIVE KEY IS
Printer File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, BLOCK CONTAINS 0. (Use RECFM=FBA in JCL DCB).

44.What are different file OPEN modes available in COBOL?
Open for INPUT, OUTPUT, I-O, EXTEND.

45.What is the mode in which you will OPEN a file for writing? - 
OUTPUT, EXTEND
 

46.In the JCL, how do you define the files referred to in a subroutine?
Supply the DD cards just as you would for files referred to in the main program. 

47.Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?
Can rewrite(record length must be same), but not delete.

48.What is file status 92? 
Logic error. e.g., a file is opened for input and an attempt is made to write to it.

49.What is file status 39 ?
Mismatch in LRECL or BLOCKSIZE or RECFM between your COBOL pgm & the JCL (or the dataset label). You will get file status 39 on an OPEN.

50.What is Static,Dynamic linking ?
In static linking, the called subroutine is link-edited into the calling program , while in dynamic linking, the subroutine & the main program will exist as separate load modules. You choose static/dynamic linking by choosing either the DYNAM or NODYNAM link edit option. (Even if you choose NODYNAM, a CALL identifier (as opposed to a CALL literal), will translate to a DYNAMIC call).
A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL or you do a CANCEL. A dynamically called routine will always be in its initial state.

51.What is AMODE(24), AMODE(31), RMODE(24) and RMODE(ANY)? ( applicable to only MVS/ESA Enterprise Server).
These are compile/link edit options.
AMODE - Addressing mode. RMODE - Residency mode.
AMODE(24) - 24 bit addressing. AMODE(31) - 31 bit addressing. AMODE(ANY) - Either 24 bit or 31 bit addressing depending on RMODE.
RMODE(24) - Resides in virtual storage below 16 Meg line. Use this for 31 bit programs that call 24 bit programs. (OS/VS Cobol pgms use 24 bit addresses only).
RMODE(ANY) - Can reside above or below 16 Meg line.

52.What compiler option would you use for dynamic linking?
DYNAM.

53.What is SSRANGE, NOSSRANGE ?
These are compiler options w.r.t subscript out of range checking. NOSSRANGE is the default and if chosen, no run time error will be flagged if your index or subscript goes out of the permissible range.

54.How do you set a return code to the JCL from a COBOL program?
Move a value to RETURN-CODE register. RETURN-CODE should not be declared in your program.

55.How can you submit a job from COBOL programs?
Write JCL cards to a dataset with 
//xxxxxxx SYSOUT=(A,INTRDR) where 'A' is output class, and dataset should be opened for output in the program. Define a 80 byte record layout for the file.

56.What are the differences between OS VS COBOL and VS COBOL II?
OS/VS Cobol pgms can only run in 24 bit addressing mode, VS Cobol II pgms can run either in 24 bit or 31 bit addressing modes.
Report writer is supported only in OS/VS Cobol.
USAGE IS POINTER is supported only in VS COBOL II.

Reference modification eg: WS-VAR(1:2) is supported only in VS COBOL II.
EVALUATE is supported only in VS COBOL II.
Scope terminators are supported only in VS COBOL II.
OS/VS Cobol follows ANSI 74 stds while VS COBOL II follows ANSI 85 stds.
Under CICS Calls between VS COBOL II programs are supported.

57.What are the steps you go through while creating a COBOL program executable?
DB2 precompiler(if embedded sql used), CICS translator (if CICS pgm), Cobol compiler, Link editor.
If DB2 program, create plan by binding the DBRMs.

58.Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?
In non-CICS environment, it is possible. In CICS, this is not possible.

 

A data name must at least be 8 digits in COBOL
A)    True
B)    False

A sentence in COBOL consists of one or more than statements terminated by a period?
A)    True
B)    False

A level 77 can start in any of AREA A or AREA B?
A)    True
B)    False
 
RENAME in COBOL is not used to regroup elementary items in a group?
A)    True
B)    False
 
Find which one of the following is not correct         
A)    The environment division is the most machine dependent division among all the divisions
B)    In Most compilers the environment division must contain the configuration section.
C)    Environment division has all the rules to solve any problem.
D)    All the peripheral devices required by a cobol program are mentioned in the environment division

77-level entries are permitted in _________________.
A)    Any part of the file section
B)    Any part of the working-storage section
C)    Before all 01-level entries in the working-storage section
D)    Any part of the data division

Each of the following combinations of edit char can appear in the same picture clause except for
A)    -$*
B)    $CR
C)    $Z9
D)    -$CR

A record can be described using which of these level numbers
A)    01 to 49 (both inclusive) and 77
B)    01 to 49 (both inclusive)
C)    all odd numbers from 01 to 49
D)    all even numbers from 01 to 49
 
Indicate which one of the following is an invalid paragraph name
A)    10020
B)    CCC+100
C)    ZZE99
D)    CCC-100

Which one of the following is incorrect?
A)    SUBTRACT A B C FROM D E F
B)    SUBTRACT A B C FROM D E GIVING F G
C)    SUBTRACT A FROM D, B FROM E, C FROM F
D)    SUBTRACT A FROM B GIVING D E F
 
Which one of the following is incorrect
A)    DIVIDE A INTO B
B)    DIVIDE A BY B
C)    DIVIDE A INTO B GIVING C
D)    DIVIDE A BY B GIVING C
 
A data item Var1 described with PIC S9(4) requires 3 bytes of storage if its usage clause is
A)    Comp
B)    Comp-I
C)    Display
D)    Comp-3

Which one of the following is not a valid statement?
A)    MULTIPLY CORRESPONDING RECORD1 BY RECORD2
B)    ADD CORRESPONDING RECORD1 TO RECORD2
C)    MOVE CORRESPONDING RECORD1 TO RECORD2
D)    SUBTRACT CORRESPONDING RECORD1 FROM RECORD2
 
Which one is incorrect in the following?
A)    IF A IS GREATER THAN B GO TO PARA-A
B)    IF C IS NOT POSITIVE GO TO PARA-C
C)    IF D IS NOT ALPHANUMERIC GO TO PARA-D
D)    IF E = 3 OR 4  GO TO PARA-VALID
 
Which one of the following is false about the SET verb?
A)    The SET verb can be used to set one or more indexes to a particular value
B)    The SET verb can be used to move the current value of an index to one or more identifiers
C)    The verb can be used to increment one or more identifiers by a positive integral value
D)    The verb can be used to decrement one or more indexes by a positive integral value
 
Which of the following statements are false?
A)    A more efficient code is generated if indexing rather than subscripting is used
B)    Indexing is a must, if search verb is to be used on a table
C)    Relative indexing is allowed but relative subscripting is not allowed
D)    A perform statement with varying option can manipulate a subscript but it cannot manipulate an index
 
Which of the following may not take place when a file on Tape is opened in INPUT mode?
A)    It positions the tape at the first record
B)    It checks whether the retention period for the file has expired or not and if period is expired then prints an error message
C)    It allocates buffers to the file to store user records
D)    It checks the title of the file to ensure the opening of the correct file

Which of the following does not provide options to set up special procedures for handling input-output errors or exceptions in COBOL?
A)    Invalid key
B)    Close statement with lock option
C)    At end clause
D)    Use procedure
 
Which of the following is false about the block contains clause
A)    It reduces the space required to store a file on tape or disk
B)    It reduces the time required to process a sequential file
C)    It reduces the number of physical records in a file
D)    It reduces the number of logical records in a file
 
Which of the following is false when procedures are used with the sort verb?
A)    The input and output procedures may share any section or any part between them
B)    Procedures must not contain any sort/merge statement
C)    Control must not be passed to any part of these procedures from elsewhere in the program
D)    An explicit transfer of control from the procedures to the outside is not allowed
 

What is the result of the following?
MOVE 1 TO VAR1
MOVE 2 TO VAR2
EVALUATE TRUE
WHEN VAR1=1
     PERFORM PARA-1
WHEN VAR2=2
     PERFORM PARA-2
WHEN OTHER
     NEXT SENTENCE
END-EVALUATE.
A)    PARA-1 will be performed
B)    PARA-2 will be performed
C)    Both PARA-1 and PARA-2 will be performed.
D)    Compile error for incorrect use of NEXT sentence
 
Which of the following is an INCORRECT specification for a data-name?    
A)    var-var1              
B)    data1     
C)    two                
D)    all
(ALL is a reserved word)
 
What is the result of the following?
MOVE 1 TO VAR1
MOVE 2 TO VAR2
EVALUATE TRUE
WHEN VAR1=1
     PERFORM PARA-1
WHEN VAR2=2
     PERFORM PARA-2
WHEN OTHER
     DISPLAY VAR1
END-EVALUATE.
A)    PARA-1 will be performed
B)    PARA-2 will be performed
C)    Both PARA-1 and PARA-2 will be performed.
D)    Compile error for incorrect use of NEXT sentence
 
Which of the following PIC clause is invalid as a floating symbol?
A)    +                     
B)    $
C)    S                 
D)    -
 
What is the result of the following?
MOVE 0 TO VAR1
 
EVALUATE TRUE
WHEN VAR1=1
     PERFORM PARA-1
WHEN VAR1=2
     PERFORM PARA-2
WHEN OTHER
     PERFORM PARA-3
END-EVALUATE.
 
A)    PARA-1 will be performed
B)    PARA-2 will be performed
C)    Both PARA-1 and PARA-2 will be performed.
D)    PARA-3 will be performed
 
Which of the following is an invalid paragraph name?
A)    A-1     
B)    999
C)    A+1                  
D)    ZZ9
 
What is the result of the following?
MOVE 0 TO VAR1
  EVALUATE TRUE
WHEN VAR1=1
     PERFORM PARA-1
WHEN VAR1=2
     PERFORM PARA-2
 END-EVALUATE.
 
A)    PARA-1 will be performed
B)    PARA-2 will be performed
C)    Both PARA-1 and PARA-2 will be performed.
D)    None of the above
 
Which of the following is correct definition of figurative constant in COBOL?
A)    Constants that are represented as alphanumeric text also known as non-numeric literals.
B)    Constants that are represented in terms of digits, also known as literals
C)    Data names that are initialized to specific values in DATA DIVISION and retain those values throughout the execution of the program.
D)    Reserved words that are used as substitutes for certain special constants - numeric and alphanumeric
 
Where does AREA A in COBOL extends from?
A)    8-16
B)    8-11
C)    12-72
D)    8-10
 
According to the given declarations in Data Division.  How many elementary items are described below?

         05 CALENDAR-DATE.
            08  CALENDAR-DAY           PIC 99.
            08  CALENDAR-MON           PIC 99.
            08  CALENDAR-YEAR          PIC 99.
         05 FILLER                  PIC X(5).
         05 VAR1         PIC XX.
         05 VAR2         PIC X.
         05 END-DATE.
            10 FILLER               PIC X(4).
            10 END-YEAR             PIC 99.
A)    3                         
B)    6
C)    4                         
D)    5
 
Where does AREA B in COBOL extends from?
A)    8-16
B)    8-11
C)    12-72
D)    8-10
 
FILE-CONTROL paragraph in a COBOL program appears in
A)    Input-Ouput Section in Environment Division
B)    File Section in Data Division
C)    Procedure Division, it can only be a user-defined paragraph
D)    Configuration Section in Environment Division
 
Program-id a paragraph name in IDENTIFICATION division?
A)    True
B)    False
 
The Procedure Division of a program contains the statement
      WRITE MASTER-REC
   This suggests that the OPEN statement for this file
      must NOT be
A)    OPEN INPUT
B)    OPEN EXTEND
C)    OPEN INPUT-OUTPUT
D)    OPEN OUTPUT
 
Program-id is compulsory?
A)    True
B)    False
Program-id should necessary be same as member name of COBOL program?
A)    True
B)    False
 
Rounded precedes the ON SIZE ERROR ?
A)    True
B)    False
 
A Numeric literal in COBOL can have at most how many digits?
A)    10
B)    160
C)    18
D)    32
 
A Non Numeric literal in COBOL can have at most how many digits?
A)    10
B)    160
C)    18
D)    32
 
A 01 level cannot have PIC clause?
A)    True
B)    False

Home | Register for Job Updates | Contact Us