MF Questions
MF Questions
******
Below are some reference questions
How many bytes will Comp-3 9(9).V(2) copy n/2+1
Diff btwn COPY and INCLUDE - while INCLUDE is executed at pre-compile time (by
the SQL compiler), COPY is executed at compile time(by the COBOL compiler)
******
DB2
Restart logic - commit after a certain frequency and store the last update
record in table, in the start of the program restart check should be there.
Group, Having for counts and to display only those counts that satisfy a condition
- Group by is categorizes rows with similar values into groups
SELECT
product_line,
AVG(unit_price) AS avg_price,
SUM(quantity) AS tot_pieces,
SUM(total) AS total_gain
FROM sales
GROUP BY product_line
HAVING SUM(total) > 40000
ORDER BY total_gain DESC
-911 how will you handle deadlock condition? Dead lock or timed out. Use the FOR
UPDATE clause when performing a select operation
RR : The repeatable read isolation level locks all the rows that an application
references during a unit of work (UOW)
RS : The read stability isolation level locks only those rows that an application
retrieves during a unit of work
CS : The cursor stability isolation level locks any row that is accessed during a
transaction while the cursor is positioned on that row
UR : The uncommitted read isolation level allows an application to access the
uncommitted changes of other transactions
Cursor - with hold? ---> Continue updating process after commit. The clause avoids
closing the cursor and repositioning it to the last row processed when the cursor
is reopened.
what is the advantage of using VARCHAR? is there any disadvantage of using VARCHAR
- variable lenght or long texts used for unknow lenght data storage (ex remarks,
comments/notes) performance problem might occur if the field in between col of
table, then every time it has to calculate the total space.
How do you use substring in SELECT query? SUBSTR is used for string manipulation
with column name, first position and string length used as arguments. E.g. SUBSTR
(NAME, 1 3) refers to the first three characters in the column NAME.
Have you handled new column ADD for existing table? Alter table tablename Add
new_col char (4). Run REORG
Can you declare a cursor in Procedure division? yes we can declare cursor in
procedure division
GDG
can we create different versions of file with diff length, under same Base? yes
JCL
How do you pass data to a COBOL pgm - parm, file, sysin
Assume Prod-issue, you have to skip some steps - Override condition
Approach for a Prod issue?
SoC7
SORT utility
How to check if file is empty - using IDCAMS PRINT INFILE(INPUT) CHARACTER
COUNT(1) - Empty maxcc=4, non empty maxcc = 0
How do you execute specific steps, in a set of say 10 steps - Using COND parameter
COBOL
Static call v/s Dynamic call
Difference b/w Index and Subscript. Which one is better/why? if using in
SEARCH/ SEARCH ALL Index is preferred
since the index already contains the displacement from the start of the table
and does not have to be calculated at run time.
Linkage section - How do you pass data - Call by reference and call by
content/value
In call by reference, changes made in sub-pgm will relect in main program, but in
call by content its not possible.
VSAM:
=========
DEFINE CLUSTER (NAME(ksds-file-name) -
VOLUMES(volume-serial) -
INDEXED -
RECORDSIZE (average maximum) - if both are same its FB else VB
file
[FREESPACE(CI-Percentage,CA-Percentage)] -
KEYS(length, offset) -
CISZ(number) -
DATA - (NAME(ksds-file-name.data)) -
INDEX - (NAME(ksds-file-name.index))
KSDS:
Organization is Indexed
access mode is seq/random/dynamic
COBOL-DB2 Compilatin:
=====================
The pre-compilation is done using the utility DSNHPC. In the pre-compilation step
all the SQL statements which are present in the source program are replaced by
corresponding COBOL calls. All the SQL statements are taken in an object known as
database resource module (DBRM) and passed on to the BIND step. The modified source
code is passed on to the compilation step.
In the compilation step, the modified source is compiled and the object module is
generated. The compilation is done using the utility IGYCRCTL.
The object module is then passed to the link editing step, where object module is
link edited and executable load module is generated using IEWL utility.
The DBRM which was generated in the first step is binded to a package or directly
binded to a plan. In case the DBRM is binded to a package then there is an
additional step to bind the package into a plan. The BIND is done using the utility
IKJEFT01.
01 ANY-TABLE.
05 TABLE-ELEMENT PIC X(10) OCCURS 3 TIMES VALUE "ABCDEFGHIJ"
TRIM functions is used to removed the trailing and leading spaces of the input.
MOVE Function TRIM(field) TO New-Field
MOVE FUNCTION TRIM(Field, LEADING) TO New-field
MOVE FUNCTION TRIM(Field, TRAILING) to New-FIeld.
INSPECT input-string
TALLYING output-count FOR ALL CHARACTERS
ex: INSPECT WS-STRING TALLYING WS-CNT2 FOR ALL 'A'. --> it will count all A's
in WS-STRING
INSPECT WS-STRING REPLACING ALL 'A' BY 'X'.
STRING:
STRING WS-STR2 DELIMITED BY SIZE
WS-STR3 DELIMITED BY SPACE
WS-STR1 DELIMITED BY SIZE
INTO WS-STRING
WITH POINTER WS-COUNT
ON OVERFLOW DISPLAY 'OVERFLOW!'
END-STRING.
REC:
Rename syntsx:
66 WS-RENAME RENAMES WS-NUM2 THRU WS-CHAR2.
77 WS-VAR2 PIC X(10) VALUE "MAINFRAMES".
PROCEDURE DIVISION.
COMPUTE WS-LEN = LENGHT OF WS-VAR
INSPECT WS-LEN TALLYING WS-TALLY FOR ALL ' '.
COMPUTE WS-NEWLEN = WS-LEN - WS-TALLY.
DISPLAY "ACTUAL LENGHT OF CHARACTERS: " WS-NEWLEN.
SORT:
SORT FIELDS = COPY
JOINKEYS FILE=F1,FIELDS=(15,2,A,7,4,A)
JOINKEYS FILE=F2,FIELDS=(21,2,A,23,4,A)
REFORMAT FIELDS=(F2:1,70,F1:1,60)
JOIN UNPAIRED,F1 - Both Files Matching Records + Non Matching from File1
(Left outer join)
JOIN UNPAIRED,F1,ONLY - Non Matching from File1
JOIN UNPAIRED,F1,F2 - Both Files Matching Records + Non Matching from both
files
SORT FIELDS=(1,7,CH,A) - Remove duplicates
SUM FIELDS=NONE
============================~~~~~~~~~~~~~~~~~~~~~~~~~==========================~~~~
~~~~~~~~~~~~~~~~~~~~~====================================
============================~~~~~~~~~~~~~~~~~~~~~~~~~==========================~~~~
~~~~~~~~~~~~~~~~~~~~~====================================
CICS
Diff between link and XCTL
How do you pass data between CICS programs
What are the basic system tables (PCT, PPT,KCT,TCT, FCT, RCT)
What is TSQ, TDQ ? - DFHCOMMAREA
How to read files? Can you read normal files or just VSAM files.
What is trigger level
What is SYNCPOINT?
What is hard restart/Soft restart?
What is ASRA error?
What is CICS handle?