A Community of and for MVS Programmers













COBOL Technical FAQ's

COBOL IMS VSAM
DB2 JCL CICS


Q How many different level numbers can be used in COBOL to describe a record?
A 01-49.
   
Q What is level 88?
A The level 88 in the Data Division can be used to give condition names to the values that a field contain. When this level is specified you can use the condition name instead of is = to in the IF statement. Condition name should be specified under Level 88 immediately following the field description.
   
Q What is the difference between level 77 and 01? and which is more efficient?
A Level 77 can be used to describe independent elementary items in the Working-Storage or Linkage Sections.
Level 01 can be used to describe both elementary and group items. Any item described in Level 01, the system is putting on Double-Word boundary and inserts slack bytes if necessary
   
Q Name the different PERFORM statement?
A PERFORM
PERFORM THRU
PERFORM 'n' of TIMES
PERFORM UNTIL
PERFORM VARYING with UNTIL Option.
   
Q What is the Structured Programming and how do you identify it?
A The difference between regular programming approach and structured programming is that structured programs get rid of GO TO statements and the whole programs can be represented in a Top-Down design. This design is possible because of existence of 3 basic structures:
a. Sequence Structure: within sequence structure all functions are executed in their physical order. The structure has one entry point and one exit point.

b. Selection Structure: within selection structure execution of the function depends on whether conditions true or false. The structure has one entry point and one exit point.
c. Iteration Structure: within iteration structure the execution of the function will be reiterated over and over again until condition becomes true. The structure has one entry point and one exit point. All these structures have one entry point and one exit point. Because of this if the programs is written by using only these structures, the whole programs will have one entry point and one exit point.
   
Q What are advantages of Structured Programming?
A The programs gets rid of GO TO statements and is represented by Top-Down Structure which is visible and easy to understand, because the programs has a specific (hierarchical) structure, it is easy to debug the programs.
   
Q What is a subscript?
A Subscript represents occurrence # of the Table Entry. Subscript can be represented explicitly and implicitly. Explicitly means thru occurrence # of the table entry; implicitly means thru a data name. That data name should be defined as an independent item in the W-S Section. The most efficient definition of Subscript is Full-Word binary.
   
Q What is an index?
A Index is assigned to specific table thru INDEXED BY clause. Internally is represented by Index Register which is Full-Word binary. Specific index name can be used to reference a field from the table to which that index is assigned to index represents displacement value of the table entry from the beginning of the table.
   
Q What is the difference between Subscript and Index?
A Index represent displacement value of the table entry from the beginning of the table, subscript - occurrence # of the table entry. To calculate the displacement of the table entry from its beginning when subscript is used takes 16 additional instructions from the system because of that the usage of the index is more efficient.
   
Q What are the different ways of an internal table search?
A a. Sequential Search statement. (SEARCH)
b. Binary search statement.(SEARCH ALL)
   
Q What is the difference between SEARCH and SEARCH ALL?
A Serial search (SEARCH) examines each table entry starting at the beginning, whereas a binary search (SEARCH ALL) starts looking at the mid-point of the table and works its way toward the argument depending upon if its too high or too low.  A serial search can be used for unsorted tables, while a binary search is only useful if the tables is sorted.
   
Q How do change the value of an index in a COBOL programs?
A A SET statement.
   
Q How many different data USAGEs can be used in COBOL?
A DISPLAY, COMP, COMP-3, INDEX, POINTER.
   
Q What is a USAGE IS INDEX?
A USAGE IS INDEX represents an index data item which is Full-Word binary and is used to save the value of the index. That Index Data Item can be set to the value of the Index thru the SET statement, ex. SET WS-IND-SAVE-FLD TO ITEM-IND. Index data item is not directly related to any table.
   
Q What is AMODE and RMODE? What does 24 or 31 mean to it?
A Addressing Mode/Access Mode
AMODE(24) indicates 24-bit (three-byte) addressing - memory below the line.
AMODE(31) indicates 31-bit addressing - memory above and below the line.
AMODE=ANY indicates the program may use either of the addressing technique.
Run Mode/Residency Mode
RMODE(24) indicates that the program must be loaded into memory below the line
RMODE(31) indicates that the program can be loaded either below or above the line.
RMODE=ANY indicates that the program can be run in either 24 bit (below)or 31 bit memory (above).
   
Q What is the difference between static call and dynamic call in Cobol?
A A statically called program is link-edited into the same load module as the calling program, a static call is faster than a dynamic call. A static call is the preferred method if your application does not require the services of the dynamic call.
Statically called programs cannot be deleted (using CANCEL), so static calls might take more main storage. If storage is a concern, think about using dynamic calls. Storage usage of calls depends on whether:
The subprogram is called only a few times. Regardless of whether it is called, a statically called program is loaded into storage; a dynamically called program is loaded only when it is called.
You subsequently delete the dynamically called subprogram with a CANCEL statement.
You cannot delete a statically called program, but you can delete a dynamically called program. Using a dynamic call and then a CANCEL statement to delete the dynamically called program after it is no longer needed in the application (and not after each call to it) might require less storage than using a static call.


 

 

 

 



 


Home | Help Boards | Contact Us | News | Top

© 2002, MVSFORUMS. All Rights Reserved.