0% found this document useful (0 votes)
10 views

MF Questions

The document provides an overview of various JCL and DB2 commands, including JCL SORT utility commands for handling duplicates, unique records, and file joining. It discusses DB2 concepts such as isolation levels, cursor management, and SQL query optimization. Additionally, it covers COBOL programming techniques, VSAM file handling, and error management in CICS applications.

Uploaded by

hari babu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

MF Questions

The document provides an overview of various JCL and DB2 commands, including JCL SORT utility commands for handling duplicates, unique records, and file joining. It discusses DB2 concepts such as isolation levels, cursor management, and SQL query optimization. Additionally, it covers COBOL programming techniques, VSAM file handling, and error management in CICS applications.

Uploaded by

hari babu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Please go through topics on JCL SORT utility commands like identifying Dups,

getting unique records, joining files to get match, unmatch, reporting


capabilities, ICETOOL etc

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

Select * or Select Cols ? Advantage? - Select col is advantage as if there is any


add/modify column it will give bind issues not give accurate results

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

shorterm, longterm solution? - Isolation levels / with ur - For normal select


queries we have to use UR(uncommited Read) which will just read and doen't hold the
record for any other updates.

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

//BIND EXEC PGM=IKJEFT01


//STEPLIB DD DSN=DIS.TEST.LOADLIB,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSTSIN DD *
DSN SYSTEM(TB3)
BIND PLAN(PLANA) -
PKLIST(PACKA) -
ACQUIRE(ALLOCATE) -
ISOLATION (RS)
PARM('VALUE')
/*
when do we use Union? - to merge two or more SELECT statements it can be from
one table or multiple tables
Union - should both tables be in same structure? -
Every SELECT statement within UNION must have the same number of columns.The
columns must also have similar data types, The columns in every SELECT statement
must also be in the same order.

Can we select only specific cols to be returned in Union

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

How do you execute DB2 prog in JCL? IKJEFT01

How do you update a record in same Cursor? is it possible? WHERE CURRENT OF

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.

Have you used 49 or 88 level variable - 88 is condition elements like


constants 88 ws-vowels value "a" "e" "i" "o" "u", 49 is used for varchar
01 ws-varchar
49 vf-leng s9(04) usage comp
49 vf-string px(nn)

Have you used EVALUATE -- Evaluate is used instead of Nested if.


simple Evaluate, evaluate true, thru, multiple conditions
How do you come out of EVALUATE -- End Evaluate
What was done for Performancing tuning - to improve its speed,
efficiency, and responsiveness
Cursor with-hold for update -- With hold is used to update the same
record before closing the cursor even though we use commit
Have you encountered scenario, where you have to process high volume of data?
How much... how long it runs?
Have you used Inline perform? when? basically in looping -- starts with
perform and end-perform (execute set of pgm flows in between)

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.

Call sub-pgm using emp-no, emp-name - call by reference


call sub-pgm using by content emp-no, emp-name - call by reference

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

Alter: Modifies VSAM file attributes (cluster, path, catalogue, etc.)


Repro: Loads the VSAM dataset with data.
Listcat: Obtains VSAM dataset catalogue details.
Verify: Checks and fixes VSAM files that have not been properly closed.
Print: Prints VSAM dataset’s content.
Delete: Delete VSAM and non-VSAM datasets, as well as the catalogues

KSDS:
Organization is Indexed
access mode is seq/random/dynamic

A READ NEXT statement is used when the ACCESS MODE is DYNAMIC


READ logical-file-name
[NEXT RECORD]
[INTO ws-record-name]
[AT END statements-set1]
[NOT AT END statements-set2]
[END-READ].

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.

NULL values: -305 abend - Null indicator needed


-1 : the field is null;
0 : the field is not null;
-2 : the field value is truncated

Subscripts:Subscript is the number of occurrences of the array.


- Subscripts are used to access individual elements in an array.
- Subscripts are specified in the OCCURS clause in the array declaration.
- Subscripts are always numeric and start from 1.
- Subscripts are used to directly access elements in an array by specifying the
index number within square brackets ([]).
- Subscripts are fixed and do not change during the execution of the program unless
explicitly modified by the programmer.

01 ANY-TABLE.
05 TABLE-ELEMENT PIC X(10) OCCURS 3 TIMES VALUE "ABCDEFGHIJ"

MOVE "??" TO TABLE-ELEMENT (1) (3 : 2).

Indexes:Index represents the number of displacement positions of the array.


- Indexes are used to navigate through arrays or tables in a more dynamic way.
- Indexes are defined using the INDEXED BY clause in the table declaration.
- Indexes are typically alphanumeric and can have meaningful names.
- Indexes are used in combination with SET, ADD, and SUBTRACT statements to move
through the elements of an array or table.
- Indexes can be modified during the execution of the program to control the flow
of the program or to access specific elements in the array.

In summary, subscripts are used to directly access individual elements in an array,


while indexes are used to navigate through arrays or tables in a more dynamic way
by providing a means to control the position within the array or table.

05 TABLE-ITEM PIC X(8) OCCURS 10 INDEXED BY INX-A.


77 INX-B USAGE IS INDEX.. . .
SET INX-A TO 10 SET INX-B TO INX-A.
PERFORM VARYING INX-A FROM 1 BY 1 UNTIL INX-A > INX-B
DISPLAY TABLE-ITEM (INX-A) . . .
END-PERFORM.

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.

UNSTRING ws-string DELIMITED BY SPACE


INTO ws-str1, ws-str2
WITH POINTER ws-count
ON OVERFLOW DISPLAY message
NOT ON OVERFLOW DISPLAY message
END-UNSTRING.

REC:
Rename syntsx:
66 WS-RENAME RENAMES WS-NUM2 THRU WS-CHAR2.
77 WS-VAR2 PIC X(10) VALUE "MAINFRAMES".

01 WS-GENDER PIC X(01) VALUE 'M'.


88 MALE VALUE 'M'.
88 FEMALE VALUE 'F'.

COUNT THE NO.OF CHARACTERS:


01 VARIABLES.
05 WS-VAR PIC X(30) VALUE "HARI BABU DS)
05 WS-TALLY PIC 9(3).
05 WS-LEN PIC 9(3).
05 WS-NEWLEN PIC 9(3).

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?

NULL values: -305 abend - Null indicator needed


-1 : the field is null;
0 : the field is not null;
-2 : the field value is truncated

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy