Friday, July 12, 2013

Differences 3


Q11) Explain the difference between an internal and an external sort, the pros and cons, internal sort syntax etc. ?
A11) 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. 

Q12) What is the difference between a DYNAMIC and STATIC call in COBOL. ?
A12) 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.

Sl #
STATIC Call
DYNAMIC Call
1
Identified by Call literal.
Ex: CALL ‘PGM1’.
Identified by Call variable and the variable should be populated at run time.
01 WS-PGM PIC X(08).
Move ‘PGM1’ to WS-PGM
CALL WS-PGM
2
Default Compiler option is NODYNAM and so all the literal calls are considered as static calls. 
If you want convert the literal calls into DYNAMIC, the program should be compiled with DYNAM option.
By default, call variables and any un-resolved calls are considered as dynamic.
3.
If the subprogram undergoes change, sub program and main program need to be recompiled.
If the subprogram undergoes change, recompilation of subprogram is enough.
4
Sub modules are link edited with main module.
Sub modules are picked up during run time from the load library.
5
Size of load module will be large
Size of load module will be less.
6
Fast
Slow compared to Static call.
7
Less flexible.
More flexible.
8
Sub-program will not be in initial stage the next time it is called unless you explicitly use INITIAL or you do a CANCEL after each call.
Program will be in initial state every time it is called.

Difference between Pass-by-reference and Pass-by-content
Sl #
Passl By Reference
Pass By Content
1
CALL ‘sub1’ USING BY REFERENCE WS-VAR1
CALL ‘sub1’ USING BY CONTENT WS-VAR1
(BY CONTENT keyword is needed)
2
It is default in COBOL. BY REFERENCE is not needed.
BY CONTENT key word is mandatory to pass an element by value.
3
Address of WS-VAR1 is passed
Value of WS-VAR1 is passed
4
The sub-program modifications on the passed elements are visible in the main program.
The sub-program modifications on the passed elements are local to that
sub-program and not visible in the main program.

Q13) Difference between exit program and end programe 
A13)
EXIT PROGRAM                                                          END PROGRAM
1.syntax                                                                       1.syntax
 EXIT PROGRAM                                                      END     

2.used to mark ending of calling program,              2. Must be the last statement of the program.
if it is calling any other program, you cant end
u r calling pgm by END PROGRAM



Sunday, July 7, 2013

Differences 2


Q5) What is the difference between Structured COBOL Programming and Object Oriented COBOL programming ?
A5) Structured programming is a Logical way of programming, you divide the functionalities into modules and code logically. OOP is a Natural way of programming; you identify the objects first, and then write functions, procedures around the objects. Sorry, this may not be an adequate answer, but they are two different programming paradigms, which is difficult to put in a sentence or two. 

Q6) What is the difference between external and global variables ?
A6) Global variables are accessible only to the batch program whereas external variables can be referenced from any batch program residing in the same system library. 

Q7) Difference between next and continue clause?
A7) The difference between the next and continue verb is that in the continue verb it is used for a situation where there in no EOF condition that is the records are to be accessed again and again in an file, whereas in the next verb the indexed file is accessed sequentially, read next record command is used.

Q8) What is the difference between performing a SECTION and a PARAGRAPH ?
A8) 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. 

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

Q10) What are the differences between OS VS COBOL and VS COBOL II ?
A10) 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.