Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1976988
  • 博文数量: 593
  • 博客积分: 20034
  • 博客等级: 上将
  • 技术积分: 6779
  • 用 户 组: 普通用户
  • 注册时间: 2006-02-06 14:07
文章分类

全部博文(593)

文章存档

2016年(1)

2011年(101)

2010年(80)

2009年(10)

2008年(102)

2007年(16)

2006年(283)

我的朋友

分类:

2006-02-23 22:20:35

COBOL & COBOL II

 

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 - .

 

Q8) How do you define a table/array in COBOL?

A8) ARRAYS.

05       ARRAY1  PIC X(9) OCCURS 10 TIMES.

       05 ARRAY2  PIC X(6) OCCURS 20 TIMES INDEXED BY WS-INDEX.

 

Q9) Can the OCCURS clause be at the 01 level?

A9) No.

 

Q10)   What is the difference between index and subscript? - GS

A10)   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.

 

Q11)   What is the difference between SEARCH and SEARCH ALL? - GS

A11)   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.

 

Q12)   What should be the sorting order for SEARCH ALL? - GS

A12)   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).

 

Q13)   What is binary search?

A13)   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.

 

Q14)   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?

A14)   Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE.

 

Q15)   How do you sort in a COBOL program?  Give sort file definition, sort statement syntax and meaning. - GS

A15) 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 (work) file 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 out file 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.

 

Q16)   How do you define a sort file in JCL that runs the COBOL program?

A16)   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.

 

Q17)   What is the difference between performing a SECTION and a PARAGRAPH? - GS

A17)   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.

 

Q18)   What is the use of EVALUATE statement? - GS

A18)   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.

 

Q19)   What are the different forms of EVALUATE statement?

A19)

EVALUATE                                             EVALUATE 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

 

Q20)   How do you come out of an EVALUATE statement? - GS

A20)   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.

 

Q21)   In an EVALUATE statement, can I give a complex condition on a when clause?

A21)   Yes.

 

Q22)   What is a scope terminator?  Give examples.

A22)   Scope terminator is used to mark the end of a verb e.g. EVALUATE, END-EVALUATE; IF, END-IF.

 

Q23)   How do you do in-line PERFORM? - GS

A23)   PERFORM ... ...

END-PERFORM

 

Q24)   When would you use in-line perform?

A24)   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 Para name rather than in-line perform.

 

Q25)   What is the difference between CONTINUE & NEXT SENTENCE ?

A25)   They appear to be similar, that is, the control goes to the next sentence in the paragraph. But, Next Sentence would

take the control to the sentence after it finds a full stop (.). Check out by writing the following code example, one if

sentence followed by 3 display statements (sorry they appear one line here because of formatting restrictions) If 1 > 0

then next sentence end if display 'line 1' display 'line 2'. display 'line 3'. *** Note- there is a dot (.) only at the end of

the last 2 statements, see the effect by replacing Next Sentence with Continue ***     

 

Q26)   What does EXIT do ?

A26)   Does nothing ! If used, must be the only sentence within a paragraph.

 

Q27)   Can I redefine an X(100) field with a field of X(200)?

A27)   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.

 

A28)   Can I redefine an X(200) field with a field of X(100) ?

Q31)1  Yes.

 

Q31)2       What do you do to resolve SOC-7 error? - GS

Q31)    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?

Q32)    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

Q33)    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

Q34)    In the most significant bit.  Bit is ON if -ve, OFF if +ve.

 

Q35)   What is the difference between COMP & COMP-3  ?

Q35)    COMP is a binary storage format while COMP-3 is packed decimal format.

 

Q36)   What is COMP-1? COMP-2?

Q36)    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?

Q37)    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 ?

Q38)    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 ?

Q39)    Will occupy 8 bytes (one extra byte for sign).

 

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

Q40)    4 bytes.

 

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

Q41)    99999999

 

Q42)   What is COMP SYNC?

Q42)    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?

Q43)    In COBOL II: 16777215

 

Q44)   How do you reference the following file formats from COBOL programs:

Q44)   

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).

 

Q45)   What are different file OPEN modes available in COBOL?

Q45)    Open for INPUT, OUTPUT, I-O, EXTEND.

 

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

Q46)    OUTPUT, EXTEND

 

Q47)   In the JCL, how do you define the files referred to in a subroutine ?

Q47)    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?

Q48)    Can rewrite (record length must be same), but not delete.

 

Q49)   What is file status 92? - GS

Q49)    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 ?

Q50)    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 ?

Q51)    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).

Q52)    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?

Q53)    DYNAM.

 

Q54)   What is SSRANGE, NOSSRANGE ?

Q54)    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?

Q55)    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?

Q56)    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?

Q57)    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?

Q58)    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 ?

Q59)    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.

 

Q81)   What will happen if you code GO BACK instead of STOP RUN in a stand alone COBOL program i.e. a

program which is not calling any other program.

A81)   The program will go in an infinite loop.

 

Q82)   How can I tell if a module is being called DYNAMICALLY or STATICALLY?

A82)   The ONLY way is to look at the output of the linkage editor (IEWL)or the load module itself. If the module is being called DYNAMICALLY then it will not exist in the main module, if it is being called STATICALLY then it will be seen in the load module. Calling a working storage variable, containing a program name, does not make a DYNAMIC call. This type of calling is  known as IMPLICITE calling as the name of the module is implied by the contents of the working storage variable. Calling a program name literal (CALL

 

Q83)   What is the difference between a DYNAMIC and STATIC call in COBOL.

A83)   To correct an earlier answer: All called modules cannot run standalone if they require  program variables passed to them via the LINKAGE section. DYNAMICally called modules are those that are not bound with the calling program at link edit time (IEWL for IBM) and so are loaded from the program library (joblib or steplib) associated with the job. For DYNAMIC  calling of a module the DYNAM compiler option must be chosen, else the linkage editor will not generate an executable as it will expect u address resolution of all called modules. A  STATICally called module is one that is bound with the calling module at link edit, and therefore becomes part of the executable load module.

 

Q84)   How may divisions are there in JCL-COBOL?

A84)   Four

 

Q85)   What is the purpose of Identification Division?

A85)   Documentation.

 

Q86)   What is the difference between PIC 9.99 and 9v99?

A86)   PIC 9.99 is a FOUR-POSITION field that actually contains a decimal point where as PIC 9v99 is THREE- POSITION numeric field with implied or assumed decimal position.

 

Q87)   what is Pic 9v99 Indicates?

A87)   PICTURE 9v99 is a three position Numeric field with an implied or assumed decimal  point after the first position; the v means an implied decimal point.

 

Q88)   What guidelines should be followed to write a structured Cobol prg'm?

A88)

1)     use 'evaluate' stmt for constructing cases.

2)     use scope  terminators for nesting.

3)     use in line perform stmt for writing 'do '  constructions.

4)     use test before and test after in the perform stmt for writing do-while constructions.

 

Q89)   Read the following code. 01 ws-n pic 9(2) value zero. a-para move 5 to ws-n. perform b-para ws-n times. b-para.

move 10 to ws-n. how many times will b-para be executed ?

A89)   5 times only. it will not take the value 10 that is initialized in the loop.

 

Q90)   What is the difference between SEARCH and SEARCH ALL? What is more efficient?

A90)   SEARCH is a sequential search from the beginning of the table. SEARCH ALL is a binary search, continually dividing the table in two halves until a match is found. SEARCH ALL is more efficient for tables larger than 70 items.

 

Q91)   What are some examples of command terminators?

A91)   END-IF, END-EVALUATE

 

Q92)   What care has to be taken to force program to execute above 16 Meg line?

A92)   Make sure that link option is AMODE=31 and RMODE=ANY. Compile option should never have SIZE(MAX). BUFSIZE can be 2K, efficient enough.

Q93)   How do you submit JCL via a Cobol program?

A93)   Use a file //dd1 DD sysout=(*, intrdr)write your JCL to this file. Pl some on try this out.

 

Q94)   How to execute a set of JCL statements from a COBOL program

A94)   Using EXEC CICS SPOOL WRITE(var-name) END-EXEC command. var-name is a COBOL host structure containing JCL statements.

 

Q95)   Give some advantages of REDEFINES clause.

A95)

1.     You can REDEFINE a Variable from one PICTURE class to another PICTURE  class by using the same memory

location.

2.     By REDEFINES we can INITIALISE the variable in WORKING-STORAGE Section itself.

3.     We can REDEFINE a Single Variable into so many sub variables. (This facility is very useful in solving Y2000

Problem.)

 

Q96)   What is the difference between static call & Dynamic call

A96)   In the case of Static call, the called program is a stand-alone program, it is an executable program. During run time we can call it in our called program. As about Dynamic call, the called program is not an executable program it can executed through the called program

 

Q97)   What do you feel makes a good program?

A97)   A program that follows a top down approach. It is also one that other programmers or users can follow logically and is easy to read and understand.

 

Q98)   How do you code Cobol to access a parameter that has been defined in JCL? And do you code the PARM

parameter on the EXEC line in JCL?

A98)         

1)     using JCL with sysin. //sysin dd *here u code the parameters(value) to pass in to cobol program /* and in program

you use accept variable name(one accept will read one row)/.another way.

2)     in jcl using parm statement ex: in exec statement parm='john','david' in cobol pgm u have to code linkage section in that for first value you code length variable and variable name say, abc pic x(4).it will take john inside to read next value u have to code another variable in the same way above mentioned.

 

Q99)   Why do we code S9(4) comp. Inspite of knowing comp-3 will occupy less space.

A99)   Here s9(4)comp is small integer ,so two words equal to 1 byte so totally it will occupy 2 bytes(4 words).here in s9(4) comp-3 as one word is equal to 1/2 byte.4 words equal to 2 bytes and sign will occupy 1/2 byte so totally it will occupy 3 bytes.

 

Q100)       The maximum number of dimensions that an array can have in COBOL-85 is ----------- ?

A100)        SEVEN in COBOL - 85 and THREE in COBOL - 84

 

Choose the correct answer:

 

1)     Which VSAM clusters support only fixed length records?                              (b)

a)      LDS

b)      RRDS

c)      ESDS

d)      KSDS

 

2)     FREESPACE can be specified for which type of cluster?                                 (d)

a)      LDS

b)      RRDS

c)      ESDS

d)      KSDS

 

3)     In which cluster type are records added at the end of the data set?                        (c)

a)      LDS

b)      RRDS

c)      ESDS

d)      KSDS

 

4)     The types of processing supported by RRDS are                                              (e)

a)      sequential

b)      skip-sequential

c)      direct

d)      a and b

e)      a, b and c

 

5)     The types of processing supported by ESDS are                                              (d)

a)      sequential

b)      skip-sequential

c)      direct

d)      a and b

e)      a and c

 

6)     Spanned records can be found in                                                      (d)

a)      ESDS

b)      KSDS

c)      RRDS

d)      a or b

e)      a or c

 

7)     Spanned records can be accessed in                                                         (a)

a)      MOVE

b)      LOCATE

c)      a and b

d)      None

 

8)     Alternate Index is a special type of                                                   (a)

a)      KSDS

b)      ESDS

c)      RRDS

d)      None

 

9)     Specifying CISZ(4096) at the cluster level for a KSDS results in                             (c)    

a)      VSAM ignoring the specification

b)      Data and index CISZ 4k each

c)      Data CISZ 4k; index CISZ selected by VSAM

d)      Index CISZ 4K; data CISZ selected by VSAM

 

10)   When defining a KSDS, which of the following parameters is not required?                   (b)

a)      Space allocation (either CYL, REC or TRK)

b)      VOLUMES

c)      KEYS

d)      NAME

 

11)   Default RECORD SIZE for a NONSPANNED data set is                                   (d)

a)      (80 80)

b)      (4086 32600)

c)      (100 32600)

d)      (4089 4089)

 

12)   If the key of a KSDS record begins in the second field (first field is 25 bytes long), the offset in the

KEYS parameter is                                                                       (a)

a)      24

b)      25

c)      26

d)      None

 

13)   Data organization in KSDS is                                                             (a)

a)      INDEXED

b)      NUMBERED

c)      LINEAR

d)      NONINDEXED

 

14)   The default cluster type is                                                          (d)

a)      ESDS

b)      RRDS

c)      LDS

d)      KSDS

 

15)   VOLUMES parameter can be specified at                                         (c)

a)      cluster level

b)      data level and index level

c)      All the above

d)      None

 

16)   The RECORDSIZE parameter cannot be coded for                                   (c)

a)      ESDS

b)      RRDS

c)      LDS

d)      KSDS

 

17)   The default PRINT format is                                                                (b)

a)      Character

b)      Dump

c)      Hexadecimal

d)      None

 

18)   Which of the following REPRO selection parameters can be specified for an LDS?       (e)

a)      FROMKEY

b)      FROMADDRESS

c)      FROMNUMBER

d)      SKIP

e)      None

 

19)   The REPLACE parameter causes                                                        (c)

a)      KSDS records to be replaced by an input record with the same key

b)      ESDS records to be replaced by an input record with the same RBA

c)      RRDS records to be replaced by an input record with the same RRN

d)      a and c

e)      All the above

 

20)   Which of the following is not a modal command?                                    (e)

a)      IF

b)      THEN

c)      ELSE

d)      DO

e)      GOTO

 

21)   Using REPRO to reorganize a KSDS, which of the following is true?             (e)

a)      Input must be ascending key sequence.

b)      No duplicate keys are allowed.

c)      Non-unique keys are allowed.

d)      a and c

e)      a and b

 

22)   Which of the following entry names are valid for ALTER FREESPACE?                (b)

a)      Cluster name

b)      Data component name

c)      Index component name

d)      b and c

e)      a, b and c

 

23)   Which of the following is a correct generic name specification for TEST.USER.DATA.A? (a)

a)      TEST.USER.*

b)      TEST.*.*.A

c)      *.USER.DATA.A

d)      TEST.USER.*.A

 

24)   To alter a cluster to an LDS, the cluster must                                            (e)

a)      be an ESDS

b)      be NONSPANNED

c)      have a CISZ of 4K

d)      not have an alternate index associated with it

e)      all the above

 

25)   For which access mode below must the application program interpret RDFs?       (b)

a)      KEY

b)      ADR

c)      ADR(for a KSDS)

d)      CNV

e)      None

 

26)   At OPEN, VSAM determines processing options in the following order                (d)

a)      JCL, program, catalog

b)      program, JCL, catalog

c)      JCL, catalog, program

d)      catalog, program, JCL

e)      None

 

27)   VSAM request macros (e.g., GET, PUT) point to which other macros?                   (c)

a)      OPEN

b)      ACB

c)      RPL

d)      CLOSE

e)      b and c

f)       None

 

28)   If a program uses direct processing exclusively, DIR is specified in which macros?      (c)

a)      OPEN

b)      ACB

c)      RPL

d)      CLOSE

e)      b and c

f)       None

 

29)   VSAM processing options could be specified in                                              (e)

a)      Catalog

b)      Program control blocks

c)      JCL

d)      None

e)      All the above

 

30)   Which of the following is not a COBOL verb?                                          (d)

a)      START

b)      READ

c)      DELETE

d)      UPDATE

e)      REWRITE

 

31)   Which of the following is/are not supported by COBOL?                                         (d)

a)      Skip-sequential processing

b)      RBA addressing

c)      Replacing existing record

d)      a and b

e)      a, b and c

f)       a and c

 

32)   Which is a valid SHAREOPTIONS specification?                                             (b)

a)      SHR(2 2)

b)      SHR(2 3)

c)      SHR(4 1)

d)      SHR(1 2)

e)      None

 

33)   For a data set defined with SPEED, which of the following is true?                                   (a)

a)        SPEED is effective for the initial load only.

b)        SPEED is effective for all additions to the data set after initial load.

c)        If the load program ABENDS, VERIFY can determine the HIGH-USED-RBA of the data set.

d)        If the load program ABENDS, only those records remaining in buffers need to be added to the data set.

e)        None

 

34)   VERIFY cannot be used for                                                                          (c)

a)      Empty data set

b)      LDS

c)      a and b

d)      None

 

35)   For a data set defined with NOERASE, which of the following is not true?                     (a)

a)      Desirable for sensitive data

b)      Removes catalog entries

c)      All the above

d)      None

 

36)   Buffer space cannot be specified in which of the following?                                    (d)

a)      DD statement   

b)      Assembler program

c)      AMS DEFINE

d)      COBOL program

 

37)   How many data buffers are required for sequential processing to overlap I/O processing?  (c)

a)      2

b)      3

c)      4

d)      5

 

38)   When defining a KSDS, the best place to specify CISZ is generally                                 (b)

a)      At the cluster level

b)      At the data level only

c)      At the index level only

d)      At both data and index levels

 

39)   For direct processing the recommended number of data buffers is                                   (b)

a)      STRNO

b)      STRNO+1

c)      STRNO+2

d)      STRNO+3

e)      None

 

40)   For 3380 DASD, TRK(50 5) results in which CA size for a KSDS defined with NOIMBED? (b)

a)      1 TRK                                                                                 

b)      5 TRKS

c)      15 TRKS

d)      50 TRKS

e)      None

 

41)   Suppose you are defining a multi-volume data set with VOL(A B) and five key ranges specified. Which of the following correctly indicates where each key range will be located?                                                (c)

a)      First key range on VOL A; second on B; third on A; etc.

b)      First key range on VOL B; second on A; third on B; etc.

c)      First key range on VOL A; remaining key ranges on B.

d)      All key ranges on VOL A; B is used for overflow only.

e)      All key ranges on VOL B; A is used for overflow only.

 

42)   An alternate index can be defined for which cluster type?                                                  (b)

a)      KSDS and RRDS

b)      KSDS and ESDS

c)      KSDS and LDS

d)      KSDS only

e)      KSDS, ESDS and RRDS

 

43)   If an application program accesses a base cluster in alternate key sequence, then DD statements are needed for which data sets?                                                                                             (f)

a)      Base cluster

b)      Alternate index

c)      Path

d)      a and b

e)      a and c

f)       a, b and c

 

44)   An alternate index itself is which cluster type?                                                            (d)

a)      LDS

b)      RRDS

c)      ESDS

d)      KSDS

e)      None

 

45)   Which of the following backs up data in CI mode?                                                     (b)

a)      REPRO only

b)      EXPORT only

c)      Both REPRO and EXPORT

d)      Neither REPRO nor EXPORT

 

46)   Which of the following writes catalog information into the backup data set?                                    (b)

a)      REPRO only

b)      EXPORT only

c)      Both REPRO and EXPORT

d)      Neither REPRO nor EXPORT

 

47)   Which of the following requires a DELETE/DEFINE before the command can be used to restore an

existing data set?                                                                                            (a)

a)      REPRO only

b)      IMPORT only

c)      Both REPRO and IMPORT

d)      Neither REPRO nor IMPORT

 

48)   With HBACKDS the use of apostrophes to enclose the dsname is                                           (b)

a)      Required

b)      Used to exclude the TSO id as the high level qualifier

c)      Required only if one or more segments are specified generically

d)      Not allowed if the data set is password protected

 

阅读(4426) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~