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
No comments:
Post a Comment