Wednesday, December 25, 2013

How To ?



Q) How do you fire a ba tch job from a CICS transaction ?
A) Define an extrapartition TDQ as an internal reader and write the JCL to it. Terminate the JCL with /*EOF.


Q)  How can you submit a job from COBOL programs?
A) 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 fo r the file.

Q) How to code instream data in a PROC ?
A) Code SYSIN DD DUMMY in the PROC, and then override this from the JCL with instream data.
 
Q)  How  do  you  run  a  COBOL  batch  program  from  a  JCL?    How  do  you  run  a  COBOL/DB2 program?
A)  To run a non DB2 program,
//STEP001 EXEC PGM=MYPROG

To run a DB2 program,
//STEP001 EXEC PGM=IKJEFT01
//SYSTSIN DD *
DSN SYSTEM(....)
RUN PROGRAM(MYPROG)
PLAN(.....)  LIB(....)  PARMS(...)
/*

Saturday, November 2, 2013

CICS Interview Questions 5


Q)  What is the effect of including the TRANSID in the EXEC CICS RETURN command?
A)    The next time the end user presses an attention key, CICS will start the transaction specified in the TRANSID option.

Q)  Explain how to handle exceptional conditions in CICS.
A)    An  abnormal  situation  during  execution  of  a  CICS  command is called   an exceptional  condition".     
  There are various   ways  to  handle  these  exception  conditions:
1. Handle Condition Command: It is used to transfer control to the procedure label specified if   the exceptional   condition specified  occurs.
2. Ignore Condition Command: It causes no action to be taken if the condition specified occurs in the program. That is control will be returned to the next instruction following the command  which encountered  the  exceptional  condition.
3. No Handle Option: This option can be specified in any CICS command and it will  cause no
action to be  taken  for  any   exceptional   condition   occurring   during   execution  of  this  command.
4. RESP Option: This option can   be    specified  in  any  CICS  command. If the RESP option is specified in a  command, CICS places a response code at  a  completion of the command.  The
application program can check this code, then proceed to the next processing.

Handle condition:
Invalid handling of  CICS  error condition within the program causing the looping.  Here is one example, most program have EXEC CICS HANDLE CONDTION ERROR(label) or  EXEC  CICS HANDLE ABEND LABEL(label) to  trap  any  error condition or  abend.  This  type  of  coding  is usually acceptable if  they handle  the error / abend correctly in  their  handling paragraph.   However,  the  program  often  cause another error or abend  within  the handling routine.  In that case, looping or sos will occur.  I strong recommend that  the   following statement should  be included in  their  ERROR handling paragraph.                         
                              
EXEC CICS HANDLE CONDTION ERROR END-EXEC. It means that from  now on, CICS will handle all the errors and will not go back to error handling routine .For HANDLE ABEND, code EXEC CICS HANDLE ABEND CANCEL instead. Please check the application program reference manual for further explanation of these two commands. Besides, not  only these two HANDLE will cause the program, other  type of error handle might cause loop too.   So  code  the HANDLE command carefully.  It  is  a good program practice to deactivate  the  error  handling  by  EXEC  CICS  HANDLE  CONDITION condition END-EXEC. Once you know that the program won't need it anymore.         

Q)  What is the function of the EXEC CICS HANDLE CONDITION command?
A)    To specify the paragraph or program label to which control is to be passed if the “handle condition” occurs.
Q)    How many conditions can you include in a single HANDLE CONDITION command?
A)     No more than 16 in a single handle condition. If you need more, then you must code another HANDLE CONDITIONcommand.

Q)    What is the EXEC CICS HANDLE ABEND?
A)    It allows the establishing of an exit so cleanup processing can be done in the event of abnormal task termination.

Q)    What is the difference between EXEC CICS HANDLE CONDTION and an EXEC CICS IGNORE command?
A)     A HANDLE CONDITION command creates a “go-to” environment. An IGNORE command does not create a go-to environment; instead, it gives control back to the next sequential instruction following the command causing the condition. They are opposites.
Q)   What happens when a CICS command contains the NOHANDLE option?
A)    No action is going to be taken for any exceptional conditional occurring during the execution of this command. The abnormal condition that occurred will be ignored even if an EXEC CICS HANDLE condition exist. It has the same effect as the EXEC CICS IGNORE condition except that it will not cancel the previous HANDLE CONDITION for any other command. 

Q)    When a task suspends all the handle conditions via the PUSH  command, how does the task reactivate   all the handle conditions?
A)     By coding an EXEC CICS POP HANDLE command.

Q)    Explain re-entrancy as applies to CICS.
A)     Reentrant   program  is   a  program  which  does  not  modify itself  so  that  it  can   reenter to itself  and continue  processing   after   an   interruption   by  the  operating  system which, during   the   interruption, executes other   OS  tasks  including    OS    tasks    of   the    same     program.    It   is   also  called  a "reenterable"  program  or"serially  reusable"  program.

A quasi-reentrant program is a reentrant program under the CICS environment.  That   is,   the  quasi-reentrant  program is a CICS program which does not modify itself. That way it can reenter to itself and continue   processing after an interruption by CICS which,  during  the  interruption, executes other  tasks  including  CICS  tasks  of  the  same  program. In  order  to  maintain  the  quasi-reentrancy,  a  CICS  application  program  must  follow  the  following  convention:

Constants in Working Storage:  The quasi-reentrant program defines only constants in its ordinary data area (e.g. working Storage Section ). These constants will never be modified and shared  by  the tasks.

Variable in Dynamic  Working  Storage: The quasi reentrant  program acquires a unique storage area (called Dynamic Working  Storage --DWS) dynamically  for  each  task by issuing  the  CICS  macro equivalent  GETMAIN.  All variables  will be placed in  this DWS for each task. All counters  would   have  to be initialized  after the DWS has been  acquired.

Restriction on Program  Alteration:  The  program must   not   alter   the   program  itself.  If  it  alters  a CICS macro  or  command,   it   must  restore  the  alteration   before   the   subsequent  CICS  macro  or command.

Q)    What are the CICS commands available for program control?
A)     The  following  commands  are  available  for  the  Program  Conrol services:
1.       LINK: To pass control  to  another  program  at  the   lower  level,  expecting  to  be  returned.
2.       XCTL:          To pass control to another  program  at the same  level,  not expecting  to be returned.
3.       RETURN:     To return   to    the    next   higher-level program  or  CICS.
4.       LOAD:          To  load  a  program.
5.       RELEASE:  To  release  a  program.

Saturday, October 19, 2013

CICS Interview Questions 4

Q)  Mention the option (along with argument type) used in a CICS command to retrieve the response code after execution of the command.
A)  RESP( S9(8) COM.)

Q)  What’s the CICS command used to access current date and time?
A)  ASKTIME.

Q)  Into what fields will the date and time values be moved after execution of the above command?
A)  EIBDATE & EIBTIME.

Q)    How do you terminate an already issued DELAY command?
A)  EXEC CICS CANCEL
        REQID(id)
     END-EXEC

Q)    How do you dynamically set the CURSOR position to a specific field?
A)  MOVE –1 to FIELD+L field. Mention CURSOR option in the SEND command.

Q)    Which option of the PCT entry is used to specify the PF key to be pressed for initiating a transaction?
A)  TASKREQ=PF1

Q)    Specify the CICS command used to read a VSAM record starting with prefix “F”. Code all the relevant options.
A)  EXEC CICS READ
           DATASET(‘FILENAME’)
     INTO(data-area)
           RIDFLD(data-area)
     KEYLENGTH(1)
           GENERIC
     LENGTH(WK-LEN)
     END-EXEC.

Q)    Mention the option used in the CICS READ command to gain accessibility directly to the file I/O area. (AssumeCOBOL-II).
A)  SET(ADDRESS OF LINKAGE-AREA).

Q)    Which command is used to release a record on which exclusive control is gained?
A)  EXEC CICS UNLOCK END-EXEC.

Q)    How do you establish a starting position in a browse operation?
A)     EXEC CICS STARTBR---------- END-EXEC.

Q)    What is the option specified in the read operation to gain multiple concurrent operations on the same dataset?
A)     REQID(value).

Q)    What is the CICS command that gives the length of TWA area?
A)     EXEC CICS ASSIGN
TWALENG(data-value)
END-EXEC.

Wednesday, October 2, 2013

CICS Interview Questions 3

Q) What does “Pseudo Conversational” mean?
A) The programming technique in which the task will not wait for the end-user replies on the terminal. Terminating the task every time the application needs a response from the user and specifying the next transaction to be started when the end user press any attention key (Enter, PF1 through PF24, PA1,PA2 and Clear) is pseudo-conversational processing.

Q) What is the function of the CICS translator?
A) The CICS translator converts the EXEC CICS commands into call statements for a specific programming language.
   There are CICS translators for Assembler, COBOL, and PL/1.

Q) How can you start a CICS transaction other than by keying the Transaction ID at the terminal?
A) By coding an EXEC CICS START in the application program
1. By coding the trans id and a trigger level on the DCT table
2. By coding the trans id in the EXEC CICS RETURN command
3. By associating an attention key with the Program Control Table
4. By embedding the TRANSID in the first four positions of a screen sent to the terminal.
5. By using the Program List Table

Q) What is the purpose of the Program List Table?
A) The Program List Table records the set of applications programs that will be executed automatically at CICS start-up time.

Q) What are the differences between and EXEC CICS XCTL and an EXEC CICS START command?
A) The XCTL command transfer control to another application (having the same Transaction ID), while the START command initiates a new transaction ID (therefore a new task number). The XCTL continues task on the same terminal. START can initiate a task on another terminal.

Q) What are the differences between an EXEC CICS XCTL and an EXEC CICS LINK command?
A) The XCTL command transfer control to an application program at the same logical level (do not expect to control back), while the LINK command passes control to an application program at the next logical level and expects control back.

Q) What happens to resources supplied to a transaction when an XCTL command is executed?
A) With an XCTL, the working storage and the procedure division of the program issuing the XCTL are released. The I/O areas, the GETMAIN areas, and the chained Linkage Section areas (Commarea from a higher level) remain. All existing locks and queues also remain in effect. With a LINK, however, program storage is also saved, since the transaction expects to return and use it again.

Q) What CICS command do you need to obtain the user logon-id?
A) You must code EXEC CICS ASSIGN with the OPERID option.

Q) What is a resident program?
A) A program or map loaded into the CICS nucleus so that it is kept permanently in main storage and not deleted when CICS goes “Short On Storage”.

Q) What is EIB. How it can be used?
A) CICS automatically provides some system-related  information to  each  task  in  a  form  of  EXEC Interface Block (EIB), which is unique to the CICS command level. We can use  all  the fields  of EIB in  our application  programs  right  away.

Q) What does “Pseudo Conversational” mean?
A) The programming technique in which the task will not wait for the end-user replies on the terminal. Terminating the task every time the application needs a response from the user and specifying the next transaction to be started when the end user press any attention key (Enter, PF1 through PF24, PA1,PA2 and Clear) is pseudo-conversational processing.

Q) What is the function of the CICS translator?
A) The CICS translator converts the EXEC CICS commands into call statements for a specific programming language.
   There are CICS translators for Assembler, COBOL, and PL/1.

Q) How can you start a CICS transaction other than by keying the Transaction ID at the terminal?
A) By coding an EXEC CICS START in the application program
1. By coding the trans id and a trigger level on the DCT table
2. By coding the trans id in the EXEC CICS RETURN command
3. By associating an attention key with the Program Control Table
4. By embedding the TRANSID in the first four positions of a screen sent to the terminal.
5. By using the Program List Table

Q) What is the purpose of the Program List Table?
A) The Program List Table records the set of applications programs that will be executed automatically at CICS start-up time.

Q) What are the differences between and EXEC CICS XCTL and an EXEC CICS START command?
A) The XCTL command transfer control to another application (having the same Transaction ID), while the START command initiates a new transaction ID (therefore a new task number). The XCTL continues task on the same terminal. START can initiate a task on another terminal.

Q) What are the differences between an EXEC CICS XCTL and an EXEC CICS LINK command ?
A) The XCTL command transfer control to an application program at the same logical level (do not expect to control back), while the LINK command passes control to an application program at the next logical level and expects control back.

Q) What happens to resources supplied to a transaction when an XCTL command is executed?
A) With an XCTL, the working storage and the procedure division of the program issuing the XCTL are released. The I/O areas, the GETMAIN areas, and the chained Linkage Section areas (Commarea from a higher level) remain. All existing locks and queues also remain in effect. With a LINK, however, program storage is also saved, since the transaction expects to return and use it again.

Q) What CICS command do you need to obtain the user logon-id?
A) You must code EXEC CICS ASSIGN with the OPERID option.

Q) What is a resident program?
A) A program or map loaded into the CICS nucleus so that it is kept permanently in main storage and not deleted when CICS goes “Short On Storage”.

Q) What is EIB. How it can be used?
A) CICS automatically provides some system-related  information to  each  task  in  a  form  of  EXEC Interface Block (EIB), which is unique to the CICS command level. We can use  all  the fields  of EIB in  our application  programs  right  away.

Q) What is some of the information available in the EIB area?
A)
I. The cursor position in the map
II.Transaction ID
III.Terminal ID
IV. Task Number
V.  Length of  communication area
VI. Current date and time
VII.Attention identifier

Q) What information can be obtained from the EIBRCODE?
A) The EIBRCODE tells the application program if the last CICS command was executed successfully and, if not, why not.

Saturday, September 7, 2013

Defaults

JCL Defaults
1.(NEW,DELETE,DELETE)  - DISP Parameter
2. 5 Buffers - BUFNO Parameter in DCB

COBOL Defaults
1.Trailing - Default for SIGN clause
2.Ascending - SEARCH ALL
3.NOSSRANGE - Subscript out of ranger checking

DB2 Defaults
1.BP00,BP01,BP02 & BP32 - Default Buffers in DB2
2.REPLACE - ACTION Parameter in BIND card
3.VALIDATE - RUN parameter in BIND CARD
4.ASCENDING - ORDER BY in Sort

CICS Interview Questions 2

Q) What  are the  six  different  types  of  argument  values  in  COBOL  that  can  be  placed in various options of a CICS command?
A)
Data Value -  EX (Literal 8 or 7 7 KEYLEN PIC S9(4 ) COMP VALUE 8.)
   Data Area    -  EX (01 RECORD-AREA.
                                  05 FIELD1 PIC X(5). )
   Pointer-Ref   - EX (05 POINTER-I PIC S9(8) COMP. )
   Name           - EX (05 FILE-NAME PIC X(5) VALUE ‘FILEA’. )
   Label            - Cobol paragraph name
   HHMMSS    -  EX (77 TIMEVAL PIC S9(7) COMP3. )

Q) Kindly specify the PIC clause for the following
   Any BLL Cell, Data type of Length Option field, HHMMSS type of data fields
A) Any BLL Cell       - S9(8) COMP
   Data type of Length Option field   - S9(4) COMP
   HHMMSS type of data fields         -  S9(7) COMP3

Q) Specify CICS transaction initiation process. (From the perspective of CICS control programs and control tables.)
A)
TCP places d ata in TIOA and corresponding entry into TCT.
KCP acquires the transaction identifier from TIOA and verifies if it is present in PCT.
SCP acquires Storage in Task Control Area (TCA), in which KCP prepares control data for the task.
KCP then loads the application programs mentioned in PCT by looking for it in PPT.
If resid ent -  real storage memory location is not present in the  PPT  the control  is  passed  to  PCP that
loads the application programs from the physical storage location address given in PPT. The control is
then passed to  the application program (LOAD module).

Q) List the sequence of steps used to achieve “Modification in Skip Sequential Mode.”
A) I.  READNEXT command
II.  Issue the ENDBR command
III.  Issue the READ command with UDTAE optio n.
IV.  Manipulate the record (DELETE or REWRITE command)
V.  Issue START command
VI.  Issue two READNEXT commands (One for dummy skip)
VII. Go to step two.

Q) Specify the requirements for Auto matic Task Initia tion. (Mention the control table, it’s entries
and the corresponding Procedure division CICS command).
A)
DFHDCT  TYPE=INTRA,
       DESTID=MSGS,
          TRANSID=MSW1,
           TRIGLEV=1000

    EXEC CICS WRITEQ TD
    QUEUE(‘MSGS’),
    FROM(DATA-AREA),
    LENGTH(MSG_LEN)
    END-EXEC.

Q) What are the commands used to gain exclusive control over a resource (for Ex a Temporary storage queue.)?
A)
EXEC CICS ENQ       EXEC CICS DEQ
    RESOURCE(QID)      RESOURCE(QID)
   END-EXEC            END-EXEC

Q) What is the EIB parameter and  the CICS command used to implement Pseudo-Conversa tional
   technique using single PCT - Single PPT entry?
A)
EIBCALEN - To check if COMMAREA has been passed in terurn command.
    EXEC CICS RETURN
    TRANSID(data-name)
    COMMAREA(data-area)
    LENGTH(data-value)
    END-EXEC

Q) Mention the 5 fields available in the symbolic map for every ‘NAMED’ field in the DFHMDI
macro? Give a brief description of these fields (Not exceeding a line).
A)
FIELD+L - Return the length of text entered (or for dymanic cursor positioing)
   FIELD+F  - Returns X(80) if data entered but erased.
   FIELD+A  - Used for attributes reading and setting
   FIELD+I  - Used for reading the text entered while receiving the map.
   FIELD+O  - Used for sending information on  to the MAP.

Q) What are the two ways of breaking a CPU bound process to allow other tasks to gain access to CPU.
A)
EXEC CICS DELAY       EXEC CICS DELAY
    INTERVAL(hhmmss)        TIME(hhmmss)
    END-EXEC              END-EXEC

POST and  WAIT commands also achieve the same result.

Q) How do you initiate another transaction? The transaction initiated should be in a position to retrieve information  pertaining  to  which  transaction  has initia ted  it and  from  which  terminal. (Code the required CICS commands)
A)
EXEC CICS START
    INTERVAL(hhmmss)/TIME(hhmmss)
    TRANSID(‘TRAN’)
    TERMID(‘TRM1)
    FROM(data-area)
    LENGTH(data-value)
    RTRANSID(EIBTRNID)
    RTERMID(EIBTRMID)
   END-EXEC

   EXEC CICS RETRIEVE
    INTO(data-area)
    LENGTH(data-value)
    RTRANSID(data-name)
    RTERMID(data-name)
   END-EXEC

Sunday, September 1, 2013

COBOL

8 - Maximum length of Program ID.
7 - Maximum Level in OCCURS clause.
18 - Maximum numbers of digits in a numeric field.
30 - Maximum length of name of Identifier.
120 - Maximum numbers of characters in an alphanumeric field.

Sunday, August 25, 2013

JCL Specials

Symbols used in JCL datasets
1. && - Temporary Datasets
2. & -  Symbolic parameters in procedures
3. * - Referbacks

Temp Datasets
1. Without DSN - //DATA1 DD
2. With DSN    - //DATA2 DD DSN=&&tempdata

Special Programs
1. IGYCRCTL - Compilation
2. IEWL     - Link/Edit 
3. DSNHPC   - Precompile
4. IKJEFT01 - Bind

System Programs
1. IEF* - Program produced by scheduler group
2. IEB* - Dataset utility programs
3. IEH* - System utility programs
4. IEW* - Linkage/Loading programs

Sunday, August 18, 2013

Overrides In JCL

1. REGION Parameter - JOB Over-rides EXEC

//JOB1 JOB (A123),'XYZ'
//        REGION=40K   
//STEP1 EXEC PGM=PGM1,REGION=10K
//STEP2 EXEC PGM=PGM2,REGION=20K

Example : If STEP1 utilises complete 10K,also STEP2 utilises 20K but require more region , it over-rides its step region declaration and utilises the job region declaration (Provided there is no region requirement from any other step).
But if it exceeds the JOB region declaration, the job abebds.

2.TIME Parameter - EXEC Over-rides JOB

//JOB1 JOB (A123),'XYZ'
//        TIME=12
//STEP1 EXEC PGM=PGM1,TIME=04
//STEP2 EXEC PGM=PGM2,TIME=04
//STEP3 EXEC PGM=PGM3,TIME=02

Example : If STEP1 or STEP2 utilises more than 4 minutes,then even though total time for job is 12 minutes, the steps are not executed and the job abends.
If JOB is coded smaller time than the EXEC, then the JOB will terminateto the specified time of the JOB.

3. COND Paramter - JOB Over-rides EXEC

4. JOBLIB AND STEPLIB Parameters - STEPLLIB over-rides JOBLIB


Friday, July 12, 2013

Differences 3


Q11) Explain the difference between an internal and an external sort, the pros and cons, internal sort syntax etc. ?
A11) An external sort is not COBOL; it is performed through JCL and PGM=SORT. It is understandable without any code reference. An internal sort can use two different syntax’s: 1.) USING, GIVING sorts are comparable to external sorts with no extra file processing; 2) INPUT PROCEDURE, OUTPUT PROCEDURE sorts allow for data manipulation before and/or after the sort. 

Q12) What is the difference between a DYNAMIC and STATIC call in COBOL. ?
A12) To correct an earlier answer: All called modules cannot run standalone if they require program variables passed to them via the LINKAGE section. DYNAMICally called modules are those that are not bound with the calling program at link edit time (IEWL for IBM) and so are loaded from the program library (joblib or steplib) associated with the job. For DYNAMIC calling of a module the DYNAM compiler option must be chosen, else the linkage editor will not generate an executable as it will expect u address resolution of all called modules. A STATICally called module is one that is bound with the calling module at link edit, and therefore becomes part of the executable load module.

Sl #
STATIC Call
DYNAMIC Call
1
Identified by Call literal.
Ex: CALL ‘PGM1’.
Identified by Call variable and the variable should be populated at run time.
01 WS-PGM PIC X(08).
Move ‘PGM1’ to WS-PGM
CALL WS-PGM
2
Default Compiler option is NODYNAM and so all the literal calls are considered as static calls. 
If you want convert the literal calls into DYNAMIC, the program should be compiled with DYNAM option.
By default, call variables and any un-resolved calls are considered as dynamic.
3.
If the subprogram undergoes change, sub program and main program need to be recompiled.
If the subprogram undergoes change, recompilation of subprogram is enough.
4
Sub modules are link edited with main module.
Sub modules are picked up during run time from the load library.
5
Size of load module will be large
Size of load module will be less.
6
Fast
Slow compared to Static call.
7
Less flexible.
More flexible.
8
Sub-program will not be in initial stage the next time it is called unless you explicitly use INITIAL or you do a CANCEL after each call.
Program will be in initial state every time it is called.

Difference between Pass-by-reference and Pass-by-content
Sl #
Passl By Reference
Pass By Content
1
CALL ‘sub1’ USING BY REFERENCE WS-VAR1
CALL ‘sub1’ USING BY CONTENT WS-VAR1
(BY CONTENT keyword is needed)
2
It is default in COBOL. BY REFERENCE is not needed.
BY CONTENT key word is mandatory to pass an element by value.
3
Address of WS-VAR1 is passed
Value of WS-VAR1 is passed
4
The sub-program modifications on the passed elements are visible in the main program.
The sub-program modifications on the passed elements are local to that
sub-program and not visible in the main program.

Q13) Difference between exit program and end programe 
A13)
EXIT PROGRAM                                                          END PROGRAM
1.syntax                                                                       1.syntax
 EXIT PROGRAM                                                      END     

2.used to mark ending of calling program,              2. Must be the last statement of the program.
if it is calling any other program, you cant end
u r calling pgm by END PROGRAM