| Next Tip?
Home » CICS, Cobol

CICS interview Questions Part – IV

9 August 2009 216 views No Comment
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Q32)   Code a program meeting the following requirements.

‘EMPS’ is a transaction used to return information pertaining to an employee when the “EMPID” is entered on the screen. The information pertaining to an employee is present in a VSAM/KSDS dataset registered in FCT as “EMPINFOR”. The map and the working storage section of the emp-info are given for reference. If the employee id is found the information has to be sent to the screen (Status field) with the message “Emp Id: XXX found.”. If the emp-id key is not found then status field should array the message “Key not found.”  and the ‘EMP ID” field should be set to bright. If the Exit option is set to “Y” then the task has to terminated. Use pseudo-conversation technique three (Single PCT and PPT). 

 

                            EMPLOYEE INFORMATION FORM

 

   EMP ID : XXX

 

  EMP NAME   : @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

  EMP DESIG  : @@@@@                 SEX : @

  DEPARTMENT : @@@@@@@@@@

  SALARY     : $$$$$$$

 

  STATUS     : @@@@@@@@@@@@@@@@@@@@

 

  EXIT : X

 

 

           X – Input Field

           @ – Output field (Alphanumeric)

                $ -  Output field (Numeric)

                Mapname – EMPFORM

                Mapsetname – EMPFORM

 

Label given to various ‘named’ fields on the DFHMDF macro while defining the map shown above. EMPID, EMPNAME, EMPDESIG, DEPART, SEX, SALARY, STATUS and EXITINP.

 

Structure of the VSAM/KSDS file.

 

Working-Storage Section.

01 EMP-IOAREA.

                   05 EMP-REC.

                                   10 EMP-KEY   PIC XXX.

                                   10 EMP-NAME PIC X(32).

                                   10 EMP-SEX PIC X.

                                   10 EMP-DEPT PIC X(10)

                                   10 EMP-DESIG PIC X(5).

                                   10 EMP-SAL PIC 9(7).

 


A32)   COBOL-II PROGRAM.

 

WORKING-STORAGE SECTION.

77           LENGTH-OF-AREA           PIC  S9(4) COMP.

77        WS-RCODE                             PIC  S9(8) COMP.

 

01           STATUS.

02 NORMAL.

05           FILLER PIC X(8) VALUE ‘EMP ID: ‘.

05           EMP-ID                 PIC X(3).

05           FILLER                 PIC X(6) VALUE ‘FOUND’.

02 ABNORMAL REDEFINES NORMAL.

05           ABMSG                 PIC X(17).

 

01 EMP-IOAREA.

                05           EMP-REC.

                                                10           EMP-KEY             PIC XXX.

                                                10           EMP-NAME         PIC X(32).

                                                10           EMP-SEX              PIC X.

                                                10           EMP-DEPT           PIC X(10)

                                                10           EMP-DESIG         PIC X(5).

                                                10           EMP-SAL              PIC 9(7).

 

LINKAGE SECTION.

01           DFHCOMMAREA.

05           INPVAL                                PIC X(3).

 

PROCEDURE DIVISION.

………..

IF EIBCALEN=0

                               

EXEC CICS SEND             

                                                MAP(‘EMPFORM’)

                                                MAPSET(‘EMPFORM’)

                                                ERASE

                                END-EXEC.

 

                                MOVE 3 TO LENGTH-OF-AREA

                                EXEC CICS RETURN

                                                TRANSID(‘EMPS’)

                                                COMMAREA(‘SEC’)

                                                LENGTH(DATA-VALUE)

                                END-EXEC.

 

ELSE IF INPVAL = ’SEC’                

                               

EXEC CICS RECEIVE

                                                MAP(‘EMPFORM’)

                                                MAPSET(‘EMPFORM’)

                                END-EXEC.

 

                               

 

EXEC CICS READ

                DATASET(‘EMPINFOR’)

                INTO(EMP-IOAREA)

                RIDFLD(EMPIDI)

                LENGTH(LENGTH-OF-AREA)

                RESP(WS-RCODE)

END-EXEC.

 

IF WS-RCODE NOT = DFHRESP(NORMAL)

                MOVE ‘KEY NOT FOUND’ TO ABMSG’

                MOVE DFHBMBRY TO EMPIDA

                                        ELSE

MOVE EMP-NAME  TO EMPNAMEO

                                MOVE EMP-SEX TO SEXO

                                MOVE EMP-DESIG TO EMPDESIGO 

                                MOVE EMP-SAL TO SALARY

                                MOVE EMP-DEPT TO DEPARTO

                                MOVE EMP-KEY TO EMP-ID

                                MOVE STATUS TO STATUSO.

 

EXEC CICS SEND           

                                                MAP(‘EMPFORM’)

                                                MAPSET(‘EMPFORM’)

                                                ERASE

                                END-EXEC.

 

                                MOVE 3 TO LENGTH-OF-AREA

                                EXEC CICS RETURN

                                                TRANSID(‘EMPS’)

                                                COMMAREA(‘SEC’)

                                                LENGTH(LENGTH-OF-AREA)

                                END-EXEC.

 

EXEC CICS RETURN

                                END-EXEC.

 

ELSE IF                 (EXITINPI NOT = ‘Y’)

 

                                EXEC CICS RETURN

                                END-EXEC.

 

The following are most frequently asked questions (FAQS):

 

Q33)   What does “Pseudo Conversational” mean?

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

 


Q34)   Explain the means of supporting pseudo conversation programming. (E.g. Storing and restoring of states, control flow, error handling)

A34)   When  we  send  a  map  using  SEND MAP  command.  Immediately we release the program by using  EXEC CICS  RETURN  command.   In this  command  we  mention  the  TRANSACTION  ID  which  is to  be executed  after  receiving  the  map.   In  this  command  we  also  specify the  data  that  should  be  stored  in COMMUNICATION  AREA  for later  use.  When this command is  executed the  corresponding program is  released from  the  memory. After  receiving  the  response  from  the terminal  the  program  is again loaded  and  this  time  the data  which  we stored in  communication  area will  be  copied  into  the  working  storage  section.   And the map will be received with RECEIVE MAP command.

The  variable  EIBCALEN  in  EIB  holds  the  length  of  communication area.   In  procedure  division  we  checks  the value  of  EIBCALEN If  it  is  zero,  we  first   send  the  map  followed  by   RETURN command.  Otherwise,  that is  if EIBCALEN is  not  zero,  we  know that  this  transaction  is  not  running first  time   and  we  receive the  map  by using  RECEIVE MAP  command.

 

Q35)   What is the function of the CICS translator?

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

 

Q36)   How can you start a CICS transaction other than by keying the Transaction ID at the terminal?

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

 

Q37)   What is the purpose of the Program List Table?

A37)   The Program List Table records the set of applications programs that will be executed automatically at CICS start-up time.

 

Q38)   What are the differences between and EXEC CICS XCTL and an EXEC CICS START command?

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

 

Q39)   What are the differences between an EXEC CICS XCTL and an EXEC CICS LINK command.

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

 

Q40)   What happens to resources supplied to a transaction when an XCTL command is executed?

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

 

Q41)   What CICS command do you need to obtain the user logon-id?

A41)   You must code EXEC CICS ASSIGN with the OPERID option.

 


Q42)   What is a resident program?

A42)   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”.

 

Q43)   What is EIB. How it can be used?

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

 

Q44)   What is some of the information available in the EIB area?

A44)  

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

 

Q45)   What information can be obtained from the EIBRCODE?

A45)   The EIBRCODE tells the application program if the last CICS command was executed successfully and, if not, why not.

 

 

Q46)   What is the effect of including the TRANSID in the EXEC CICS RETURN command?

A46)   The next time the end user presses an attention key, CICS will start the transaction specified in the TRANSID option.

 

Q47)   Explain how to handle exceptional conditions in CICS.

A47)   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, and 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.         

 

Q48)   What is the function of the EXEC CICS HANDLE CONDITION command?

A48)   To specify the paragraph or program label to which control is to be passed if the “handle condition” occurs.

 

 

Q49)   How many conditions can you include in a single HANDLE CONDITION command?

A49)   No more than 16 in a single handle condition. If you need more, then you must code another HANDLE CONDITION command.

Q50)   What is the EXEC CICS HANDLE ABEND?

A50)   It allows the establishing of an exit so cleanup processing can be done in the event of abnormal task termination.

Popularity: unranked [?]

Related interview questions

Leave your response!

You must be logged in to post a comment.