Sie sind auf Seite 1von 6

FILE HANDLING TECHNIQUES

Perform all basic file manipulation operations,including random or sequential read,write,rewrite and delete. Processing VSAM files randomly.

WRITE COMMAND Adds record to a file Syntax EXEC CICS WRITE DATASET(alphanumeric-data-value) FROM (data-name) LENGTH(data-name) RIDFLD(data-name) [RRN] / [RBA] END-EXEC.

Where

DATASET FROM RIDFLD

specifies the file-name (LF). specifies the area that will contain the record (REC-NAME). specifies the field identifying the record

-KSDS files: Value is the key of the record -RRDS files: Value is the relative record number(POS NO).

-ESDS files: Value is the ADD of the record

Example for KSDS write operation EXEC CICS WRITE DATASET(EMPLF22') FROM(EMP-REC) LENGTH(WS-LEN) RIDFLD(EMP-CODE) END-EXEC. READ COMMAND Retrieves a record from a file.

Syntax EXEC CICS READ DATASET(alphanumeric-data-value) INTO(data-name) LENGTH(data-name) RIDFLD(data-name) [RRN] / [RBA] [UPDATE] END-EXEC. NOTE: UPDATE option specifies that record intends to be updated. Example for Reading data from KSDS EXEC CICS READ DATASET(EMPLF22')

INTO(EMP-REC) LENGTH(WS-LEN) RIDFLD(EMP-CODE) END-EXEC REWRITE COMMAND Updates a record in a file. Before a REWRITE can be issued,a READ command with the UPDATE option must first be processed.

Syntax EXEC CICS REWRITE DATASET(alphanumeric-data-value) FROM(data-name) LENGTH(data-name) END-EXEC. DELETE COMMAND Deletes a record from a VSAM file. -Invalid for ISAM or BDAM files If the RIDFLD is excluded,the record deleted is the record by the READ command with the UPDATE option. Syntax EXEC CICS DELETE

DATASET(alphanumeric-data-value) [RIDFLD(data - name)]

[RRN] END-EXEC UNLOCK COMMAND When a READ command with UPDATE option is issued a lock is placed on the dataset. UNLOCK releases the lock on the dataset to other tasks. Syntax EXEC CICS UNLOCK

DATASET( alphanumeric-data-value) END-EXEC.

Sequential Read Sequential Read is done by Browse Operation. Establish the pointer to the First Record to be Read Using StartBr. Next and Previous Records can be Read as required Using ReadNext and ReadPrev. End the Browse Operation at last. Browse can be re-positioned. During Browse Operation, Records cannot be Updated.

There are Five steps for Sequential read operation(BRowse Operation)

1. STARTBR 2. READNEXT 3. READPREV 4. RESETBR

5. ENDBR

EXEC CICS STARTBR DATASET(filename) RIDFLD(data-area) [ GTEQ ] [ RRN / RBA ] END-EXEC. " " Sequentially the Next or Previous Record can be read by a READNEXT or READPREV. The first READNEXT or READPREV will read the Record where the STARTBR has positioned the File Pointer.

EXEC CICS READNEXT | READPREV DATASET(filename) INTO(data-name) LENGTH(data-name) RIDFLD(data-area) [ RRN / RBA ] END-EXEC.

RESETBR: Its effect is the data to reposition the cursor in the data set any where Syntax for Step4 EXEC CICS RESETBR DATASET(filename) RIDFLD(data-name)

[ GTEQ ] [ RRN / RBA ] END-EXEC. ENDBR: ENDBRowse terminates a Previously issued STARTBR. Syntax for Step5 EXEC CICS ENDBR DATASET(filename) END-EXEC.

Das könnte Ihnen auch gefallen