0% found this document useful (0 votes)
30 views44 pages

Allmf

1. JCL (Job Control Language) is a set of control statements that provides specifications to process a job and acts as an interface between programs and the MVS operating system. 2. Procedures allow grouping of JCL statements to perform a particular function and help minimize duplication of code and probability of errors. Common procedures include instream, cataloged, and included procedures. 3. Key JCL statements include JOB, EXEC, DD, PROC, PEND, and INCLUDE. Parameters like REGION, TIME, MSGCLASS, and DISPOSITION provide additional controls and specifications for job execution.

Uploaded by

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

Allmf

1. JCL (Job Control Language) is a set of control statements that provides specifications to process a job and acts as an interface between programs and the MVS operating system. 2. Procedures allow grouping of JCL statements to perform a particular function and help minimize duplication of code and probability of errors. Common procedures include instream, cataloged, and included procedures. 3. Key JCL statements include JOB, EXEC, DD, PROC, PEND, and INCLUDE. Parameters like REGION, TIME, MSGCLASS, and DISPOSITION provide additional controls and specifications for job execution.

Uploaded by

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

Purpose of jcl

JCL stands for Job Control Language. It is a set of control statements which provides

the specifications necessary to process a job. It is a interface between programs & MVS

operating system.

2) procedure

The JCL Procedures are set of statements inside a JCL grouped together to perform a

particular function

Reusability is the form of procedure. Any jcl code in dataset reuse the same jcl

code in another dataset

Helps us to minimize the duplication of code probility of error.

3) control intervel,

Area where records srored.one control will have a multiple records and control

information.

More than one record where logical records stored control intervel

control area-

Area where all your control intervels are stored

Every record will be stored in control interval

4) alternative index

An alternate index is a file that allows access to a VSAM dataset by a key other than

the primary one.

5) msgclass ,

MSGCLASS is used to specify the format of the output. This means that

MSGCLASS defines the output device to which the system messages and JCL related

messages are written and printed..

msg level

MSGLEVEL to inform the JCL about the messages that we need to print and to

specify the device in the MSGCLASS parameter.

,class

JCL CLASS Parameter is a Keyword Parameter and CLASS Parameter defines an input

CLASS in of a schedule JOB. It is used to tell the operating system about the nature of
the job which we are submitting.

6) access mode

Used to store and retrieve a data

 Sequential Access

 Random Access

 Dynamic Access

7) organization in cobol

 Sequential File Organization

 Indexed Sequential File Organization

 Relative File Organization

8) steplib

A STEPLIB statement is used in order to identify the location of the program to be

executed within a Job Step. The STEPLIB statement is specified after the EXEC statement

and before the DD statement of the job step.

Joblib

JOBLIB statement is used in order to identify the location of the program to be

executed in a JCL. The JOBLIB statement is specified after the JOB statement and before

the EXEC statement. This can be used only for the in stream procedures and programs

Diff between steplib and joblib

JOBLIB tells z/OS to search the private libraries for each step in the job. STEPLIB

tells z/OS to search the private libraries only for one step.

include

Use the INCLUDE statement to: Identify the name of the member of a partitioned data

set (PDS) or partitioned data set extended (PDSE) that contains a set of JCL statements

(such as DD and OUTPUT JCL statements) called an INCLUDE group.

9) extend mode file open

Extend mode is used to append records in a sequential file. In this mode, records are

inserted at the end. If file access mode is Random or Dynamic, then extend mode cannot

be used

10) keys used in RRDS Or not


NOT

Extend mode and access mode

2)file handling & it's statements

 Open

 Read

 Write

 Rewrite

 Delete

 Start

 Close

Statements-

Imperative statement

Conditional statement

Compiler directing statements

3)positional parameter

Parameters help the JES to decide about the priority of the Job, the class to which,

the job will belong, maximum CPU time that can be allocated to the job, accounting

information of the jobs and much more. The Parameters defined in the 'JOB card' are

automatically applied to each step of the JCL

4)disposition(normal&abnormal disposition)

1. CS – It denotes the Current Status. The allowed values are

– NEW, OLD, SHR, MOD

2. ND – It denotes Normal Disposition. The allowed values are

– CATLG, UNCATLG, KEEP, PASS and DELETE. If a step terminates normally

(without any ABEND), then we have to code that what needs to be done with

that dataset. If a step terminates normally (without any ABEND), then we

have to code that what needs to be done with that dataset.

3. AD – It denotes Abnormal Disposition. If a step terminates


Abnormally(ABEND), then we have to define, what needs to be done with the

dataset. The allowed values are – KEEP, DELETE, CATLG, and UNCATLG

5)inrec & outrec

INREC: Specifies how records are reformatted before they are sorted, copied, or

merged. INREC is useful in case of large input file.

OUTREC: Specifies how records are reformatted after they are sorted, copied, or

merged. Final output will be the same

6)file status error in 35?

The status code was 35. An OPEN statement with the INPUT, I-O, or EXTEND

phrase was attempted on a nonoptional file that was unavailable. This usually means

the DD name you specified in your COBOL program does not match the DD name specified

in the JCL.

8)what is vsam?

Virtual storage access method

An interface between your application

Vsam is only stored in dasd

Vsam datasets accessed via batch application as well as online application

9)index component

 Index Component contains the index part. Index records are present in Index

component. Using index component VSAM is able to retrieve records from the

data component.

 Data Component contains the data part. Actual data records are present in

Data component.

Symbolic parameters-used to address data name

The parameters DSNAME and DATAC can be coded with different values while

calling the procedure and these are called as symbolic parameters. The varying input to

the JCL such as file names, datacards, PARM values, etc., are passed as symbolic

parameters to procedures.

Diff bwn abend and return code

Return Code gives you the status of executed step while Abend Code gives you the reason for

what the step failed


What is jes..?

JES is the component of the operating system that provides supplementary job

management, data management, and task management functions such as scheduling,

control of job flow

Keyword parameters like typrun region

JCL TYPRUN=SCAN

This is used to scan the JCL for any syntax error without actually allocating any resources

for the job.

JCL TYPRUN=HOLD

JCL TYPRUN=HOLD Parameter is used to avoid any deadlock.

What if we dont give msg class and msg level-

system will generate value

Why we use jcl and cobol-

JCL is the command language of the Mainframe. It identifies the program to be executed,

the inputs that are required and location of the input/output and informs the Operating

System through Job control statements. In short, you use JCL to execute your COBOL

program

Length of temproary dsn name

ampersands (&&) followed by a character string 1 to 8 characters in length

Type of procedures

Instream Procedure

When the procedure is coded within the same JCL member, it is called an Instream

Procedure. It should start with a PROC statement and end with a PEND statement.it issues

n number of job

Catalog procedure.

Procedure included from another place called as catalog procedure. A procedure that

catalogued in a library called catalogue procedure.procedure always defined outside of jcl.

Type of statementsInclude

Proc
Pend

Exec

Jcllib

Dd

Lib that is used while calling procedure-

jcllib

What is notify-

used to inform a TSO user when this job terminates either normally or

abnormally.

What is dynamic access-

Dynamic access supports both sequential and random access in the same program. With

dynamic access, one file definition is used to perform both sequential and random

processing like accessing some records in sequential order and other records by their keys.

JCL-JOB CONTROL LANGUAGE

1. What is JCL?

JCL stands for Job Control Language. It is the command language

of Multiple Virtual Storage (MVS). It is the normally used in

Operating System in the IBM Mainframe computers.

2. What are the benefits of using JCL?

IT CAN BE USED FOR DELETING, CREATING A WIDE RANGE OF

DATA SETS, VSAM CLUSTERS AND GDG’S

CAN BE USED FOR COMPARING FILES WITH DIFFERENT PDS

MEMBERS

IT CAN BE USED FOR MERGING AS WELL AS SORTING VARIOUS

DATA FILES

3. Explain different types of Job control statements or JCL

statements. (MAX LIMIT 255)

JOB-- FIRST CONTROL STATEMENT IN JCL .IT GIVES THE IDENTITY

OF THE JOB TO THE OPERATING SYSTEM.

EXEC—THE EXECUTION STATEMENTS SPECIFIES THE PROGRAM


THAT NEEDS TO BE EXECUTED.

DD—DATA DEFINITION DEFINE THE DATA SETS THAT A

PROGRAM USES WHEN IT RUNS.

4. State the difference between positional parameter and keyword

parameter in JCL.?

POSITIONAL PARA- THESE ARE TWO TYPES 1).ACCOUNTING

INFORMATION 2).PROGRAM NAME

KEYWORD PARA – CLASS, MSGCLASS, MSGLEVEL, NOTIFY,

REGION, TIME, TYPRUN, RESTART, COND.

COND AND REGION BOTH CAN BE USED IN JOB AND EXEC

STATEMENT.

5. What are different parameters for DD (Data Definition)

statement?

DSN(DATA SET NAME), DISP(DISPOSITION), DCB(DATA CONTROL

BLOCK), SPACE, UNIT

6. State difference between JOBLIB and the STEPLIB statements.

JOBLIB – IT IS USED TO IDENTIFY THE LOCATION OF THE

PROGRAM TO BE EXECUTED IN A JCL. IT CANNOT BE PLACED IN A

CATALOGED PROCEDURE.

STEPLIB – IT IS USED TO IDENTIFY THE LOCATION OF THE

PROGRAM TO BE EXECUTED WITHIN A JOB STEP.

7. Explain MSGLEVEL parameter and its significance.

IT SPECIFIES WHAT TYPE OF MESSAGE SHOULD BE PRINTED

WHICH ARE DEFINED IN MSGCLASS THE OUTPUT MODE.

8. What is the time parameter in JCL? Explain what does TIME=1440

mean?

IT SPECIFIES THE MAXIMUM CPU USAGE TIME ALLOWED FOR

THE JOB TO EXECUTE.

TIME PARAMETER CAN BE CODED AT THE JOB LEVEL AND STEP

LEVEL TOO.

9. What are the hierarchy levels in JCL?


NAME, FIELDS, OPERATIONS, OPERANDS, PARAMETERS, 1-

POSITIONAL, 2-KEYWORD, COMMENTS.

10.What is the meaning of DISP=OLD and DISP=SHR?

DISP=OLD NO OTHER USER CAN ACCESS THE DATA SET UNTIL

YOU ARE FINISHED USING IT.

WE GENERALLY REQUEST OLD ACCESS WHEN YOU WANT TO

MODIFY THE DATA SET

DISP=SHR USER CAN ACCESS THE DATASET WHILE YOU ARE

USING IT. YOU GENERALLY REQUEST SHR ACCESS WHEN YOU

WANT TO READ DATA, NOT MODIFY IT.

11. What do you mean by Condition checking in JCL?

IT IS USED TO SKIP THE STEP. IF THE TEST IS EVALUATED TO BE

TRUE, THE CURRENT JOB STEP EXECUTION IS BYPASSED.

12. What does a disposition of (NEW, CATLG, DELETE) mean?

IT IS USED FOR NEW FILE CREATION.

13. Explain utilities in JCL.

IEFBR14 – TO CREATE DUMMY UTILITY

IEBCOPY – TO COPY AND MERGE THE DATASETS

IEBGENER – TO COPY ONLY PS FILES

IDCAMS – USUALLY USED TO MANAGE VSAM DATASETS SUCH

AS CREATE, DELETE, RENAME, CATALOG, UNCATALOG DATASETS

14. Explain the usage of class parameters in JCL.

IT IS USED TO TELL THE OPERATING SYSTEM ABOUT THE NATURE

OF THE JOB WHICH WE ARE SUBMITTING.

SYNTAX – CLASS=JOB-CLASS

15. What do you mean by PROC?

PROC STATEMENT TELLS THE BEGINNING OF A PROCEDURE. THERE

ARE 2 PROCEDURES

CATALOGED AND INSTREAM PROCEDURE

16.State difference between an instream and a catalogued Proc.

INSTREAM PROCEDURE – LOCATED IN SAME JOB. DEFINING WILL


BE DONE USING THE FOLLOWING SYNTAX

//PROC-NAME PROC

//STATEMENT

//PEND

PEND STATEMENT IS USED TO END THE PROCEDURE.

* INSTREAM PROCEDURE SHOULD BE DEFINES BEFORE ANY EXEC

STATEMENT DEFINED.

CATALOGED PROCEDURE – IT WILL BE CODED OUTSIDE THE JOB.

PEND IS NOT MANDITORY. CAN HAVE MAXIMUM 255 STEPS

CALLING FUNCTION - //*CALLING CATALOGE PROCEDURE

//STEP EXEC PROC=CATPROC

17. What does a disposition of (MOD, DELETE, DELETE) mean?

DELETING POSSIBLY – NONEXISTENT DATA SETS

18. If you have seven jobs to do, but you want to hold one at the

same time, how can I accomplish this?

GIVE HOLD PARA IN JOB STATEMENT AND STEP NAME.

19. Explain how you will check the syntax of JCL without running it.

TYPERUN=SCAN OR JSCAN

20. What do you mean by abends in JCL? Write different JCL abend

codes.

S806 – LOAD MODULE NOT FOUND (INPUT AND OUTPUT FILES)

S0C4 – INDEX EXCEEDS THE SIZE OF TABLE

SB37, SD37, SE37 – INSUFFICIENT DISK SPACE

21. How can you check if a file is empty using JCL?

USING ICETOOL UTILITY

SYNTAX - //EMPTYCHK EXEC PGM= ICETOOL

22. What is the purpose of coding NOTIFY parameter in job

statement?

NOTIFY- USED TO INFORM A TSO USER WHEN THIS JOB

TERMINATES EITHER NORMALLY OR ABNORMALLY

23. What is the use of symbol // in JCL? (/*- END OF THE STREAM
DATA)

IDENTIFIERS – IDENTIFIER FIELD INDICATES TO THE SYSTEM THAT

A STATEMENT IS A JCL STATEMENT RATHER THAN DATA

24.Which utility is used a dummy utility?

IEFBR14 – NO OPERATION UTILITY

25. Which utility is used to sort a file in JCL?

SORT UTILITY –IT IS A POWERFUL IBM UTILITY USED TO COPY,

SORT, MERGE DATASETS

26. Does JCL support automatic restart?

IF A STEP RESTART IS DESIRED, THE RD PARAMETER MUST BE

CODED TO REQUEST THE RESTART

27. A JCL has 4 steps and job abends in step2. How to restart the job

from step2?

SPECIFY RESTART = STEP2 IN JOB STATEMENT

GDG

1. What is a Generation Data Group (GDG)?

A GENERATION DATA GROUP IS A COLLECTION OF HISTORICALLY

RELATED NON VSAM DATASETS THAT ARE ARRANGED IN

CHRONOLOGICAL ORDER

2. Which utility is used to create GDG base?

IDCAMS UTILITY

3. A GDG was created with EMPTY option with the limit of 5. If the

current generation is 5 and a new generation to be created, then

what will be the new generation created and how many

generations can be seen?

ONLY 1 GENERATION CAN BE SEEN,BECAUSE WHEN THE LIMIT IS

REACHED IT DELETES All THE PREVIOUS GENERATION

4. Why do we need to use a GDG?

EACH DATASET IS HISTORICALLY RELATED TO THE OTHERS IN THE

GROUP, WITHIN A GDG, THE GENERATIONS CAN HAVE LIKE OR

UNLIKE DCB ATTRIBUTES AND DATASET ORGANIZATIONS.


5. List the PARAMETERS used to create GDG.

NAME-NAME OF GDG BASE

LIMIT-TO LIMIT THE MAX NO. OF GENERATIONS

EMPTY/NOEMPTY

SCRATCH/NOSCRATCH

6. Difference between EMPTY and NOEMPTY?

EMPTY-SPECIFIES THAT ALL THE GENERATION SETS ARE TO BE

UNCATALOGED WHEN MAX IS EXCEEDED

NOEMPTY- (IT WILL NOT EMPTY THE GDG VERSIONS, RATHER IT

WILL DELETE THE OLD VERSIONS OF GDG)

SPECIFIES THAT ONLY THE OLDEST GENERATION DATA SET IS TO BE

UNCATALOGED WHEN MAX IS REACHED

7.How to delete GDG Base?

BY USING DELETE COMMAND IN IDCAMS UTILITY

8.Difference between SCRATCH and NOSCRATCH

SCRATCH-IT WILL SCRATCH THE OLDER VERSIONS OF THE GDG,

GIVING SPACES FOR NEWER VERSIONS

NOSCRATCH-IT WILL NOT DELETE THE GDG VERSIONS WHEN THE

MAX NO. OF VERSIONS FOR THE GDG IS REACHED

VSAM

1. What are the different types of VSAM datasets?

ESDS (ENTRY SEQUENCED DATA SET)

KSDS (KEY SEQUENCED DATA SET)

LDS (LINEAR DATA SET)

RRDS (RELATIVE RECORD DATA SET)

2. What are the Commands in VSAM?

ALTER, REPRO, LISTCAT, EXAMINE, VERIFY

3. What is AIX?

ALTERNATE INDEX (AIX) – IT IS USED TO DEFINE THE

ALETERNATE INDEX AND SPECIFY PARAMETER ATTRIBUTES FOR

ITS COMPONENTS.
4. What is Control Area?

IT IS FORMED BY PUTTING TOGETHER TWO OR MORE CONTROL

INTERVALS.

5. What is Control Interval?

IT IS UNIT OF DATA THAT IS TRANSFERRED WHEN AN I/O

REQUEST IS MADE BETWEEN AUXILIARY STORAGE AND VIRTUAL

STORAGE

6. What is Offset?

IN THIS CASE THE KEY IS HAVING OFFSET OF 0 WHICH MEASN

THAT THE DISTANCE FROM STRING POSITION OF THE KEY IS 0

7. What is mean by KEY in KSDS?

KEY GIVES INFO ABOUT THE PRIME KEY FIELD OF A KEYSEQUENCED DATA SET’S DATA RECORDS

8. How do you copy PS to VSAM file?

STEP 1- COPY PS FILES FROM THE PC TO HOST USING FILEZILLA

OR ANY OTHER FTP

STEP 2- CREATE A JCL PROGRAM TO COPY THE PS FILE DATA

INTO VSAM FILE

STEP 3- SAVE AND SUBMIT THE JCL TO LOAD DATA INTO THE

VSAM FILE

9. Which command is used to take backup in VSAM?

DUMP AND RESTORE COMMANDS,

10.How do you print a Particular data in VSAM?

IDCAMS(not exactly)

COBOL

1. What are the available data types in the COBOL language?

NUMERIC, ALPHABETS, ALPHANUMERIC

2. What are the different divisions in COBOL programs?

IDENTIFICATION DIVISION

ENVIRONMENT DIVISION

DATA DIVISION

PROCEDURE DIVISION
3. What is COBOL?

COMMON BUSINESS ORIENTED LANGUAGE. IT IS A

PROGRAMMING LANGUAGE FOR BUSINESS APPLICATIONS.

4. Important division in COBOL?

IDENTIFICATION DIVISION-PROGRAM NAME & PARAMETERS

ENVIRONMENT DIVISION- TO DEFINE DATASET IN PROGRAM

DATA DIVISION-PROVIDE COMPLETE DETAILS OF DATASETS

FILE SECTION-DETAILS OF FILE LAYOUT

WORKING STORAGE- DEFINE VARIABLES

LINKAGE SECTION-TO LINK THE PROGRAMS

PROCEDURE DIVISION- USED TO WRITE LOGICS AND IT IS ACTUAL

CODING SECTION

5. What is meant by IS NUMERIC clause?

NUMERIC CLAUSE IS USED TO CHECK WEATHER ANY ITEM IS

NUMERIC OR NOT.

NUMERIC CAN BE USED ON ALPHANUMERIC ITEM, SIGNED

NUMERIC &EMP; PACKED DECIMAL ITEMS AND UNSIGNED

NUMERIC &EMP; PACKED DECIMAL ITEMS, IT MAY CONTAIN 0-9,

+ AND -

6. What is level 66 and level 88 in COBOL?

66 IS RENAME CLAUSE ITEMS.

88 IS CONDITION NAME ENTRY.

7. What is the difference between performing a SECTION and a

PARAGRAPH?

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.

8. Why Identification division is important?

IT IS USED TO IDENTIFY THE PROGRAM BETWEEN THE

PROGRAMMER AND THE COMPILER.


9. What is Elementary Level Number?

IT IS USED TO SPECIFY THE LEVEL OF THE DATA IN A RECORD.

10. What is Pic 9v99 Indicates?

A THREE POSITION NUMERIC FIELD WITH AN ASSUMED DECIMAL

POINT AFTER THE FIRST POSITION. V MEANS AN IMPLIED

DECIMAL POINT.

11. How many Sections are there in Data Division?

SIX SECTIONS – FILE SECTION, WORKING STORAGE SECTION,

LOCAL STORAGE SECTION, SCREEN SECTION, REPORT SECTION

AND LINKAGE SECTION

12. How arrays can be defined in COBOL?

COBOL USES OCCURES CLAUSE TO DEFINE A ARRAY

13.What is 77 level used for?

IT IS USED TO DECLARE THE INDIVIDUAL ELEMENTARY DATA

ITEMS

14.Where do you declare a file and how?

WE NEED TO USE FILE-CONTROL PARAGRAPH IN THE

ENVIRONMENT DIVISION.

15.What are types of organization?

SEQUENTIAL FILE ORGANIZATION

INDEXED SEQUENTIAL FILE ORGANIZATION

RELATIVE FILE ORGANIZATION

16.What are the types of access mode?

SEQUENTIAL ACCESS

RANDOM ACCESS

DYNAMIC ACCESS

17.How to access a file?

THE ACCESS MODE IS USED TO DEFINE THE ACCESSING WAY OF

THE FILE BASED ON THE REQUIREMENTS IN THE PROGRAM. IN

SHORT, WE CAN SAY, ACCESS MODE DEFINES HOW THE DATA IS

REQUIRED TO READ AND WRITE FROM THE FILE


18.Write about the Error codes in COBOL?

Code Statements Description of the Code

17 READ Record error: probably zero length. (Micro Focus only)

18 READ Read part record error: EOF before EOR or file open in wrong mode (Micro

Focus only).

19 REWRITE Rewrite error: open mode or access mode wrong (Micro Focus only).

20 OPEN Device or resource busy (Micro Focus only).

00- ALL -SUCCESSFUL COMPLETION

01- NOT A VALID FILE STATUS KEY

02- DUPLICATE KEY

04- RECORED LENGTH MISMATCH

05- MISSING OPTIONAL FILE

10- END OF FILE

19.What is the Error code for end of the Record?

CODES BEGINNING WITH a ‘1’ ARE CONSIDERED AT END

MESSAGES

DB2

1. What is a Database?

COLLECTION OF DATA SUPPORTING DATA STRUCTURE AND TOOLS

TO MANAGE IT.

2. What is DB2?

IT IS A DATABASE PRODUCT FROM IBM. IT IS A RDBMS WHICH IS

DESIGNED TO STORE, ANALYZE AND RETRIVE THE DATA

EFFECIENTLY.

3. What are the different types of languages in SQL?

DDL(DATA DEFINITION LANGUAGE), DML(DATA MANIPULATION

LANGUAGE), DCL(DATA CONTROL LANGUAGE), TCL(TRANSCATION

CONTROL LANGUAGE), DQL(DATA QUERY LANGUAGE).

4. Explain some tasks that come under DDL. (DATA DEFNITION

LANG)

CREATE – TO CREATE OBJECTS


ALTER – TO MODIFY THE STRUCTURE

DROP – TO DELETE OBJECTS (TABLE)

TRUNCATE – TO REMOVE ALL THE RECORDS FRM THE TABLE

WITHOUT DISTURBING THE TABLE STRUCTURE

RENAME – TO RENAME THE TABLE

COMMENT – COMMENT ON THE DATA DICTIONARY.

5. Explain some tasks that come under DML. (DATA MANIPULATION

LANG)

INSERT, DELETE, UPDATE, SELECT.

6. Explain some tasks that come under DCL. (DATA CONTROL LANG)

GRANT- TO GIVE ACCESS

REVOKE – TO REMOVE THE ACCESS

7. Explain some tasks that come under TCL. (TRANSCITION

CONTROL LANGUAGE)

COMMIT – TO SAVE THE TRANSCITION

ROLLBACK- TO RESTORE THE DATA BASE TO ORIGINAL SINCE THE

LAST COMMIT

SAVE POINT – TO SAVE THE EXISTING DATA AT ONE POINT

8. What are the different data types available in DB2?

INTEGERS, CHARACTERS, STRINGS, FLOATING POINT NUMBERS,

ARRAY (SET OF IDENTICAL DATA ELEMENTS)

9. What does SPUFI stands for?

SQL PROCESSOR USING FILE INPUT

10.What is the difference between CHAR and VARCHAR?

CHAR- IT IS USED TO STORE STRING WITH FIXED LENGTH

VARCHAR – IT IS USED TO STORE STRING THAT HAVE A VARYIG

LENGTH

11.What is the difference between the above two queries i.e.

DELETE and DROP?

DELETE – TO DELETE SPECIFIC ROW FROM A TABLE

DROP – TO DELETE THE WHOLE TABLE FROM THE DATA BASE.


12.What is concurrency in terms of DB2?

WHICH ENABLES MORE THAN ONE APPLICATION TO

SAME DATABASE AT SAME TIME

13.What is a CURSOR and What is the use of it?

IT IS USED TO PERFORM MULTIPLE OPERATIONS ROW BY ROW

AGAINST A RESULT SET

14.What is DCLGEN in DB2? (DECLARATION GENERATOR)

IT IS A TOOL THAT IS USED TO GENERATE COBOL COPYBOOK FOR

DB2 TABLE CONTAINS HOST VARIABLES.

15.What is SQLCA? (SQL COMMUNICATION AREA)

IT IS A COLLECTION OF VARIABLES THAT IS UPDATED AT THE END

OF THE EXECUTION OF EVERY SQL STATEMENT

16. What is the maximum length of SQLCA?

136

17. In a COBOL-DB2 program, where are all the SQL statements

coded?

AREA B

18. When do you use LIKE statement?

TO SEARCH FOR A SPECIFIED PATTERN IN A COLUMN

19. Write the query to delete all the rows from a table.

DELETE FROM table_name WHERE column_name BETWEEN

value 1 AND value 2

20. What is the physical storage length of TIMESTAMP data type?

3 BYTES

21. What is the physical storage length of DATE data type?

4 BYTES

22. In a COBOL-DB2 program where can we declare a cursor?

WORKING STORAGE OR PROCEDURE DIVISION

23.When you will face SQLCODE -818?

TIMESTAMP MISMATCH BETWEEN PLAN AND LOAD

MODULE.
24.When you will face SQLCODE -922?

AUTHORIZATION NEEDED (PERMISSION NEEDED)

25. you will face SQLCODE -911?

DEADLOCK (TIME OUT) WITH ROLLBACK.

26.When you will face SQLCODE -803?

AN INSERTED OR UPDATED VALUE IS INVALID BECAUSE THE

INDEX IN INDEX SPACE.

27. What does a positive SQL code indicates?

+100 A SUCCESSFUL EXECUTION WITH WARNING

28. Which statement is used to revoke the access from a

database?

REVOKE STATEMENT

29. In which statement you can define primary key?

CREATE TABLE STATEMENT OR ALTER TABLE

30. How many primary keys can be declared on a table?

ONE

31. Write a query to delete a table from database.

DROP TABLE TABLE_NAME

32. What is the maximum size of a CHAR data type in DB2?

255 BYTES

33. What is the maximum size of a VARCHAR data type in DB2?

4046 BYTES OR 2000 CHARACTERS

//CUSTJB01 JOB (990A5,'25/06/19',ACNTCR),'MAHENDER',MSGCLASS=D, --> job statement / Job


card. Only 1 job card in a jcl.

// CLASS=A,PRTY=15,TIME=10,NOTIFY=&SYSUID,MSGLEVEL(1,1) --> job


statement / Job card

//***************************************************************** --> comment

//* JOB TO RUN THE PGM CUSTR001 --> comment

//*************************************************************** --> Comment

//STEP01 EXEC PGM=CUSTR001 --> 255 EXEC statement / Step card.

//STEPLIB DD DSN=CUST.PR.LOADLIB,DISP=SHR --> 3243 DD statement.

//CUSTIN DD DSN=CUST.FL.EXT.IN01,DISP=SHR
//CUSTOUT DD DSN=CUST.FL.EXT.RPT01,UNIT=SYSDA,

// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE),

// DCB=(RECFM=FB,LRECL=40,BLKSIZE=0)

//SYSPRINT DD SYSOUT=*

//SYSOUT DD SYSOUT=A

//

ABEND:-> job failed execution.

//* --> comment.

//name operation operands(optional parameters)

coding should be between 1-72. if your code exceeds, then continue in next line. type cols in
command line and press enter to check the number of columns.

job statement:

//

name (job name) : can be upto 8 bytes/characters. it should always start with alphabet.
numbers/special character($,#,@) can be at the end.

operation: JOB

operands/parameters:

Accounting information: Accpunt ID to which resource usage charges are charged. (accounting
information), (*)--> charge will be applied to user's mainframe ID.

USername: your name. MAx 20 characters.

MSGCLASS: A-->Z, 0-->9. --> every msg class is mapped to a device where job messages are routed.

CLASS: A-->Z, 0-->9 --> tells mainframe OS to set the priority

PRTY: 0-15, 15: highest priority. Decides the priority for a particular class of job.

MSGLEVEL (x,y) : X: 0-->2, Y: 1/2 --> MSGLEVEL (1,1): is most preferred or used. specifies what
information to be displayed in the job logs.

X: 0 : job statement will be displayed

1 : All statement will be displayed, JOB/JCL,JES and procedures will be displayed

2 : JCL and JES statement.


Y: 1: all jcl/jes/files/step execution messages will be displayed

0: only step messages messages will be displayed.

TIME: decides till what time you job will run. time=Value (minutes), TIME=1440/MAX/NOLIMIT-->
Your job will conitune to run without any time limit untill it completes execution by it's own.

if value of the time parameter is exceeded while the job is running/executing, then job
fails/abends with s322 error.

NOTIFY:

NOTIFY=mainframeID --> display the execution message on screen of the RACFID(mainframeID)


whose RACF ID is mentioned in notify

NOTIFY=&SYSUID --> display the execution message on screen of the RACFID(mainframeID) who
submitted the job. This is more preferred.

REGION: Specifies the amount of storage your job requires.

REGION = <numeric value between 1 to 2096128>.

REGION=OM: preferred and most comonly used. MAinframe OS allocated the available
memory/virtual storage space to the job.

REGION is not available:-S822 return code/error code.

REGION is not sufficient:- S804/S80A

TYPRUN: (very rarely used): used to check syntax error before executing job.

TYPRUN=SCAN: checks the error before execution of jcl

TYPRUN=HOLD: Checks syntax error and job is put on hold.

TYPRUN=JCLHOLD: checks for syntax error during execution of job

EXEC statement: execute program (user written cobol/cobol-db2 or IBM utility program) or
catalogued procedure.

//

name : name of your choice, should not be more than 8 characters. Must begin with alphabet. name
should be unique in a jcl.

EXEC : should be written as it is.


//STEP01 EXEC PGM=CUSTR001 * if you want to execute a program, PGM=<program name>

//STEP01 EXEC PROC=PROC001 * if you want to execute a catalogued procedure,


PROC=<catalogued procedure name>.

//STEP01 EXEC CUSTR001 * in some version of MF, PGM= / PROC= can be skipped.

just mention the program or procedure name in front of EXEC


amd MF will identify whether it is a program or a procedure.

optional parameters / operands:

PARM = <values you want to pass to your program>. --> this is used when you want to pass some
value from your JCL to your program.

REGION = <value> / OM

TIME = <value>

COND --> this parameter is used to determine whether or not we execute a


particular STEP in a jcl.

Step return codes:

00: Step is successfull

04: Step is successfull but there are some warnings

08: Step execution failed with error

12: Step execution failed with fatal/severe error

16: Step execution failed with fatal/severe error

operators: =, !=, >, < (equal to, not equal to/NE, GT, LT)

COND (<Return code> <operator> <Stepname>) --> this is used to execute or skip a particular step of
a job.

if the condition mentioned under COND is true then that particular Step
will not execute.
COND=ONLY --> the step will execute only if the previous step fails.

COND=EVEN --> step will execute irrespective of the previous step failed or not

//CUSTJB01 JOB (990A5,'25/06/19',ACNTCR),'MAHENDER',MSGCLASS=D, --> job statement / Job


card. Only 1 job card in a jcl.

// CLASS=A,PRTY=15,TIME=10,NOTIFY=&SYSUID,MSGLEVEL(1,1) --> job


statement / Job card

//JOBLIB DD DSN = CUST.PR.LOADLIB, DISP=SHR

//***************************************************************** --> comment

//* JOB TO RUN THE PGM CUSTR001 --> comment

//*************************************************************** --> Comment

//STEP01 EXEC PGM=CUSTR001 --> 255 EXEC statement.

//CUSTIN DD DSN=CUST.FL.EXT.IN01,DISP=SHR

//CUSTOUT DD DSN=CUST.FL.EXT.RPT01,UNIT=SYSDA,

// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE),

// DCB=(RECFM=FB,LRECL=40,BLKSIZE=0)

//SYSPRINT DD SYSOUT=*

//SYSOUT DD SYSOUT=A

//*

//STEP02 EXEC PGM=CUSTR002, COND (04 = STEP01) --> STEP 02 will not execute if
the RC of STEP 01 is 04.

//CUSTIN DD DSN=CUST.FL.EXT.IN01,DISP=SHR

//CUSTOUT DD DSN=CUST.FL.EXT.RPT01,UNIT=SYSDA,

// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE),

// DCB=(RECFM=FB,LRECL=40,BLKSIZE=0)

//SYSPRINT DD SYSOUT=*

//SYSOUT DD SYSOUT=A

//*
//STEP03 EXEC PGM=CUSTR003 , cond= only --> STEP03 will run only if STEP 02
failed (RC=>008)

//CUSTIN DD DSN=CUST.FL.EXT.IN01,DISP=SHR

//CUSTOUT DD DSN=CUST.FL.EXT.RPT01,UNIT=SYSDA,

// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(1,1),RLSE),

// DCB=(RECFM=FB,LRECL=40,BLKSIZE=0)

//SYSPRINT DD SYSOUT=*

//SYSOUT DD SYSOUT=A

//

DD statement: Is where you will pass the actual/physical files in the JCL which will be used by
programs.

In the cobol program, you will use the logical file name / DD name.

//

DD name (logical file name). This DD name should be passed to the cobol program.

DD

DSN= --> DataSet name. Here you will pass your physical/actual dataset/file.

Physical dataset name.--> length of dataset shoulnot be more that 44 characters. and one word
should not be more than 8 characters.

based on usage of the dataset: we classified the dataset as Input dataset and output dataset.

Parameters.

1. DISP (DISPOSITION) --> Status of the dataset upon execution of a step.

DISP = (<current status>, <status at successfull execution of step>, <Status at abend of step>)

If Dataset is a input dataset, DISP = SHR / DISP = OLD,

IF Dataset is output dataset, DISP = (<current status>, <status at successfull execution of step>,
<Status at abend of step>)

1st value of DISP: Current status:


SHR --> dataset is present in the system and you job can use it without exclusive access. (preferred to
use) --> I/P dataset

OLD --> dataset is present in the system but you job can use it only with excluseive access. (not
preferred to use) --> I/P dataset

NEW --> dataset is not present in mainframe and your jcl will have to create a new dataset. --> O/P
dataset

MOD --> MF will check if the dataset is present. if Dataset is not present, then job will create a new
dataset.

and if the dataset is present, then you job will modify the existing dataset.--> O/P dataset

//CUSTOUT DD DSN=CUST.FL.EXT.RPT01,

// DISP=(NEW,CATLG,DELETE),

2nd value of DISP: status at successfull execution of step.

CATLG (catalog) --> retain the dataset which is created and add an entry in the catalog.

UNCATLG (uncatalog) --> delete the dataset and remove the entry from catalog.

DELETE --> Delete the datset, but the catalog entry remains.

PASS --> this is used for a specific type of dataset which is 'temporary dataset' Dataset is
passed between subsequent steps in the jcl.

(//CUSTOUT DD DSN=&&TEMP, --> example of temporary dataset.)

KEEP --> very rarely used. Retain the dataset and keep on volume.

3rd value of DISP: status at unsuccesfull/failed execution of step.

CATLG (catalog) --> retain the dataset which is created and add an entry in the catalog.

UNCATLG (uncatalog) --> delete the dataset and remove the entry from catalog.

DELETE --> Delete the datset, but the catalog entry remains.

KEEP --> very rarely used. Retain the dataset and keep on volume.

2. UNIT --> determine if the dataset is to be written on disk or tape.

UNIT= SYSDA / UNIT= DASD--> dataset is to be written on disk

UNIT= TAPE / number (tape device number) --> Dataset will be writtn on tape.
3. SPACE --> allocate space to your dataset.

SPACE=(CYL,(5,2),RLSE),

CYL/TRK/BLKSIZE -> Space allocated to you dataset in terms of CYlinder, TRacks, Blocksize (for
partionend dataset)

(primary,Secondary,Dir) --> primary space allocated, Secondary space allocated, DIR--> for number of
members in the directory of partitioned dataset.

RLSE: Releases the extra space which is allocated to dataset but not used by the dataset.

SD37 or SE37 abend: SPACE is not sufficient.

SPACE = (CYL, 1) --> only primary space is allocated. if the space allocated is not sufficient, jcl/job will
abend with SD37.

SPACE = (CYL, (2,1)) --> if primary space is finished, datase will use secindary space. if secondary
space is also finished, then job will fail with SE37.

DCB: (data control block)

(RECFM=FB,LRECL=40,BLKSIZE=0,DSORG=PS)

RECFM: record format. FB (fixed byte) / VB (Variable byte)

LRECL: length of each record.

BLKSIZE: is always in multiple of LRECL or 0. preffered is O.

DSORG: the type of dataset. PS: Sequential dataset (Physical Sequential), PO: Partitioned Dataset
(PS), DA:DIrect access. (no longer used)

BUFFNO: used to allocate buffer space. used to improve the performance of a Seq dataset. BUFFNO =
<number upto 255>

VOLUME: Serial number (numeric/alphanumneric) of a device where your dataset is stored. VOL=
<Serial number>
CUST.FL.EXT.RPT01

1234567890123456789012345678901234567890

++++++++++++++++++++++++++++++++++++++++ actual length RECFM=FB RECFM=VB

PRANCHAN 45 24/09/85 trainer 28 40 28

mounika 22 15/05/90 19 40 19

BHANU 25 01/01/95 grad 21 40 21

SPECIFIC DD names:

SYSPRINT & SYSOUT: --> used to display any message that you pass from your cobol program to JCL
using DISPLAY keyword.

e.g //SYSPRINT DD SYSOUT=*

//SYSOUT DD SYSOUT=*

STEPLIB: used when your JCL executes a cobol program. The dataset which is passed in STepblib is
called load library.

eg: //STEPLIB DD DSN=CUST.PR.LOADLIB,DISP=SHR //*CUST.PR.LOADLIB --> Load library.


This is mandatory to pass if your jcl is executing cobol program.

load library contains load module. Each cobol


program has its own load module. Load module is mandatory without which you will not be able to
execute cobol program

JOBLIB: the use of steplib and job lib is same. STEPLIB is preferred over joblib.

STEPLIB: Specific to a STep. MAinframe searches for the load module of the program for a particular
step only. Written after each EXEC statement.

JOBLIB: For the entire JOB. Mainframe searches for the load module of all the programs in the job.
Written after JOB card/statement.
SYSIN : When SYSIN DD name is coded in a JCL, then that JCL is called as INSTREAM JCL. Instream is as
that jcl where you pass instructions/values inside the JCL only. more commonly used to execute IBM
utility programs.

e.g SYSIN DD *

dd statments ==>

dsn,disp,dcb,space,unit

jcl cntrl statments==>

job,exec,dd,jcllib,pend,proc,if,else,then,cntrl.encntrl,null

positional parameter==>account information,program name

keyword parameter=>class,msgclass,msglevel,notify,typerun,restart,cond,even

dif between joblib and steplib

JOBLIB tells z/OS to search the private libraries for each step in the job.

STEPLIB tells z/OS to search the private libraries only for one step

msgclass=> used to specify the format of the output (system messages and jcl related messages

msg level=>what type msg should be printed in output

class = used to z/os nature of the job

4 Divisions.

IDENTIFICATION DIVISION.

Program ID. <Name of program> //*Mandatory. Minimum requirement to compile a


program

AUTHOR. <Name of programmer> //*optional

DATE WRITTEN. <mention date of writing the program> //*optional

DATE COMPILED. <mention date of compile the program> //*optional


ENVIRONMENT DIVISION.

CONFIGURATION SECTION.

NAME of computer (source and object). //* optional

INPUT-OUTPUT SECTION. //* used for FILE handling (PS/VSAM)

FILE CONTROL.

<FIle declaration>

DATA DIVISION.

FILE SECTION.

Define properties of the file declared in INPUT-OUTPUT SECTION.

WORKING-STORAGE SECTION.

Define VARIABLES. //* VAriables are used to store values during processing
of cobol program.

PROCEDURE DIVISION.

Instructions on what your cobol program needs to perform.

Paragraph. Set of instructions written.

STOP-RUN/GOBACK.

COMP Variable. (computation). Used with Signed numeric values. S9()COMP

COMP : Binary represantation of data.

COMP-1 : Single word floating point

COMP-2 : Double word floating point

COMP-3 : PAcked decimal representation. (n/2+1)

01 WS-AGE PIC 9(10).


SIZE of variable is 10 bytes.

01 WS-AGE PIC 9(10) COMP3. 1111111111

Size of variable is 10/2 + 1 = 5+1 = 6

VERBS: (computational statements).. Written in Procedure Division.

Arimethamatic Verb.

Calculations.

ADD, SUBSTRACT, MULTIPLY, DIVIDE, COMPUTE, ROUNDED, ONSIZE ERROR.

ADD : ADD Value to VALUE. Add 1 TO 100.

ADD Value to VAriable ADD 1 TO WS-AGE

ADD VAriabe to Variable ADD WS-VAR1 TO WS-VAR2

SUBSTRACT: Substract Value From VALUE. SUBSTRACT 1 FROM 100.

Substract Value from VAriable SUBSTRACT 1 FROM WS-AGE

Substract VAriabe From Variable SUBSTRACT WS-VAR1 FROM WS-VAR2

MULTIPLY: Multiply Value By VALUE. MULTIPLY 1 BY 100.

Multiply Value By VAriable MULTIPLY 1 BY WS-AGE

Multiply VAriabe By Variable MULTIPLY WS-VAR1 BY WS-VAR2

DIVIDE: Divide Value From VALUE. DIVIDE 1 INTO 100.

Divide Value from VAriable DIVIDE 1 INTO WS-AGE

Divide VAriabe From Variable DIVIDE WS-VAR1 INTO WS-VAR2

COMPUTE: Perform Add (+) Substract (-) Multiply (*) Divide (/) Exponentation (**)
COMPUTE VAR1 + VAR2 --> Addition

COMPUTE VAR1 - VAR2 --> Substraction

COMPUTE VAR1 * VAR2 --> Mutiplication

COMPUTE VAR1 / VAR2 --> Division

ROUNDED: USed to remove the decimal and round

it to nearest value. Used along with another verb.

ONSIZE ERROR: Trap size errors during arithematic opreations (Calculations)

01 WS-EXP PIC 9(03) VALUE 900

01 WS-RATE PIC 9(04) VALUE 1000

01 WS-SALARY PIC 9(05) 00000

MULTIPLY WS-EXP BY WS-RATE GIVING WS-SALARY ONSIZE ERROR DISPLAY " LIMIT exceed"

900 * 1000 = 900000

WS-SALARY: 00000

LIMIT exceed

Non arithematic Verb.

DISPLAY, MOVE, IF, END-IF, EVALUATE, GIVING, ACCEPT, PERFORM.

DISPLAY: Display value, Value of variable. The value will be displayed in Spool of the job.

DISPLAY " THIS IS MY FIRST PROGRAM" .


01 WS-EXP PIC X(30) VALUE ' THIS IS MY FIRST PROGRAM '.

DISPLAY WS-EXP

THIS IS MY FIRST PROGRAM

MOVE: MOVE Value to VAriable MOVE 10 TO WS-AGE

MOVE VAriabe to Variable MOVE WS-VAR1 TO WS-VAR2

IF, END-IF : Conditional parameter. Statements written

under IF & END-IF will be executed inly if the condition is

satisfied. END-IF is not explicity mentioned in some projects.

01 WS-EXP PIC 9(03) VALUE 050

01 WS-RATE PIC 9(04) VALUE 100

01 WS-SALARY PIC 9(05)

IF WS-EXP > 100

MULTIPLY WS-EXP BY WS-RATE GIVING WS-SALARY

END-IF.

EVALUATE: Conditional parameter. Performs same function as IF & END-IF.

EVALUATE - WHEN

ACCEPT : It is used to take value from system or from JCL

(information passed to JCL under SYSIN parameter).

WS-VAR-DATE PIC X(10)


WS-VAR-TIME PIC 9(10)

ACCEPT DATE : take the system date. ACCEPT WS-VAR-DATE FROM DATE

ACCEPT TIME: Take the system time. ACCEPT WS-VAR-TIME FROM TIME

JCL:

????

GIVING : Used in combination with other arithematic verbs.

Used to store the result in a separate variable mentioned after GIVING Verb.

01 WS-EXP PIC 9(03) VALUE 900

01 WS-RATE PIC 9(04) VALUE 1000

01 WS-SALARY PIC 9(05)

MULTIPLY WS-EXP BY WS-RATE GIVING WS-SALARY //* Value/Result of the multiplication WS-
SALARY

What do you know about COBOL?

List some features of COBOL.

Identification Division, Environment Division, Data Division, and Procedure Division.

Name the divisions in a COBOL program.

Alpha-numeric (X), Alphabetic (A), and Numeric (9).

What are the different data types available in COBOL?

IS NUMERIC clause is used to check if any item is numeric or not. It returns TRUE when the item

against which it is used contains only numbers (0 to 9). The item can be positive or negative.

What is 'IS NUMERIC' clause?

Level 66 is used for RENAMES clause and Level 88 is used for condition names.

What are 66 and 88 level used for?


Subscript is the occurrence in an array. Index is the displacement from the beginning of an array.

What is the difference between subscript and index?

SEARCH is a serial search, whereas SEARCH ALL is a binary search. A table must be in sorted

order before using SEARCH ALL.

What is the difference between SEARCH and SEARCH ALL?

Performing a SECTION will cause all the paragraphs that are a part of the section to be performed.

Performing a PARAGRAPH will cause only a particular paragraph to be performed.

What is the difference between performing a SECTION and a

PARAGRAPH?

Scope terminator is used to mark the end of a verb. Example: IF and END-IF.

What is a scope terminator?

File opening modes in COBOL include: INPUT, OUTPUT, I-O, and EXTEND.

What are the file opening modes in COBOL?

The maximum size of a numeric field is PIC 9(18).

What is the maximum size of a numeric field we can define in COBOL?

CONTINUE transfers the control to the next statement after the scope terminator. NEXT

SENTENCE transfers the control to the statement after the first period is encountered.

What is the difference between CONTINUE and NEXT SENTENCE?

Why we cannot define an Occurs clause at 01 level?

01 is of the record level. We repeat the fields within a record, not the record itself. So an Occurs

clause can not be used at 01 level.

To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.

What is the mode in which you will OPEN a file for writing?

The parameters passed in a Call By Content are protected from modification by the called program.

In Call By Reference, parameters can be modified by the called program.

What is the difference between Call By Content and Call By Reference?

The linkage section is a part of a called program that 'links' or maps to data items in the calling

program's working storage.

What is a linkage section?

The program will go in an infinite loop.

What will happen if you code GO BACK instead of STOP RUN in a stand
alone COBOL program?

It is stored in the last nibble.

How is sign stored in a COMP-3 field?

Comp is a binary usage, while comp-3 indicates packed decimal.

What is the difference between comp and comp-3?

Identification Division is used for documentation purpose.

What is the purpose of Identification Division?

What is the difference between static call and dynamic call?

In static call, the called program is a standalone program, it is an executable program. During

runtime, we can call it in our called program. As about dynamic call, the called program is not an

executable program; it can be executed through the called program only.

Redefines clause is used to allow the same storage allocation to be referenced by different data

names.

What is Redefines clause?

The Purpose of Pointer phrase is to specify the leftmost position within the receiving field where the

first transferred character will be stored.

What is the Purpose of Pointer Phrase in STRING command?

It is an elementary level item which cannot be subdivided.

What is 77 level used for?

Compare the item to be searched with the item at the centre. If it matches fine; else repeat the

process with the left half or the right half depending on where the item lies.

What is binary search?

Evaluate is like a case statement and can be used to replace nested Ifs. No break is required as the

control comes out as soon as a match is found.

What is the use of EVALUATE statement?

Yes, as Redefines causes both fields to start at the same location.

Can I redefine an X(10) field with a field of X(20)?

COMP-1 is single precision floating point that uses 4 bytes. COMP-2 is double precision floating

point that uses 8 bytes.

What is COMP-1 and COMP-2?

Accept Verb is used to get data such as date, time, and day from the operating system or directly
from the user. If a program is accepting data from the user, then it needs to be passed through the

JCL.

What is the function of Accept Verb?

Compute statement is used to write arithmetic expressions in COBOL. This is a replacement for

Add, Subtract, Multiply, and Divide.

What is a Compute Statement?

Supply the DD cards in JCL just as you would for files referred to in the main program.

How do you define the files referred to in a subroutine program?

Identification Division and Program-Id paragraph are mandatory in a COBOL program.

What divisions, sections and paragraphs are mandatory in a COBOL

program?

Area B starts from 12 to 72 column.

Where does AREA B in COBOL start from?

It appears in the Input-Ouput Section in the Environment Division.

Where does the FILE-CONTROL paragraph appear?

If TEST BEFORE is specified, the condition is tested at the beginning of each repeated execution of

the specified PERFORM range. If TEST AFTER is specified, the condition is tested at the end of

each repeated execution of the PERFORM range. The range is executed at least once in TEST

AFTER.

What is the difference between Perform With Test After and Perform With

Test Before?

Local-Storage is allocated each time a program is called and will be deallocated when the program

stops via an EXIT PROGRAM, GOBACK, or STOP RUN. It is defined in the DATA DIVISION after

the WORKING-STORAGE SECTION.

What is LOCAL-STORAGE SECTION?

Access modes are SEQUENTIAL or DYNAMIC for the start statement.

What are the access modes of START statement?

PIC 9.99 is a four position field that actually contains a decimal point whereas PIC 9v99 is a three

position numeric field with assumed decimal position.

What is the difference between PIC 9.99 and PIC9v99?

No, the table must be indexed to search on a table.


Can a Search be done on a table with or without Index?

Before REWRITE is performed, the record must be opened and read from the file. Therefore, the file

must be opened in I-O mode for rewrite functionality.

Why is it necessary to open a file in I-O mode for REWRITE?

A literal is a data item that consists value by itself. It cannot be referred by a name. They are

constant data items.

What are literals?

A Stop run ends the unit of work and returns control to the operating system whereas GOBACK

returns control to calling program. So if we code GO BACK instead of Stop Run, it will go in infinite

loop.

What will happen if you code GO BACK instead of STOP RUN in a stand

alone COBOL program?

To write into a file, the file has to be opened in either OUTPUT or EXTEND mode.

What is the mode in which you will OPEN a file for writing?

FILE-CONTROL paragraph appears in the Input-Ouput Section in the Environment Division which

provides information of external data sets used in the program.

Where does the FILE-CONTROL paragraph appear?

Length of PIC 9.999 is 5 as '.' takes 1 byte. So total 1 byte for '.' and 4 bytes for 9.

What is the length of PIC 9.999?

Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite

operations. It can be used only after a successful Read operation. Rewrite verb overwrites the last

record read.

Which cobol verb is used for updating a file?

.00123 edited value will be taken. P is assumed decimal scaling position which is used to specify the

location of an assumed decimal point when the point is not within the number that appears in the

data item. .PIC PP999 means that numeric data item is of 3 characters and there are 5 positions

after the decimal point.

If 123 value is moved to a PP999 PIC clause, then what is edited value

taken?

In array declaration, we can specify occurs clause on Elementary item as well as on Group item

also.
Where can we specify OCCURS clause?

9(7) will take 7 bytes and 1 byte for SIGN TRAILING SEPARATE, so total 8 bytes it will take.

How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy?

What is Next?

Further, you can go through the examples which you have practised with the subject and make sure

you are able to speak confidently on them. If you are fresher, then the interviewer does not expect

you to answer very complex questions, rather you have to make your basics very strong.

It really doesn't matter much if you could not answer a few questions, but it matters how you

answered, the ones that you did. So just be confident during your interview. We at tutorialspoint
wish

you all the very best.

divisions=>

identification divisions

environment division==>configuration section,input/output section

(Inside file control declare a file)

data division==>file section,working storage section

procedure division

DB2 Interview Questions

Dear readers, these DB2 Interview Questions have been designed specially to get you acquainted

with the nature of questions you may encounter during your interview for the subject of DB2. As per

my experience good interviewers hardly plan to ask any particular question during your interview,

normally questions start with some basic concept of the subject and later they continue based on

further discussion and what you answer −

S9(4) COMP is the picture clause of a null indicator.

What is the picture clause of Null Indicator variable?

Locking services are provided by Locking services component which is known as Internal Resource
Lock Manager (IRLM) and manages concurrency issues and dead locks.

Which component checks DB2 deadlocks?

Database services component is responsible for execution of SQL statements and it manages buffer

pool also.

Which component is responsible for execution of SQL statements?

System services component handles DB2 startup and shutdown.

Which component handles DB2 startup and shutdown?

Locking can be applied on either of these − Page, table and table space.

On which level we can apply the locks?

In which step we specify the isolation level?

In Bind step we specify the isolation level.

Check the value of SQLERRD to know how many rows got updated after an update statement.

Which field in SQLCA shows the number of updated rows after update

statement?

TIMESTAMP data type takes 10 bytes and default is YYYY-MM-DD:HH:MM:SS-NNNNNN

What is the physical storage length of TIMESTAMP data type?

DATE data types take 4 bytes and default is 'YYYY-MM-DD'

What is the physical storage length of DATE data type?

DB2 optimizer is used to select the access paths & to process the SQL queries.

Which component is used to processes SQL statements and selects the

access paths?

This statement is incorrect as SQL statements must be coded in Area B.

In a COBOL-DB2 program all SQL statements must be coded in Area A.

State whether true or false?

This statement is incorrect as cursors are used to handle multiple row selections at a time.

Cursors are used to handle single row selections at a time. They are data

structure which hold all the results of a query. State whether true or false?

This statement is incorrect as host variables cannot be renamed & redefined.

Host variables cannot be group items but they may be grouped together in

host structure. They can be Renamed or Redefined. State whether true or

false?
This statement is incorrect. Synonyms get dropped automatically when we drop the table but alias of

the table remains there. We need to manually drop the alias.

When a table is dropped all the alias get dropped automatically. State

whether true or false?

When a program abends in middle of some transaction then DB2 performs a auto rollback.

What action DB2 takes when a program abends?

If a transaction takes an Update lock on some data, then other transactions can only get only

Shared lock on it.

If a transaction takes a Update lock on some data, then other transactions

can get what type of lock?

If a transaction takes a Shared lock on some data, then other transactions can get either a Shared

or Update lock on it.

If a transaction takes a Shared lock on some data, then other transactions

can get what type of lock?

Locks can be classified based on size, duration and mode.

How the locks can be classified?

Load utility is used to load data into tables.

Which utility is used to load data into a table from a sequential file?

Reorg utility is used for reorganization of data on physical storage.

Which utility reclaims space from pages when some rows were deleted?

Runstats utility updated the catalog tables with the statistical information.

Which utility provides statistical information such as the number of pages

and rows and stores them in Catalog tables?

SYNCPOINT command is used to commit a transaction in CICS program.

Which command is used to commit a transaction in CICS program?

Uncommitted read provides maximum concurrency.

Which isolation level provides maximum concurrency?

Repeatable Read ensures highest data integrity as it holds page and lock the rows until a COMMIT

point.

Which isolation level ensures highest data integrity?

A transaction gets an Exclusive lock when it is about to write at that time no other lock can be
applied on it.

If a transaction has an exclusive lock on some data, then what are the other

types of lock which can be applied on it?

DBRM is the input to the bind process which is produced in the pre-compile step.

What is the input to the bind process?

SELECT COUNT(*) FROM TAB query is used to count the number of rows in a table.

How you will count the number of rows from a table TAB?

Suppose we added a new column by using ALTER statement, where the

column will be added?

When we use ALTER statement for adding a new column then it will be added at the end of the

table.

We can declare a cursor either i Working Storage Section or in Procedure Division also.

In a COBOL-DB2 program where can we declare a cursor?

SQLCODE -818 is a timestamp mismatch of load module and bind timestamp built from DBRM.

When you will face SQLCODE -818?

If a user is not authorized to access DB2 objects, he will face SQLCODE -922.

When you will face SQLCODE -922?

At the time of deadlock or timeout you will face SQLCODE -911.

When you will face SQLCODE -911?

When you will try to insert or update a record with duplicate key then you will face SQLCODE =

-803.

When you will face SQLCODE -803?

Application plan consists of one or more DBRM & application package which is kept in buffer pool

during program execution.

What does application plan contains?

We will bind only that package which contains the modified DBRM. No need to bind all the

packages.

Suppose a Plan contains 4 Packages & we modified one of the DBRM

which is present in one of the Package. Then for normal functionality of

application what should we do?

Bind step converts all the SQL statements into executable form in COBOL-DB2 program.
What happens in BIND step in a DB2 program?

A negative SQL code indicates a failure while a positive one indicates an exception.

What does a positive SQL code indicates?

REVOKE statement is used to take away the permissions from a Database.

Which statement is used to revoke the access from a database?

GRANT keyword is used to grant privileges on DB2 tables.

Which statement is used to authorize access on database tables?

Primary keys are optional and we can define them in CRETAE TABLE & ALTER TABLE statements.

In which statement you can define primary key?

A table can have only one primary key.

How many primary keys can be declared on a table?

DROP TABLE table-name is the syntax to delete a table from database.

Write a query to delete a table from database.

DELETE * FROM table-name is the syntax to delete all the rows from a table.

Write the query to delete all the rows from a table.

Char data type maximum size is of 254 bytes.

What is the maximum size of a CHAR data type in DB2?

What is Next ?

Further you can go through your past assignments you have done with the subject and make sure

you are able to speak confidently on them. If you are fresher then interviewer does not expect you

will answer very complex questions, rather you have to make your basics concepts very strong.

Second it really doesn't matter much if you could not answer few questions but it matters that

whatever you answered, you must have answered with confidence. So just feel confident during

your interview. We at tutorialspoint wish you best luck to have a good interviewer and all the very

best for your future endeavor. Cheers :-)

Varchar data type maximum size is of 4046 bytes.

What is the maximum size of a VARCHAR data type in DB2?

SPUFI stands for SQL Processor Using File Input.

What does SPUFI stands for?

An indexed is stored in B-tree format.

In which format index in stored?


A partitioned table space must have a clustered index.

Which index must be present for partitioned table space?

DROP ALIAS AL1 is the query to drop a alias.

Suppose a table A has an Alias named AL1. Which of the query is correct to

drop the AL1 alias?

We can have only one clustering index for a table.

How many clustering index we can have for a single table?

Entry sequenced datasets (ESDS), Key sequenced datasets (KSDS), Relative record dataset

(RRDS) and Linear dataset (LDS).

What are the different types of VSAM datasets?

A control interval is the unit of information that VSAM transfers between virtual and auxiliary
storage.

What is a control interval?

Records are stored in the order in which they are included in the file.

How are records stored in an ESDS?

A group of control intervals makes up a control area.

What is a control area?

A cluster is the combination of the index, sequence set and data portions of the dataset. The

operating system gives program access to the cluster, that is to all parts of the dataset

simultaneously.

What is a cluster?

What is the catalog?

The catalog contains the names of all datasets, VSAM and non-VSAM. It is used to access these

datasets.

An alternate index is a file that allows access to a VSAM dataset by a key other than the primary

one.

What is an alternate index?

A path is a file that allows you to access a file by alternate index. The path provides an association
between the AIX and the base cluster.

What is a path?

Free space is reserved within the data component of a KSDS to accommodate insertion of new

records.

What is free space?

Primary key values must be unique and alternate key values need not be unique.

Do primary key values and alternate key values have to be unique?

The ORGANIZATION for KSDS is INDEXED.

What is the ORGANIZATION for a KSDS in COBOL SELECT statement?

ACCESS can be SEQUENTIAL, RANDOM or DYNAMIC.

What are access modes available for KSDS dataset?

File Status provide information about each I/O operation for the file.

What is the purpose of the FILE STATUS clause in the SELECT statement?

What is the utility program closely associated with VSAM?

IDCAMS the access method services utility is associated with VSAM.

They are DEFINE CLUSTER, DATA and INDEX.

What are the three levels of definition for the VSAM DEFINE?

Run VERIFY.

During processing of a VSAM file, some system error occurs and it is

subsequently unusable . What do you do?

'02' indicates Non-Unique Alternate Index duplicate key found.

What does '02' file status code indicate?

Unique Clusters consists of a separate data space which is utilized completely by the cluster

created within it. Unique clusters are created out of unallocated space on direct access storage.

What are Unique Cluster?

A sub-allocated VSAM file shares the VSAM space with other sub-allocated files. It specifies that file

should be sub-allocated within existing VSAM space. Sub-allocation is used for easier management

and control of VSAM spaces.

What are Sub-allocated Clusters?

UPGRADE specifies that the alternate index should be modified if the base cluster is modified and

NOUPGRADE specifies that the alternate indexes should be left alone if the base cluster is
modified.

What is Upgrade and Noupgrade option in Alternate Index?

First step is Define Alternate Index. Second is Define Path and third step is Building Index.

Explain different steps to create Alternate Index?

ALTER command is used to change most of the VSAM dataset attributes that were specified while

defining VSAM cluster.

What is the use of ALTER command in VSAM?

errors

+100 end of rows

803 duplicate

805 plan not found

811 cursor not defined

502 cursor not opened

503 cursor already opened

313 mismatch betweeen host variables and

305 null value exception

00- ALL -SUCCESSFUL COMPLETION

01- NOT A VALID FILE STATUS KEY

02- DUPLICATE KEY

04- RECORED LENGTH MISMATCH

05- MISSING OPTIONAL FILE

10- END OF FILE

You might also like