Wednesday, May 23, 2012

Cobol Interview Questions 3

What is the maximum value that can be stored in S9(8) COMP ?
99999999

What is COMP SYNC ?
Causes the item to be aligned on natural boundaries. Can be SYNCHRONIZED LEFT or RIGHT. For binary data items, the address resolution is faster if they are located at word boundaries in the memory.
For example, on main frame the memory word size is 4 bytes. This means that each word will start from an address divisible by 4. If my first variable is x(3) and next one is s9(4) comp, then if you do not specify the SYNC clause, S9(4) COMP will start from byte 3 ( assuming that it starts from 0 ).
If you specify SYNC, then the binary data item will start from address 4. You might see some wastage of memory, but the access to this computational field is faster.

What is the maximum size of a 01 level item in COBOL I ? in COBOL II ?
In COBOL II: 16777215

How do you reference the following file formats from COBOL programs: ?
Fixed Block File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, BLOCK CONTAINS 0.
Fixed Unblocked - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, do not use BLOCK CONTAINS
Variable Block File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS V, BLOCK CONTAINS 0. Do not code the 4 bytes for record length in FD ie JCL rec length will be max rec length in pgm + 4
Variable Unblocked - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS V, do not use BLOCK CONTAINS. Do not code 4 bytes for record length in FD ie JCL rec length will be max rec length in pgm + 4.
ESDS VSAM file - Use ORGANISATION IS SEQUENTIAL.
KSDS VSAM file - Use ORGANISATION IS INDEXED, RECORD KEY IS, ALTERNATE RECORD KEY IS .
RRDS File - Use ORGANISATION IS RELATIVE, RELATIVE KEY IS .
Printer File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, BLOCK CONTAINS 0. (Use RECFM=FBA in JCL DCB).

What are different file OPEN modes available in COBOL ?
Open for INPUT, OUTPUT, I-O, EXTEND.

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

In the JCL, how do you define the files referred to in a subroutine ?
Supply the DD cards just as you would for files referred to in the main program.

Can you REWRITE a record in an ESDS file ? Can you DELETE a record from it ?
Can rewrite (record length must be same), but not delete.

What is file status 92 ?
Logic error. e.g., a file is opened for input and an attempt is made to write to it.

What is file status 39 ?
Mismatch in LRECL or BLOCKSIZE or RECFM between your COBOL pgm & the JCL (or the dataset label). You will get file status 39 on an OPEN.

What is Static and Dynamic linking ?
In static linking, the called subroutine is link-edited into the calling program , while in dynamic linking, the subroutine & the main program will exist as separate load modules.
You choose static/dynamic linking by choosing either the DYNAM or NODYNAM link edit option. (Even if you choose NODYNAM, a CALL identifier (as opposed to a CALL literal), will translate to a DYNAMIC call).
A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL or you do a CANCEL. A dynamically called routine will always be in its initial state.

What is AMODE(24), AMODE(31), RMODE(24) and RMODE(ANY) ?
(applicable to only MVS/ESA Enterprise Server). These are compile/link edit options. Basically AMODE stands for Addressing mode and RMODE for Residency mode.
AMODE(24) - 24 bit addressing; AMODE(31) - 31 bit addressing.
AMODE(ANY) - Either 24 bit or 31 bit addressing depending on RMODE.
RMODE(24) - Resides in virtual storage below 16 Meg line. Use this for 31 bit programs that call 24 bit programs. (OS/VS Cobol pgms use 24 bit addresses only).
RMODE(ANY) - Can reside above or below 16 Meg line.

What compiler option would you use for dynamic linking ?
DYNAM.

What is SSRANGE, NOSSRANGE ?
These are compiler options with respect to subscript out of range checking. NOSSRANGE is the default and if chosen, no run time error will be flagged if your index or subscript goes out of the permissible range.

How do you set a return code to the JCL from a COBOL program ?
Move a value to RETURN-CODE register. RETURN-CODE should not be declared in your program.

How can you submit a job from COBOL programs ?
Write JCL cards to a dataset with //xxxxxxx SYSOUT= (A,INTRDR) where 'A' is output class, and dataset should be opened for output in the program. Define a 80 byte record layout for the file.

Q57) What are the differences between OS VS COBOL and VS COBOL II ?

Q57) OS/VS Cobol pgms can only run in 24 bit addressing mode, VS Cobol II pgms can run either in 24 bit or 31 bit addressing modes. I. Report writer is supported only in OS/VS Cobol. II. USAGE IS POINTER is supported only in VS COBOL II. III. Reference modification e.g.: WS-VAR(1:2) is supported only in VS COBOL II. IV. EVALUATE is supported only in VS COBOL II. V. Scope terminators are supported only in VS COBOL II. VI. OS/VS Cobol follows ANSI 74 stds while VS COBOL II follows ANSI 85 stds. VII. Under CICS Calls between VS COBOL II programs are supported.

Q58) What are the steps you go through while creating a COBOL program executable ?

Q58) DB2 precompiler (if embedded SQL used), CICS translator (if CICS pgm), Cobol compiler, Link editor. If DB2 program, create plan by binding the DBRMs.

Q59) Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?

Q59) In non-CICS environment, it is possible. In CICS, this is not possible.

Q60) What are the differences between COBOL and COBOL II ?

A60) There are at least five differences: COBOL II supports structured programming by using in line Performs and explicit scope terminators, It introduces new features (EVALUATE, SET. TO TRUE, CALL. BY CONTEXT, etc) It permits programs to be loaded and addressed above the 16-megabyte line It does not support many old features (READY TRACE, REPORT-WRITER, ISAM, Etc.), and It offers enhanced CICS support.

Cobol Interview Questions 2

In an EVALUATE statement, can I give a complex condition on a when clause ?
Yes.

What is a scope terminator ?
Scope terminator is used to mark the end of a verb e.g. EVALUATE, END-EVALUATE; IF, END-IF.

How do you do in-line PERFORM ?
PERFORM ... ... END-PERFORM

When would you use in-line perform ?
When the body of the perform will not be used in other paragraphs. If the body of the perform is a generic type of code (used from various other places in the program), it would be better to put the code in a separate Para and use PERFORM Para name rather than in-line perform.

What is the difference between CONTINUE & NEXT SENTENCE ?
They appear to be similar, that is, the control goes to the next sentence in the paragraph. But, Next Sentence would take the control to the sentence after it finds a full stop (.). Check out by writing the following code example, one if sentence followed by 3 display statements (sorry they appear one line here because of formatting restrictions) If 1 > 0 then next sentence end if display 'line 1' display 'line 2'. display 'line 3'. *** Note- there is a dot (.) only at the end of the last 2 statements, see the effect by replacing Next Sentence with Continue ***

What does EXIT do ?
Does nothing ! If used, must be the only sentence within a paragraph.

Can I redefine an X(100) field with a field of X(200) ?
Yes. Redefines just causes both fields to start at the same location.
For example:
01 WS-TOP PIC X(1)
01 WS-TOP-RED REDEFINES WS-TOP PIC X(2).

If you MOVE '12' to WS-TOP-RED, DISPLAY WS-TOP will show 1 while DISPLAY WS-TOP-RED will show 12.

Can I redefine an X(200) field with a field of X(100) ?
Yes.

What do you do to resolve SOC-7 error ?
Basically you need to correcting the offending data. Many times the reason for SOC7 is an un-initialized numeric item. Examine that possibility first. Many installations provide you a dump for run time abend’s ( it can be generated also by calling some subroutines or OS services thru assembly language).
These dumps provide the offset of the last instruction at which the abend occurred. Examine the compilation output XREF listing to get the verb and the line number of the source code at this offset. Then you can look at the source code to find the bug. To get capture the runtime dumps, you will have to define some datasets (SYSABOUT etc ) in the JCL. If none of these are helpful, use judgement and DISPLAY to localize the source of error. Some installation might have batch program debugging tools. Use them.

How is sign stored in Packed Decimal fields and Zoned Decimal fields ?
Packed Decimal fields: Sign is stored as a hex value in the last nibble (4 bits ) of the storage. Zoned Decimal fields: As a default, sign is over punched with the numeric value stored in the last bite.

How is sign stored in a comp-3 field ?
It is stored in the last nibble. For example if your number is +100, it stores hex 0C in the last byte, hex 1C if your number is 101, hex 2C if your number is 102, hex 1D if the number is -101, hex 2D if the number is -102 etc...

How is sign stored in a COMP field ?
In the most significant bit. Bit is ON if -ve, OFF if +ve.

What is the difference between COMP & COMP-3 ?
COMP is a binary storage format while COMP-3 is packed decimal format.

What is COMP-1 ? COMP-2 ?
COMP-1 - Single precision floating point. Uses 4 bytes. COMP-2 - Double precision floating point. Uses 8 bytes.

How do you define a variable of COMP-1 ? COMP-2 ?
No picture clause to be given. Example 01 WS-VAR USAGE COMP-1.

How many bytes does a S9(7) COMP-3 field occupy ?
Will take 4 bytes. Sign is stored as hex value in the last nibble. General formula is INT((n/2) + 1)), where n=7 in this example.

How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy ?
Will occupy 8 bytes (one extra byte for sign).

How many bytes will a S9(8) COMP field occupy ?
4 bytes.

Cobol Interview Questions 1

Name the divisions in a COBOL program ?
IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION.

What are the different data types available in COBOL ?
Alpha-numeric (X), alphabetic (A) and numeric (9).

What does the INITIALIZE verb do ?
Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES.
Numeric, Numeric edited items set to ZERO. FILLER , OCCURS DEPENDING ON items left untouched.

What is 77 level used for ?
Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

What is 88 level used for ?
For condition names.

What is level 66 used for ?
For RENAMES clause.

What does the IS NUMERIC clause establish ?
IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed decimal items. IS NUMERIC returns TRUE if the item only consists of 0-9. However, if the item being tested is a signed item, then it may contain 0-9, + and - .

How do you define a table/array in COBOL ?
ARRAYS. 05 ARRAY1 PIC X(9) OCCURS 10 TIMES. 05 ARRAY2 PIC X(6) OCCURS 20 TIMES INDEXED BY WS-INDEX.

Can the OCCURS clause be at the 01 level ?
No.

What is the difference between index and subscript ?
 Subscript refers to the array occurrence while index is the displacement (in no of bytes) from the beginning of the array. An index can only be modified using PERFORM, SEARCH & SET. Need to have index for a table in order to use SEARCH, SEARCH ALL.

What is the difference between SEARCH and SEARCH ALL ?
SEARCH - is a serial search. SEARCH ALL - is a binary search & the table must be sorted ( ASCENDING/DESCENDING KEY clause to be used & data loaded in this order) before using SEARCH ALL.

What should be the sorting order for SEARCH ALL ?
It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the search to be done on an array sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (You must load the table in the specified order).

What is binary search ?
Search on a sorted array. Compare the item to be searched with the item at the center. If it matches, fine else repeat the process with the left half or the right half depending on where the item lies.

My program has an array defined to have 10 items. Due to a bug, I find that even if the program access the 11th item in this array, the program does not abend. What is wrong with it ?
Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE.

How do you sort in a COBOL program Give sort file definition, sort statement syntax and meaning. ?
Syntax: SORT file-1 ON ASCENDING/DESCENDING KEY key.... USING file-2 GIVING file-3. USING can be substituted by INPUT PROCEDURE IS para-1 THRU para-2 GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2.

File-1 is the sort (work) file and must be described using SD entry in FILE SECTION. file-2 is the input file for the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL. file-3 is the out file from the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL. file-1, file-2 & file-3 should not be opened explicitly.
INPUT PROCEDURE is executed before the sort and records must be RELEASEd to the sort work file from the input procedure. OUTPUT PROCEDURE is executed after all records have been sorted. Records from the sort work file must be RETURNed one at a time to the output procedure.

How do you define a sort file in JCL that runs the COBOL program ?
Use the SORTWK01, SORTWK02,..... dd names in the step. Number of sort datasets depends on the volume of data being sorted, but a minimum of 3 is required.

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.

What is the use of EVALUATE statement ?
Evaluate is like a case statement and can be used to replace nested Ifs. The difference between EVALUATE and case is that no 'break' is required for EVALUATE i.e. control comes out of the EVALUATE as soon as one match is made.

What are the different forms of EVALUATE statement ?
EVALUATE

  EVALUATE SQLCODE ALSO FILE-STATUS
    WHEN A=B AND C=D
    WHEN 100 ALSO '00'
  imperative stmt imperative stmt
    WHEN (D+X)/Y = 4 WHEN -305 ALSO '32'
  imperative stmt imperative stmt
    WHEN OTHER WHEN OTHER
  imperative stmt imperative stmt
 END-EVALUATE
END-EVALUATE

EVALUATE SQLCODE ALSO A=B
  EVALUATE SQLCODE ALSO TRUE
   WHEN 100 ALSO TRUE
   WHEN 100 ALSO A=B
    imperative stmt imperative stmt
   WHEN -305 ALSO FALSE
   WHEN -305 ALSO (A/C=4)
   imperative stmt imperative stmt
  END-EVALUATE
END-EVALUATE

How do you come out of an EVALUATE statement ?
After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement. There is no need of any extra code.

Static and Dynamic Subroutine Calls

Static CALLs

In COBOL, you normally call a subroutine like this:

     CALL 'A' USING arguments

The static form of the CALL statement specifies the name of the subroutine as a literal; e.g., it is in quotes.

This is the static form of a subroutine call.  The compiler generates object code for this which will cause the linker to copy the object module a.obj into your executable when it is linked.

In the static CALL statement, the COBOL program and all called programs are part of the same load module. When control is transferred, the called program already resides in storage, and a branch to it takes place. Subsequent executions of the CALL statement make the called program available in its last-used state, unless the called program has the INITIAL attribute. In that case, the called program and each program directly or indirectly contained within it are placed into its initial state every time the called program is called within a run unit.

So, if you modify "A" and recompile it, you must also relink all of the executables that call "A", because the each of the executables contains its own copy of "A".

Good Things About Static CALLs

Fewer files are needed to distribute your application because your application can be built into a single EXE file, or perhaps an EXE for your main, and a couple of DLLs for subordinate modules.  This generally makes it simpler to distribute and/or upgrade your end users.

No risk of mixing/matching different versions of your called subroutines, because they are bundled into your main program.

Bad Things About Static CALLs

You must relink all of the EXE and DLL files in your application that use a statically linked subroutine in order to use the newer version of the subroutine.

If your application contains DLLs that call a subroutine statically, each DLL will have its own copy of the subroutine, including the storage defined in the subroutine.  As a result, your application uses more storage than necessary.

If your application has multiple DLLs that use the same statically named subroutine, each DLL has its own copy of that subroutine and its storage.  Therefore, if you set a value in the subroutine in one of the DLLs, it's local to that DLL.  The copy linked to the other DLLs will not know about this.  This can be either a Good Thing or a Bad Thing, of course, but it's definitely a trap for the unwary.

Dynamic CALLs

In COBOL, the dynamic form of a subroutine call is coded like this:

 01  SUBROUTINE-A PIC X(8) VALUE 'A'.

     CALL SUBROUTINE-A USING arguments

The dynamic form of the CALL statement specifies the name of the subroutine using a variable; the variable contains the name of the subroutine to be invoked.

The difference is that the name of the subroutine is found in the variable SUBROUTINE-A.  The compiled code will cause the operating system to load the subroutine when it is required instead of incorporating it into the executable..

In this form of the CALL statement, the called COBOL subprogram is not link-edited with the main program, but is instead link-edited into a separate load module, and is loaded at run time only when it is required (that is, when called).

Each subprogram that you call with a dynamic CALL statement can be part of a different load module that is a member of either the system link library or a private library that you supply. In either case it must be in an MVS load library; it cannot reside in the hierarchical file system. When a dynamic CALL statement calls a subprogram that is not resident in storage, the subprogram is loaded from secondary storage into the region or partition containing the main program and a branch to the subprogram is performed.

The first dynamic call to a subprogram within a run unit obtains a fresh copy of the subprogram. Subsequent calls to the same subprogram (by either the original caller or any other subprogram within the same run unit) result in a branch to the same copy of the subprogram in its last-used state, provided the subprogram does not possess the INITIAL attribute. Therefore, the reinitialization of either of the following items is your responsibility:

If you call the same COBOL program under different run units, a separate copy of working storage is allocated for each run unit.

Note that you can also load a module dynamically by including it in a DLL and then linking it using the import library for that DLL!

Good Things About Dynamic CALLs

You don't need to relink your application if you change something in your subroutine; only the subroutine DLL needs to be relinked.

All executables that call this subroutine will share the same DLL; both the code and data.  Since your application only loads one copy of a dynamically called subroutine, it uses less memory.

Changes in values contained within the dynamically called subroutine are available to all the DLLs that use it, because they all share the same copy of the subroutine.

You can free memory that a dynamically called subroutine was using by CANCELing the subroutine.  This is, however, not generally of much use in the 32-bit Windows virtual-memory environment, since Windows will 'page out' inactive data from the computer's real memory pool anyway. 

Bad Things About Dynamic CALLs

Every dynamically called subroutine must be linked as a DLL (unless you use an import library to expose other entry points in a DLL). Therefore, if you application consists of hundreds of subroutines and they're all called dynamically, you will need to distribute hundreds of DLLs.

It's possible to mix versions of your DLLs.  This can be a problem both with distributing your application and with end-users installing updates improperly.

If one of your DLLs is missing, you may not know about it until the user exercises some facility that tries to call that DLL.  At that point, your application will terminate abnormally unless you handle this situation.

If you CALL a DLL, CANCEL it, then CALL it again, you incur more I/O because the routine needs to be reloaded if you CANCEL it.  This can slow down an application because it requires more disk activity.  Again, in the Windows environment this is usually unnecessary because Windows does an excellent job of managing memory.

If you mix and match static and dynamic calls to the same subroutine, your software might have several different versions in memory at once.  Guess how much fun it will be trying to debug THAT mess?

Which is better, Static or Dynamic CALLs?

The answer is, it depends.

Static subroutines are nice, because your application can be built into a single EXE file, or perhaps an EXE for your main, and a couple of DLLs for subordinate modules.

Dynamic subroutines are nice because you can manage memory differently and you can update a portion of your application by shipping a newer DLL instead of the entire application.

You really need to consider the pros and cons and how they affect your own application.  For what it's worth, though, we favor using a minimum of executable modules because it reduces headaches with mismatched or lost pieces of an application.  

Thursday, November 17, 2011

VSAM Interview Questions 1

What are the types of VSAM Datasets?
Entry sequenced Datasets (ESDS), Key sequenced Datasets (KSDS) and relative record Dataset
(RRDS), LDS (linear Data Set).
Why do VSAM take more disk space than other utilities?
VSAM increases the disk space requirements of
systems. This is because VSAM offers certain capabilities like partial
self-reorganization to make things more efficient in data sets that can be
modified.
What are the distinctive features of a KSDS, Key sequenced Dataset?
The index and the distributed free space. CI and CA splits upon updates. Record length may be changed during update. The records are accessed by a particular Key.
How are records stored in an ESDS, entry sequenced Dataset?
They are stored without respect to the contents of the records and in the order in which they are Included in the file.
What's a LDS (Linear Data Set) and what's it used for?
LDS is a VSAM Dataset in name only. It has unstructured 4k
(4096 bytes) fixed size CIs which do not contain control fields. There is no
free space, and no access from Cobol. LDS is essentially a table of data
maintained on disk. The 'table entries' must be created via a user program and
can only be logically accessed via a user program. When passed, the entire LDS
must be mapped into storage, then data is accessed via base and displacement
type processing.
In ESDS, do we have the facility of accessing the records randomly?
YES, Random access of records is possible. Records however cannot be deleted. We can do it By referring the RBA (relative byte address).
Why is the space is kept in data component of the KSDS Dataset?
Free space specified during the allocation of the KSDS is left at regular intervals during the initial load of the data set. This space helps keep the data component in physical sequence in
spite of Random insertions.
What is the difference b/w the ESDS and KSDS?
ESDS doesn’t have imbedded free space.The KEYS parameter has no meaning in the context of ESDS.ESDS has no index component.An additional parameter, NONINDEXED is used to tell AMS that an ESDS is being allocated.
How is LDS different from ESDS?
An LDS is a data set; very similar to an ESDS without the control information .It has no records and used for fast random access. It takes advantages of the computer’s very fast paging hardware for retrieval and storage and the bytes are implicitly divided into 4K blocks or pages, and the paging hardware reads and writes blocks from disk. There is no free space, unused
space, control field in LDS.
What is a CI, Control Interval?
A Control Interval is the unit of information that VSAM transfers between virtual and auxiliary storage.
What is Control Interval Split?
A new record stored in same CI, only if there is enough space. If not VSAM locates the free CI within the same CA, moves approximately half of the records to next CI and stores the new record at the correct position. This is called Control Interval Split. Whenever CI split
occurs the sequence set is updated.
What is a CA, control area?
A group of Control Intervals makes up a control area.
What are the types of VSAM Datasets?
Entry sequenced Datasets (ESDS),Key sequenced Datasets (KSDS),Relative record
Dataset (RRDS),LDS (linear Data Set).
Why do VSAM take more disk space than other utilities?
VSAM increases the disk space requirements of systems. This is because VSAM offers certain capabilities like partial self-reorganization to make things more efficient in data sets that can
be modified.
What are the distinctive features of a KSDS, Key sequenced Dataset?
The index and the distributed free space. CI and CA splits upon updates. Record length may be changed during update. The records are accessed by a particular Key.
How are records stored in an ESDS, entry sequenced Dataset?
They are stored without respect to the contents of the records and in the order in which they are Included in the file.
What's a LDS (Linear Data Set) and what's it used for?
LDS is a VSAM Dataset in name only. It has unstructured 4k (4096 bytes) fixed size CIs which do not contain control fields. There is no free space, and no access from Cobol. LDS is essentially a table of data maintained on disk. The 'table entries' must be created via a user program and
can only be logically accessed via a user program. When passed, the entire LDS
must be mapped into storage, then data is accessed via base and displacement
type processing.
In ESDS, do we have the facility of accessing the records randomly?
YES, Random access of records is possible.
Records however cannot be deleted. We can do it By referring the RBA (relative
byte address).
Why is the space is kept in data component of the KSDS Dataset?
Free space specified during the allocation of the KSDS is left at regular intervals during the initial load of the data set. This space helps keep the data component in physical sequence in spite of Random insertions.
What is the difference b/w the ESDS and KSDS?
ESDS doesn’t have imbedded free space.The KEYS parameter has no meaning in the context of ESDS.ESDS has no index component.An additional parameter, NONINDEXED is used to tell AMS that an ESDS is being allocated.
How is LDS different from ESDS?
An LDS is a data set; very similar to an ESDS without the control information .It has no
records and used for fast random access. It takes advantages of the computer’s
very fast paging hardware for retrieval and storage and the bytes are implicitly
divided into 4K blocks or pages, and the paging hardware reads and writes blocks
from disk. There is no free space, unused space, control field in LDS.
What is a CI, Control Interval?
A Control Interval is the unit of information that VSAM transfers between virtual and
auxiliary storage.
What is Control Interval Split?
A new record stored in same CI, only if there is enough space. If not VSAM locates
the free CI within the same CA, moves approximately half of the records to next
CI and stores the new record at the correct position. This is called Control
Interval Split. Whenever CI split occurs the sequence set is
updated.
What is a CA, control area?
A group of Control Intervals makes up a control area.
If the records are larger than the CI size, for ex. if a record extend CI boundary and extends unto 3 CI, and there is still some space left in last i.e. third CI, will that be used by other CI Datasets ?
NO. Some records are larger than the CI size, the records extend across CI boundaries (only for ESDS and KSDS). A spanned record begins on a CI boundary and it occupies two or more CIs in a CA.
The unused space in the last CI can only be used to extend the record, it cannot
contain any other record i.e. a new record has to be added in a new
CI.
What is a sequence set?
This is the part of the index that points to the CA and CI of the record being
accessed.
What is a cluster?
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, i.e. to all parts of the Dataset
simultaneously.
What is the index set?
This is the other part of the index. It has multiple levels with pointers that ultimately
reach to the sequence set.
What is a Catalog?
The catalog contains the names of all Datasets, VSAM and non-VSAM. It is used to
access these Datasets.
What is an alternate index?
An AIX is a file that allows access to a VSAM Dataset by a Key other than the
primary one. The Alternate Key-pointer pair records are stored in an index
cluster. This index cluster is known as Alternate index. The alternate
Key-pointer pair records are loaded into the alternate index cluster by the
command BLDINDEX.AIX can be built over a KSDS and ESDS, but not over an
RRDS.
What could be the maximum number of the AIXs per base cluster?
There can be a maximum of 253 AIXs per base cluster. It is
not advisable to have more than 5 AIXs per base cluster because of additional
overhead during updates and retrievals.
Can AIX be defined over an ESDS, which does not have any Key?
Although an ESDS does not have a primary Key, an AIX can be defined over an ESDS. In the case of an ESDS it is the relative byte address of the corresponding record in the base cluster that
is stored.
Can we access records in VSAM only by a single Key, i.e. primary Key?
It is also possible to access the records in a sequence other than that of the primary Key. Such Keys are called alternate Keys and they can be non-unique.For Example, in a pay-roll system where employee number is the unique primary Key and the Employee name as alternate
Key.
What is the 'verify' command in the VSAM files?
This command is used to close those files that are kept open after the abnormal termination of the file. It also brings the index component in sync with the data components and updates the catalog.
What is a path?
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 the upgrade set?
The upgrade set is the list of all AIXs that VSAM must maintain for a specific base cluster, so
that when data in the base cluster is updated, the AIX files are also updated.
What is free space?
Free space is reserved within the data component of a KSDS to accommodate inserting new records.

CICS Interview Questions 1

Question: what are the differences between DFHCOMMAREA and TSQ ?
Answer :Both are used to save data among tasks. But
1. COMMAREA is private to that transaction only . like every transaction has its
own COMMAREA created by CICS as soon as the transaction is initiated
.however TSQ , if queue id is known can be accessed by other transactions
also
2. COMMAREA length is s9(4) comp i.e. 64k .But TSQ can have any
length.
3. COMMAREA is available only during the transaction is running. TSQ
if created with auxiliary option resides in aux memory and available even if
main memory crashes.
4.normally COMMAREA is used to transfer data from one
task to another while tsq is used widely within the task as a scratch pad.
Question: How can you accomplish breakpoint in intertest?
Answer :U-for unconditional breakpoint, C-for conditional breakpoint, and A-for automatic breakpoint.

Question: what is difference between call and link ?
Answer :In case of call , whenever you do changes to the
called program you need to compile the calling program also. In case of link
, it is not needed .
Question: Which is the program which determines whether a transaction should be restarted ? Answer :DTB
Question: The EIB field which gives the last CICS command executed is ?
Answer :EIBRCODE
Question: If no exception handling is provided in the program, what will happen ?
Answer :CICS will take the default action specified for the condition.
Question: Which is the macro used for making an entry in the PPT ?
Answer :DFHPPT
Question: What is the error condition that is set when the file specified in the NAME option is not in the FCT?
Answer :PGMIDERR
Question: Why is it important not to execute a STOP RUN in CICS ?
Answer :Stop run will come out from the CICS region.
Question: Why must all CICS programs have a Linkage Section ?
Answer :To pass parameters from appl. Program to CICS.
Question: What is the CICS LOAD command?
Answer :The LOAD command retrieves an object program from disk and loads it into main storage - it's primarily used for a constant table that will be available system-wide.

Question: What is the ABEND command and when would you use it?
Answer :The ABEND command forces a task to end abnormally. It creates a transaction dump and invokes the dynamic transaction backout.
Question: What are the two outputs created as a result of generation of a map?
Answer :The map copybook(Symbolic map) and the load module(physical map).

Question: Why doesn't CICS use the Cobol Open and Close statements ?
Answer :CICS automatically opens & closes the files those are used in the program.
Question: If you use the OPTIMIZE compiler option the size of the program can be reduced by 5
to 10%(True or False)?
Answer :TRUE
Question: What is the attribute byte?(MAPS)
Answer :Defines the display/transmission of field. Most cases is an output field from the
program
Question: which CICS defined field can you determine the position of the cursor on the map ? Answer :ATTRIB FIELD FCT

Wednesday, November 16, 2011

JCL

2GB - Maximum region available for Job through REGION parameter.
8 - Maximum length of stepname/ddname/operation name.
15 - Maximum number of Jobs steps in a JCL.
15 - Maximum Instream Procedure in a Job.
16- Maximum number of extents for PS.(Extents - Non contigeous memory locations on a volume.)
20 - Maximum length of Programer Name.
22 - Maximum number of qualifiers in dataset name.
44 - Maximum lengthl of dataset name (Including periods).
80 - Maximum number of charecters in one line/record can be passed to Program through ACCEPT.
100 - Maximum number of characters passed through PARAM parameter.
123 - Maximum number of Extents for VSAM.
142 - Maximum number of characters coded in Accounting Information.
255 - Maximum number of EXEC steps in a Job.
255 - Maximum number of buffers coded in DCB parameter (BUFNO).
255 - Maximum number of JOB steps in a Procedure.
255 - Maximum number of generations within one GDG.
3273 - Maximum number of DD statemets in a single EXEC.
4095 - Maximum comparision code in COND condition.