1 / 27

File Handling & Temporary Storage

File Handling & Temporary Storage. Day4. Objectives. Access Methods VSAM BDAM VSAM Considerations Random access Sequential access Temporary Storage Control Commands to read, write and delete Design considerations Examples Transient Data Control Intrapartition TD queues

Download Presentation

File Handling & Temporary Storage

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. File Handling & Temporary Storage Day4

  2. Objectives • Access Methods • VSAM • BDAM • VSAM Considerations • Random access • Sequential access • Temporary Storage Control • Commands to read, write and delete • Design considerations • Examples • Transient Data Control • Intrapartition TD queues • Extrapartition TD queues • Commands to read, write and delete • Examples

  3. CICS File Control • VSAM • Allows read, browse, update and delete operations • BDAM • Allows read, browse and update only • They are less efficient than VSAM • Can be replaced by a relative record VSAM dataset or ESDS addressed by RBA

  4. Types of VSAM Files • ESDS - Entry Sequenced Data Set • KSDS - Key Sequential Data Set • RRDS - Relative Record Data Set

  5. Alternate Indexes in VSAM • Accessing same set of records in different ways • Any number of alternate keys • Alternate keys need not be unique • Only KSDS and ESDS can have alternate keys

  6. Random access - READ MOVE +80 TO WS-EMP-REC-LEN. MOVE ‘10000’ TO WS-EMP-REC-KEY. MOVE 5 TO WS-EMP-KEY-LEN. EXEC CICS READ FILE (‘EMPFILE1’) INTO (WS-EMP-REC) LENGTH (WS-EMP-REC-LEN) RIDFLD (WS-EMP-REC-KEY) KEYLENGTH (WS-EMP-KEY-LEN) END-EXEC. • Places the record in WS-EMP-REC

  7. GENERIC READ MOVE +80 TO WS-EMP-REC-LEN. MOVE ‘10’ TO WS-EMP-REC-KEY. MOVE 2 TO WS-EMP-KEY-LEN. EXEC CICS READ FILE (‘EMPFILE1’) INTO (WS-EMP-REC) LENGTH (WS-EMP-REC-LEN) RIDFLD (WS-EMP-REC-KEY) KEYLENGTH (WS-EMP-KEY-LEN) GENERIC END-EXEC.

  8. READ Continues... • READ COMMAND OPTIONS • EQUAL • GTEQ • UPDATE • READ-UPDATE/REWRITE • Maintains exclusive control on the resource(on CI in case of VSAM file) until • REWRITE is done • Transaction ends normally or abnormally • Control over resource is released by program using UNLOCK command.

  9. REWRITE • To rewrite records into file. EXEC CICS REWRITE FILE (‘EMPFILE’) FROM (WS-EMP-REC) LENGTH (WS-EMP-REC-LEN) END-EXEC. • This command updates a record. • Prior to this command the record must be read with a READ UPDATE command.

  10. WRITE • To write records into file. MOVE +80 TO WS-EMP-REC-LEN. MOVE ‘11000’ TO WS-EMP-REC-KEY. MOVE 5 TO WS-EMP-KEY-LEN. EXEC CICS WRITE FILE (‘EMPFILE’) FROM (WS-EMP-REC) LENGTH (WS-EMP-REC-LEN) RIDFLD (WS-EMP-REC-KEY) KEYLENGTH (WS-EMP-KEY-LEN) END-EXEC.

  11. DELETE • Read the record with UPDATE option and then delete it with the following command. EXEC CICS DELETE FILE(‘EMPFILE’) END-EXEC. • Use the following command to delete the record directly. MOVE ‘12345’ TO EMP-REC-KEY. EXEC CICS DELETE FILE(‘EMPFILE’) RIDFLD (EMP-REC-KEY) END-EXEC.

  12. GROUP DELETE • MOVE ‘11’ TO WS-EMP-REC-KEY. • MOVE 2 TO WS-EMP-KEY-LEN. EXEC CICS DELETE FILE (‘EMPFILE’) RIDFLD (WS-EMP-REC-KEY) KEYLENGTH (WS-EMP-KEY-LEN) GENERIC NUMREC (WS-NUM-REC-DEL) END-EXEC.

  13. Transaction deadlocks • Exclusive control on CI. • Exclusive control may cause transaction deadlocks. Make sure to use UNLOCK when you are not rewriting • In pseudo-conversation, at the end of transaction, all locks are released.

  14. Sequential access - Browsing • STARTBR • READNEXT • READPREV • RESETBR • ENDBR

  15. STARTBR • This establishes a browse session. EXEC CICS STARTBR FILE (‘EMPFILE’) RIDFLD (EMP-REC-KEY) KEYLENGTH(KEY-LEN) GTEQ/EQUAL/GENERIC END-EXEC.

  16. READNEXT/READPREV EXEC CICS READNEXT/READPREV FILE (‘EMPFILE’) INTO (EMP-REC) LENGTH (EMP-REC-LEN) RIDFLD (EMP-REC-KEY) END-EXEC.

  17. RESETBR • Establish a new browsing position with in the same browse. MOVE ‘12345’ TO EMP-REC-KEY. EXEC CICS RESETBR FILE (‘EMPFILE’) RIDFLD (EMP-REC-KEY) GTEQ END-EXEC.

  18. ENDBR • End browse operation EXEC CICS ENDBR FILE (‘EMPFILE’) END-EXEC.

  19. Sequential access – VSAM ESDS Move Low-values to VSAM-ESDS-RBA EXEC CICS STARTBR DATASET (‘filename’) RIDFLD(ESDS-RBA) RBA EQUAL END-EXEC • EXEC CICS READNEXT • DATASET (‘filename’) • INTO(FILE-AREA) • RIDFLD(ESDS-RBA) • LENGTH(WS-LEN) • RBA • END-EXEC

  20. Temporary Storage • COMMAREA (Communication Area) • CWA (Common Work Area) • TWA (Transaction Work Area) • TSQ (Temporary Storage Queue) • TDQ (Transient Data Queue)

  21. TSQ Commands • WRITEQ TS EXEC CICS WRITEQ TS QUEUE (qname) FROM (recarea) LENGTH (length) option (option)… END-EXEC.

  22. TSQ Commands • READQ TS EXEC CICS READQ TS QUEUE (qname) INTO (recarea) LENGTH (length) option END-EXEC

  23. TSQ Commands • DELETEQ TS EXEC CICS DELETEQ TS QUEUE (qname) END-EXEC.

  24. Transient Data Queue • 2 types of TDQ • Intra-partition • Extra-partition • Difference between TDQ and TSQ • TDQ to be defined in DCT • No modify or Rewrite option in TDQ • TDQ can be read only sequentially • A destructive read is performed on TDQ • A trigger can be set on Intrapartition TDQ • No counterpart to the MAIN option available in TSQ

  25. TDQ Commands EXEC CICS WRITEQ TD QUEUE (qname) FROM (recarea) LENGTH (length) END-EXEC EXEC CICS READQ TD QUEUE (qname) INTO (recarea) LENGTH (length) END-EXEC • DFHDCT entry • TYPE=INTRA • DESTID=qname • TRANSID=EMPL • TRIGLEV=2000 EXEC CICS DELETEQ TD QUEUE (qname) END-EXEC

  26. Summary • What is VSAM? • What are the types of VSAM files? • When do transaction deadlocks happen and how to avoid? • What are the commands for sequential access? • How is sequential access of ESDS done? • What is the difference between TSQ and TDQ? • What are the commands used to access TSQ and TDQ?

  27. Thank You!

More Related