Showing posts with label CICS. Show all posts
Showing posts with label CICS. Show all posts

Tuesday, December 6, 2011

CICS Supplied Tables



PCT  -- Program control Table --- Transaction
PPJ  -- Processing Prog Table   -- Program / Mapsets
TCT – Terminal Control Table

 

   DFHPCT  TYPE  = TRANSACTION
                   Transid = “TR01”
                  Program  = “CICS001”
                  Program = “CICS002”




DFHPPT   TYPE  = Program                             Type = MAPSET
                  Program  = “CICS001”                   MAPSET = Mcnstcol
                  TransID  = “TR01”                         Tra


                                                  

Difference between TSQ & TDQ

                              TSQ                                                                         TDQ

  • Records entered in entry Sep. order                Records entered in entry sep.order with
With relative record number                          out relative record number

  • Multiple read commands can be applied         Only one read command can be applied
Against rows                                                   against rows (Read is destructive)
  • Records can be accessed Sepertially                Only sequential access
Or random

  • Queue must be defined in TST if the              Queue must be defined m DCT
Data store in auxiliary memory                      (Destination Control Table)

  • Can be used to pass the data from                    Can be used to pass data withinCICS
One prog to another within CICS region         region or outside of CICS region like 
                                                                          Batch

                                                                                       Eg:- Report printing, Trigessing Batch Prog
                                                                                            Bb specifying Trigger level
                                                                          
  • Updation is passible                                            Updation is not possible

TSQ & TDQ

TSQ:-         Temporary storage queue

  • Which is similar to physical sequential file
  • Records entered in entry – sequential order with relative record number
  • Records can be sequentially or Random by using item number which must be defined in Working – Storage Section as separate field
  • The Queue name must be user defined i.e.  1-8 Alph numeric characters must be unique in system
  • TSQ can be storage in main memory or Auxiliary memory (QueueID or Queue Name must be defined in TST(Temp Storage Table) which is CICS supplied table
  • TSQ can be used to pass the data within CICS
  • TSQ can be used to reduce no. of DB2 calls & improve program efficiency
  • TSQ can be used for page up, Page down logic
  • TSQ can be used for reporting printing online
  • Entire TSQ data can be deleted by using delete command (No specific row deletion)


TDQ:- Transient Data Queue

  • Used to pass the data from one CICI to another CICS region
  • Used to pass the data from CICS to Batch Program.                                                                                                                                                                                                                                                                                                                                                                                
  • While using TSQ, we can read the records any no of times
  • While using TDQ, multiple read against TSQ is not possible
  • Read is destructive i.e. when we read the queue the data is lost
  • Updation is not possible
  • Delete can apply to intra partition but not to extra position.

TDQ can be stored in main or auziliary.

If we store in Auxiliary we need to define

Queue ID DCT Table (Destination Control Table)

                                                                                   
DFHDCT                   Type = QUEUF
                                  Type = Intra/ Extra
                                  Queid = “TD001”
                                  Trigerleve = 1000
                                 Program  = Cobol
 


01 Ws-Hd

                  02 Ws – Sub – He – 1  PIC X(100) value  “Customer Details”
                  02 Ws – Sub – He – 2  PIC X (100) value “Page No”

01 Ws-line  PIC X(100) value A;;”  ---“

PROCEDURE DIVISION

                  WRITE   Cust  -  Rep  from Ws-Sub-He-1
                  WRITE   Cust -  Rep from Ws-Line
                  WRITE  Cust – Rep from Ws-Sub – He – 2

LINK & XCTL

LINK:-

  • Which can be used to transfer the control from one prog to another prog
  • Control is expected back to original prog.(no need of explicit CICS command to transfer back)
  • Ef:- Validations

Socket programming
Complex business functionalities

XCTL:-


  • Which can be used to transfer the control from one prog. To another Prog.
  • Control is not expected back to original prog
  • To get the control back to main prog XCITL command must be used in sub program

Eg:- Transfering the control from main menu (prog) to sub prog or subprog to main menu(Prog)


            Link  --- to lower level
            XCTL  --- to same level
            Return --- to Higher level


MOVE  30 TO WS_TSO_LEN

Exec  CICS                                                      Ws - Section
                                                                        01 Ws -TSQ - AREA
                  Write Ts                                         02 Ws –TSQ-CusfNo  Pic  59(5)
                  QUEUE(“TS001”)                           02 Ws- TSQ – CustName  Pic X(10)
                  From (Ws-TSQ-AREA)                    02 Ws-TSQ – CustLoc    Pic X(10)
                  LENGTH (Ws-TSQ-LEN)                01 Ws-TSQ-LEN  Pic  59(4) comp
                  ITEM(Ws-TSQ-Item)
                  Main/Aux                                     
If we want to define that Quene auxiliary memory.We have to define Quene id TST table it is CICS supplied table.


End-Exec

Add + 1 to Ws-TSQ-Item

To define queid in TST exate member &write the following assembler maoro.

USEID SOURCE DFHTST (TS0001)

DFHTST Type  = “Queue”                                TST = Temporary Storage Table

QueID  =  “TS001”

TO Retrieve the data from queue to structure:-

Move +1 to Ws-TSQ-ITEM
                  Perform until Qzero  (End of Queue)

Exec CICS

                  ReadQ TS
                  QUEUE (“TS001”)
                  Into(Ws-TSQ-AREA)
                  Length(Ws-TSQ-LEN)
                  Item(Ws-TSQ-Item)

End – Exec

                  Add +1 to Ws – TSQ – Item
End – Perform

Response Code:- To find the end of the queue

Deleting the Queue:

Exec CICS
                  DeleteQTS                           We cannot delete single row in queue
                  QUEUE(“TS001”)                 When we apply delete command the queue
End - Exec                                             becomes empty
                                                              Queue is global

Up dating The Queue:-

Exec CICS

                  RewriteQts
                  From (Ws-TSQ-Area)
                  Queue(“TS001”)
                  Length(Ws-TSQ-Len)
                  Item(Ws-TSQ-Item)

End – Exec

DFH Comm Area



  • System defined global variable which must be declared in linkage section with 01 level no

  • Which can be used to pass the data from on program to another program, on transaction to another transaction.

  • Max size area for DFH Comm Area is 65Kbytes


PROCEDURE DIVISION :-



            Move Spaces to DFH Comm Area
            I nitialise DFH Comm Area ----- Aliphanumaric, Numaeric

  • To transfer the control from one program to another

We use XCIL

      Exec CICS

                  XCTL
                  Program (“CICSOOL”)
                  CommArea(DFHcommArea)
                  Length (Comm-Length)

      End- Exec

  • We can use link to transfer the control

  • The diff between XCTL &LINK is when we use XCTL the control is not Expected to back to the screen but when we use link it will expect that the control will back

Exec CICS

            LINK

                        Program(“CICS001”)
                        CommAre(DFHCommArea)
                        Length(Comm – length)

End Exec

  • If we use F8 Key Page up & F9 for Page down, data is to be transferred from database to screen.But we use temp area for storing this info.this is call queene

01 Ws-Comm-Area

            02 Transfer  - data

02   CustNo.   PIC  9(5)

02 Save – data

            03 CustNo.   PIC 9(5)
            03 CustName  PIC X(20)

02 Multiple – rows
            03 Ws-data PIC X(5) access 1,00,000times

Monday, December 5, 2011

CURSOR TECHINQUES



  • Three Types of Cursor techniques

(i)         Static –By specifying i.e  in Assembler macro, Cursor can be positioned at
required field.
 
(ii)        Dynamic Cursor position –Dynamically cursor can be positioned by assigning  - 1 to     the                      length  field from symbolic map.  This technique is used in application program more frquently
 
            Eg:- Involid Data validation or to jump from one field to another field
 
(iii)       Relative cursor position – Cursor can be positioned at required location by specifying relative position relative to zero in the Cursor option with send map command.

COMMUNICATION AREA



  • At the time of terminating the transaction, the working storage – section variables are stored into a variable declared in linkage section

  • This area is called communication area

  • It is global

  • The max six of this variable is 6JK.

(linkage Section)

              01 DFHCOMMAREA PIC  X  (65,53J)

  • At the time of reinitiation  the data is retrieve from the variable

  • Communication Area can be used to pass the data from on transaction to another.

  • For the first entry of transaction the Communication Area is empty

  • For next entry, it must not be zero.

PROCEDURE DIVISION
 If EIBCALEN = 0
     To check the length of Communication Area, it is zero for first entry, non zero                                                 For next entry.
Exec CICS

        Send
                MAP (MAPNAME)
         
               MAPSET (MAPSET)
End – exec
Exec CICS

        Return
                   Transid (“TR01”)
End-Exec
Else
        Exec CICS
                    Receive MAP (MAPNAME)
                                 MAPSET (MAPSET)
End – Exec

End-it
Cust.No.  …….
Cust Name ……..
Message: ………

Enter  F2   F3   F4
 
If EIBCALEN = 0

            Exec CICS
                        Send
                                    MAP(MAPNAME)
                                    MAPSET(MAPSETNAME)
End – Exec

Exec CICS                                                                                           Functionlays
                        Return                                                                                                
                                    Transid)”TR01”)                                                                       Stored
                                                                                                                EIBAID
End – Exec.

End – If                                                                                        DFHAID    Attention Identifers
                                                                                                                                    (F1 –F24)
Perform Receive- Map – Para three Receive – Map – Exit
Perform Function – Keys – Para three Function – Keys – Exit
Receive – Map – Para

Exec  CICS

                            Receive
                                     MAP(MAPNAME)                                 Copy DFHAID in WS - Section
                                     MAPSET(MAPSETNAME)
            End – Exec                                                                 01  EIBAID   PIC   X(4)
                                                                                                    88 DFHPF1 Value  “F1”
Receive – Map – Exit                                                                     88 DFHPF2 Value “F2”
                                                                                                      88 DFHEnter Value “Enter”                      Exit

Function – Keys – Para

            Evaluate EIBAID
                        When DFHEnter                                                     88 DFHPF24 Value “F24”
 

                                    Perform validation – logic three validation – logic – exit
                        When DFHPF3

                                    Pefrom Exit – logic three exit – logic –Exit
                        When DFHPF10
                       
                                    Perform Insert – logic three Insert – logic – Exit

                        When DFHPF11

                                    Perform update – logic three update – logic – Exit
                        When Other

                                    Perform Invalid – Key three Invalid – Key – Exit

            End – Evaluate



Function – keys – exit                                                             In map
                                                                                                 1 line  --- Header
                              Exit                                                            23line   --- Messages
                                                                                                24 or last  --- Footer
Validation – logic

      If McnstNoI   = Zeroes
                  Move “Invalid cust. No.” to MMESGO
                   Exec CICS   Move  - 1 to McnstNol – Dynomic way to position the cursor
                            Send
                                   MAP (MAP NAME)
                                     MAPSET(MAPSETNAME)
                       
                             End – Exec
                            
Exec CICS                                                         To Dynamically position the         
                                                                                    cursor
              Return                                                       1. Move – 1 to Mcnst NoL
                         Transid(“TR01”)                                                i.e. Lengthfield
                                                                                2. Send
     End – Exec                                                                 Map (…………….)
                        End if                                                                               Map (…………….)
                                                                                                                Cursor (200) relative
            If Mcnst NoI No is not Numeric                                                         cursor position
           
              Move Spaces to MMESGO
              Move “Must be Numeric” to MMESGO

Move  - 1  to Mcnst NoL
                        Exec CICS
                                Send
                                                MAP (MAPNAME)
                                                MAPSET(MAPSETNAME)
                        End –exec

                        Exec CICS                                                                   Send Para

                                 Return

                                                Transid(“TR01”)
                        End – Exec
                        End if
If Mcnst NoI (1:1) < > 1
            Move Spaces To MMESGO
            Move “First digit Must be 1” to MMESGO
            Move – 1 To McnstNoL
Exec CICS
            Send
                        MAP(MAPNAME)
                        MAPSET(MAPSET NAME)
End – Exec
Exec CICS
            Return
                        Transid (“TR01”)
End-Exec   End-If
Move McnstNoI to (DFHCommArea(1:5)) Ws-Cust-No

If McnstNamI   = Spaces
           
            Move  “Invalid Name” to MMESGO
            Move – 1 toMcnstNamL
            Perform Send – Para

End If

            Move McnstNamI to(DFHCommArea(6:10)) Ws-Cust-Name
           
            Move Ws-Comm-area to DFHcommArea