0% found this document useful (0 votes)
27 views48 pages

Interview

Uploaded by

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

Interview

Uploaded by

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

JCL

•JOB NAME:z87265A
•Job:keyword(we need to use this keyword to let the MVS(Multiple Virtual
Storage,OS) to know that it is job
•PARAMETERS:We use these parameters in the JOB statement helps the JES(Job
Entry Subsystem,Component of MVS) to decide how jobs should run,which
class it belongs,CPU taken time that can be allocated to the job,accounting
information of the job
•Positional,keyword parameters
•Positional:Account information(fb3),programmer name(‘jcl’).This tells the
group of information who is responsible for the job
•KEYWORD:CLASS,MSGCLASS,NOTIFY,TIME,TYPRUN,PRTY,REGION,MSGLEVEL
JCL STATEMENTS
• 3 jCl statements
• JOB,EXEC,DD
• DD:DD statements define the datasets that a program or procedure
uses when it runs.
• EXEC:EXEC statement marks the beginning of a step within job and
specifies the name of the PGM,CATALOG procedure
• PGM: It is a parameter used to specify the program name which
needs to execute by the system.
KEYWORD PARAMETERS
• TYPRUN
• MSGCLASS
• MSGLEVEL
• NOTIFY
• CLASS
• REGION
• PRTY
• RESTART
• TIME
KEYWORD PARAMETERS
• TIME:It is a keyword parameter in jcl which indicates the Processor Time required of in a jcl
• REGION:It is a keyword parameter in jcl to specify the size of the storage required to execute the job.
• region=0M means it will take all the available storage space in the memory
• REGION=0M
• MSGLEVEL:It is a keyword parameter defines the output device to which system messages and jcl related
messages are written and printed
• NOTIFY:JCL notify parameter which is used to inform a TSO user when this job terminates normally or
abnormally
• NOTIFY=SYSUID,
• TYPRUN:It is a keyword parameter to request special job processing
• TYPRUN=HOLD,TYPERUN=SCAN
• CLASS-It creates the initiator for the executing job
• CLASS=A,D..
• INITIATOR:It is a kind of like giving you your own virtual computer to run
• Accountinfo(fb3),author name(‘jcl’),exec
REDEFINE:Using same storage space
ID. 01 WS-CHECK-DATE.
05 WS-DOB VALUE '20200205’.
10 WS-YY PIC X(4).
10 WS-MM PIC X(2)
. 10 WS-DD PIC X(2).
05 WS-EXPIRY-DATE REDEFINES WS-DOB
PIC 9(8).
• RENAMES clause is used for regrouping elementary data
items and gives one name to it. REDEFINES clause
allow you to use different data descriptions entries to
describe same memory area.
• There is one exception to this rule: COUNT(*) returns the count
of all rows, even rows whose fields are NULL. But
COUNT(FieldName) behaves like the other aggregate functions
in that it only counts rows where the specified field is not NULL.
COUNT(*) and COUNT(FieldName) never return NULL.If there
are no rows in the output, both functions return 0.
COUNT(FieldName) also returns 0 if all FieldName fields in the
output are NULL.
• Normalization is the process of organizing the data in the database.
Normalization is used to minimize the redundancy from a relation or set of relations.
It is also used to eliminate the undesirable characteristics like Insertion, Update and
Deletion Anomalies.
• Db2 objects-db,stogroups,tablespace,indexspace,index,synonyms,alias
• Indexspace-storage of index
• Storage group:it is a collection of direct access volumes,all of the same device type
• Tablespaces:tables are stored
• Tablespace is a part of db
• Index:it is a pointer refers to specific rows
• View:virtual table.It is another way of looking up the table
• Create view view_name;
• Arrays in COBOL are known as tables. An array is a linear data structure and is a collection of
individual data items of same type.
• Index:no of displacement positions of an array
• Subscript:no of occurrences of an array

• SEARCH:
• 05 CHARC PIC X(01) OCCURS 26 TIMES INDEXED BY I
• SET I TO 1
• SEARCH CHARC
• SEARCHALL:
• 05 CHARC PIC X(01) OCCURS 26 TIMES INDEXED BY I
• SEARCHALL CHARC
• ASC,DESC
IEBCOPY
• IEBCOPY:
• SYSIN DD*
• COPY INDD=SYSUT1,OUTDD=SYSUT2
• IEBGENER:SYSUT1,SYSUT2
• PRTY:It is a keyword parameter,to tells the order of execution of the program when there are
many jobs within the same class
• RESTART:It is a optional keyword parameter which is used to restart a job from a particular step.
• restart=step11
• It will tells from which step it has start executing again
• MSGLEVEL:It is a optional keyword used to tell the JCL about the messages that we need to print
• If we wont mention msglevel,it will take the default values.
• MSGLEVEL=(x,y)
• we can give 0,1,2 for ‘x’
• 0-job statement
• 1-all input & procedure statements
• 2-only input jcl statements
• IDCAMS:Integrated Data Cluster Access
UTILITIES types Method.IDCAMS utility is used to
• IEBGENER create,modify and delete VSAM datasets
• IEBCOPY
• IEFBR14
• IDCAMS
• IEBCOPY:It is used to copy the members of
one PDS to other PDS
• IEBGENER:It is used to copy PS to PS or PDS
member to PS
• sysut1-input
• sysut2-output
• Perform:
• Simple,inline,nested,perform thru,prform times,perform until,perform varying
• Plan:it is executable module
• Package:
• Array utill 7 dimensions
• Array usage:array is the collection of data items of same datatypes
• Batch processing:
• Types of cursors
• Types of updates:for data,cur update,…
• Update sytax:
• Update table-name
• Orderby and groupby
• sb37 abend-
• Inspect:
• Tally
VSAM(Virtual Storage Access Method)
• In VSAM files,records are stored in control intervals.VSAM files can
sequential and random read.In VSAM access is fast because of
organization of records.
• KSDS(Key Sequenced Data Set)
• ESDS(Entry Sequenced Data Set)
• RRDS(Relative Record Data Set)
• LDS(Linear Data Set)

• The main difference b\w among these DS is the way key stored and
accessed
Cursor errors
• -501-cursor not open on fetch
• -502-opening cursor which is already open
• -503:updating column needs to be specified
• -504-cursor name not found
• +100-no matching values found or cursor reached to end of the file
• -805-DBRM or Package not found in plan
FILE STATUS
• 10:EOF
• 22:Duplicate record
• 23:File not found
• 35:DD name mismatch
• 37:2nd opening file in wrong mode
• 39:Attributes mismatch(lrecl,key position)
• 41:tried to open file which is already opened
• 92:logical error
• 96:no DD found
KSDS(Key Sequenced Data Set)
• It can have one or more key fields
• We can access records both sequential and random with key value
• indexed
• keys(y x)
• cisz(1024)
• freespace(10 10)
• tracks(1 1)
• recordsize(80 80)
Other 3 types
• ESDS-non indexed.Records are held in the files in which order they been
inserted.Deletion of records is not possible and we can make them as
inactive.It can contain duplicate records.
• RRDS:indexed.the records can be accessed based on the previous record
• if we have 3 records,next will be 4th record,we can retrieve the records
based on the slot of the record.we can delete the records the records of
rrds which will create empty space.we can insert in that empty slot
• LDS:It is a kind of non-vsam file.It is a byte-stremed data.DB2 is the
largest user of LDS
• Freespace specifies the percentage of free space to reserve
for the control intervals (CI) and control areas (CA) of the
data component. The default value of this parameter is zero
percentage. CISZ is known as Control interval size. It specifies
the size of control intervals.
CONTROL AREA
• It is a direct access storage space used by the VSAM to store data records
and other control information that describes the records.
• In non-VSAM data management methods, the unit of data that is
transferred between memory(buffer) and storage device(DASD) is
defined by block. In VSAM, the unit of data that is transferred
between memory (buffer) and storage device (DASD) in each I/O
operation is called as Control Interval (CI).
• Whenever there is need to read a record from VSAM, the entire
control interval which contains that particular record is transferred
to buffer from DASD.
• Size of control interval is specified while defining cluster.
AIX
• NAME indicates that the alternate index's name is EXAMPLE.AIX.
• RELATE identifies the alternate index base cluster, EXAMPLE.KSDS2.
• KEYS identifies the length and location of the alternate key field in each of the base cluster's data records.
The alternate key field is the first three bytes of each data record.
• RECORDSIZE specifies that the alternate index's records are variable length, with an average size of 40
bytes and a maximum size of 50 bytes.
• VOLUMES indicates that the alternate index is to reside on volume VSER01. This example assumes that the
volume is already cataloged in the user catalog, USERCAT.
• CYLINDERS allocates three cylinders for the alternate index's space. The alternate index is extended in
increments of one cylinder.
• NONUNIQUEKEY specifies that the alternate key value might be the same for two or more data records in
the base cluster.
• UPGRADE specifies that the alternate index is opened by VSAM and upgraded each time the base cluster is
opened for processing.
• CATALOG defines the alternate index in the user catalog, USERCAT.
• a copybook file is used to define data elements that can be
referenced by many programs.-copybook
• UNSTRING <VAR_NAME> DELIMITED BY ' , ' OR ' ' INTO
<VAR_NAME>, <VAR_NAME>.
• What is the figurative constant in COBOL?
• Ans:
• They are the reserved words that specify certain alphabetic or numeric
constant values like zero, spaces, quotes, high and low value/s, etc
• Why SQLCA be included in the cobol-db2 program?
• SQLCA(Sequential Query Language Communication Area) helps in the
communication b/w DB2 and COBOL-DB2 program.It contains various
SQLCODE,SQLERRD,SQLWARNs.
• Ex:sqlcode returns the db2 error codes and sqlwarn gives the sql
warnings while executing SQL statements
1 9Numeric
2 AAlphabetic
3 XAlphanumeric
4 VImplicit Decimal
5 SSign
6 PAssumed Decimal
FILES
• I-O MODE:input and output mode
• it is to rewrite(updating the records in a file) or delete the files records
and read the records.
• WRITE:this is to insert the records into the file.File should be in OUTPUT
mode
• READ:it is used to read a single record at every single read verb
• file should be open in INPUT or I-O mode
• EXTEND:it is used to add the records at the end to the sequential file.we
cant use this EXTEND mode when the file is random or dynamic
COPYBOOKS
HIGH-VALUESOne or more characters which will be at
the highest position in descending order.
LOW-VALUESOne or more characters have zeros in
2
binary representation.
ZERO/ZEROESOne or more zero depending on the size
3
of the variable.
4 SPACESOne or more spaces.
5 QUOTESSingle or double quotes.
6 ALL literalFills the data-item with Literal.
• DSNTIAR:It is a subroutine helps you to obtain a formatted form SQLCA and a text message that is
based on the SQLCODE field of SQLCA
• SQLCA-100:Row not found for fetch or update or delete
• DCLGEN:Declaration GENrator
• Unique index:It ensured that the value in the index key column are unique.It is mainly used for the
fast retrieval of the data from the database.
• JCL:JCL scripting language used in applications which are done in mainframe computers.It is a set
of statements that you code to tell the operating system about the work you want to do with files
• NUMVAL-C:these functions are used to convert alphanumeric items to numeric items
• INSPECT:It is used to tally the number of occurrences of specific character to replace characters by
other character or fields.
• 02 WS-MARK PIC 9(02) OCCURS 7 TIMES
• INDEXED BY MARK-INX.
ERROR CODES
• SO7 for non-numeric inplace of numeric
SYNTAXES
• CURSOR:It is used to fetch multiple records.
• declare ret-cur cursor for
• open ret-cur
• close ret-cur
• fetch ret-cur into
• DB,TABLESPACE,TABLE,INDEX,VIEW,SYSNONYM,ALIAS
• Sysnonym: It is the another name to the table.If we drop the table ,alias
name wont be dropped.
• ALIAS:It is the another name to the table.If we drop the table ,alias name
will be dropped automatically
• View:it is like subtable to the table
• if we have 5 columns in the main table,we frequently uses only 3
fields,then we can store those 3 in sub table
• SQL:Sequential Query Language.It is used to access data from the tables
• SQL Processor Using File Input (SPUFI)
•WITH DEFAULT: Numeric Becomes Zero, Character Becomes Blank, Date becomes Current Date, Time becomes Current Time,
Timestamp becomes Current Timestamp.
•If Nulls are allowed, internal storage length is increased by 1 byte

• Foreign Key Identifies a row of related data in another table


• Foreign key need not be unique
• Loadlibrary:it is the group of members which are executable code of a program which creates at the time compilation process
•DB2 COMPILATION PROCESS
•Data Base Request Module (DBRM)
 DBRM is a module containing SQL statements from the source program, which have been extracted by the DB2 Pre-compiler.
 The module is stored as a member of a partitioned data set.
 The DBRM is used as input to the BIND process

• Bind:bind reads sql statements from DBRM and produce the access data as directed by the sql statements
bound.
• Output of BIND PLAN is the application plan containing the executable logic giving the access path to DB2
data.

• BIND also performs Syntax checking of SQL statements, Checking of the DB2 table and column catalog
Information, Authorization Validation
•SQL Communication Area:
•SQLCODE Field tells result of last executed SQL request
 Examples: 000 Successful
 +100 No more rows found
 - 530 New Foreign key value is invalid
 SQLCODE field should checked after each SQL statement

• If SQLCODE is less than 0, an SQL error was encountered

• SQLCODE = 100, "no data" was found. For example, a FETCH statement returned no data because the cursor
was positioned after the last row of the result table
• The HAVING clause was added to SQL because the WHERE keyword cannot be used with
aggregate functions. HAVING Syntax. SELECT column_name(s) FROM table_name

• Types of db models
• network
• Hireacrchy
• Object
• relational

• Like Clause
• .g. SELECT CUST_NO, CUST_NAME, CUST_ADDR
• FROM CUSTOMER
• T_ID like/not like ‘425%’
commands
• Intersect:it simply gives the data of two select common data
• Joins:full,inner,left outerjoin,right outer join
• Select cust_no,cust_name from customer where cust_no between
1000 and 2000
• In(1000,2000)
• Where cust_no like ‘425%’(‘425_’)
• Index:it is set of pointers to rows of a table
• Usage:uniqueness and fast retrieval of data
• CREATE UNIQUE INDEX index ON TABLE(col_name)
• VIEW:Logical derivation of a table from the other table
• CREATE VIEW view_name AS SELECT col_1,col_2 FROM TABLE WHERE condition

• ALIAS:another name to a table,it wont be dropped even the table drops


CREATE ALIAS alia_name FOR TABLE;
• SYNONYMN:it is also another name for the table.It will be dropped when the table
drops.It is accessible only to the owner of the table
CREATE SYNONYM syn_name FOR TABLE;
• SQLCA:SQL Communication Area.It is a copy book which have to include in working-storage section
• It holds the host variables through which DB2 communicates about the status to the application program after
every execution of SQL Statement
• PRECOMPILER:
• It separates the cobol and db2 code in the program
• Precompiler takes db2 and cobol as input and separates the cobol,db2 statements to the two different
libararies(cobol load lib,dbrmlib)
 Checks sysntax errors and checks data types of db2 code before placing into the dbrmlib
 Creation of DBRM
• BIND:It is the process of generating a Plan /Package from DBRM
Verification of authority on DB2 Objects
Plan:
Package:intermediate component between dbrm and plan
PACKAGE:A package contains control structures that DB2 uses when it runs SQL statements.It contains executable
forms SQL statments
GDG BASE,GDG VERSIONS
• STEP01 EXEC PGM=IEFBR14
• GEN1 DD DSN=TCHN214.INPUT.RETAIL(+1),
• DISP=(NEW,CATLG),SPACE=(TRK,(1,1)),
• DCB=(LRECL=80,RECFM=FB,BLKSIZE=8000),
• UNIT=SYSDA

• STEP00 EXEC PGM=IDCAMS


• SYSPRINT DD SYSOUT=*
• SYSIN DD *
• DELETE TCHN214.INPUT.RETAIL FORCE
• DEFINE GDG (NAME(TCHN214.INPUT.RETAIL) -
• LIMIT(10) -
• EMPTY -
• SCRATCH)
GDG USE
• We do not need to create a new JCL or change the name of the JCL every time in a weekly run or
daily run or monthly run or yearly run of a JCL.
• You can set the limit of the related files(generations)
• We can easily keep track of all generation of data sets
• We can delete or uncatalog the older generation
• Any particular generation can be referred easily.
• SCRATCH -Physically delete the dataset(generation) which is uncataloged
• NOSCRATCH – Don’t Physically delete the dataset(generation) which is uncataloged
• Generation(0) means current generation.
– Generation(-1) means previous generation.
– Generation(+1) means the next generation one level after the current
generation.
• Cluster:group of datasets
• Numeric:
• Soc4:data field length error
• Soc7:numeric data type error
• Exit program,goback-same:goes to the main program
• Stoprun- it terminates the main program
• next sentence:it will go to next step
• Continue:it will move to next line
• Gdg Limit:255,254
• Exec no:255
• Typrun:it scans the code for syntax errors before providing resources to it.
• Symboilc para:to passes the values
• Represented with ‘&’
• Distinct:remove duplicates(select distinct workdept from emp)
• Groupby:grouping when the rows in a table having same values
• 04:we can get to know that ksds is empty
• Static:
• Dynamic:
• Lock:is the mechanism
• Different locks:x-lock,u-lock,dead lock,share lock
• for
• DBRM:Data Base Request Module.It contains sql statements extracted by the sql
precompiler.
• PACKAGE:
• A package contains control
EXEC SQL structures that DB2 uses when it runs SQL
statements. It contains executable formsSALARY
SELECT EMPNO, of SQL statements.
INTO Packages are stored
in the database system catalog tables. :WS-SALARY WHERE
:WS-EMPNO,
NAME = :WS-NAME FROM EMPLOYEE
END-EXEC
• Esds:
• Ksds:records are arranged based on key field.random,sequential,skip[ sequential
• Esds:records are storaed in the order in which they have entered.deletion of the
records I not possible
• Rrds:records are retrived by their relative record number
• Lds:contains bytes.It is byte streamed data.
• Aggregate functions
• Sum(),avg(),min(),max(),count()
• Scalar fun:trim(),lcase(),ucase(),round()
• Groupby :it groups the rows which are having the same values
• Orderby-asc,desc
• Foreignkey:it is a set of attribute(column) in a tables that refers to the
primary key in another tables
• Stogroup:collection of sametype of volumes
• SORT FIELDS=COPY
• OUTFIL FNAMES=(SPLIT1,SPLIT2,SPLIT3),SPLIT
• SORT FIELDS=COPY
• OUTFIL FNAMES=(SPLIT1,SPLIT2,SPLIT3),SPLITBY=4
• SORT FIELDS=COPY
• OUTFIL FNAMES=(SPLIT1,SPLIT2,SPLIT3),SPLIT1R=4
• Include cond=(01,05,ch,eq,c’name’)
• Omit cond=
• Inrec,outrec,merge,sort,sum
• (Seqnum,4,zd,start=1000,incr=2)
• DBRM that will be used to bind against a particular DB2 subsystem.
• Steplib and joblib:
• joblib-it effect all the steps in a jcl.it placed after job statement
• steplib:it effect particular step.It placed after exec statement.

You might also like