FALSE

Page Nav

HIDE

Grid

GRID_STYLE

CICS FAQ's part4

FILE CONTROL IN CICS   1.     What types of Files can be used by CICS. Why? VSAM, ISAM, and BDAM files on disk can be accessed by CICS, as...

FILE CONTROL IN CICS

VSAM, ISAM, and BDAM files on disk can be accessed by CICS, as they are all of random access type.

KSDS, ESDS, RRDS and LDS

The various CICS commands used for file handling are READ, WRITE, REWRITE and DELETE. The various options of READ command are DATASET, INTO, RIDFLD, RRN RBA, LENGTH, UPDATE. The Options of WRITE command are DATASET, FROM, RIDFLD, RRN, RBA, and LENGTH. The options of a REWRITE command are DATASET, FROM, and LENGTH. The options of DELETE command are DATASET, RIDFLD and RRN / RBA. UNLOCK command uses DATASET as the only option. RESP option can be used with all the commands to check the system response, similar to HANDLE CONDITION.

The two types of deletes in VSAM files are as follows

When there already exists a read/update command

EXEC CICS DELETE
DATASET (‘FILEAAA’)
RIDFLD (REC-KEY)
END-EXEC

When there is no read/update command

EXEC CICS DELETE
DATASET (‘FILEAAA’)
RIDFLD (REC-KEY)
END-EXEC

Read with generic option is used when the partial key value is known instead of the full key when the length of key field is a subset of the whole key along with the LENGTHKEY option.

The syntax is as follows
EXEC CICS READ
DATASET (‘FILEAAA’)
INTO (DATA-AREA)
RIDFILD (REC-KEY)
KEYLENGTH (N)
GENERIC
LENGTH (WK-LEN)
END-EXEC


When we sequentially access a VSAM file under CICS, we go for browsing.

STARTBR, READNEXT, READPREV and RESETBR and ENDBR
The options used are DATASET, RIDFLD, RRN/RBA, GENERIC, and KEYLENGTH for the 3 commands, and INTO, LENGTH for READNEXT and READPREV command, and EQUAL/GTEQ for STARTBR only. RESP can be used with any. ENDBR is used to end the browse operation.

To read a VSAM file sequentially

EXEC CICS STRATBR
DATASET|FILE (NAME)
RIDFLD (DATA-AREA)
GTEQ
END-EXEC

EXEC CICS READNEXT
DATASET|FILE (NAME)
INTO (DATA-AREA)
LENGTH (DATA-VALUE)
RIDFLD (DATA-AREA)
END-EXEC

EXEC CICS ENDBR
DATASET (‘FILEAAA’)
END-EXEC

Using RQID file can be opened one or more times. Using resetbr we can point to different location in a same file

Write, rewrite, delete and unlock.

The MASSINSERT option is used along with the WRITE command, to inform the system to write a bunch of inter-related records at a time. In order to decrease the I/O s with a better utilization of the VSAM CI 's.This option modifies normal VSAM split processing, leaving frees pace after the inserted record, and so subsequent records can be inserted without splits. It is ended by an UNLOCK commands.

READNEXT command is used to read a VSAM /KSDS sequentially in the ascending order.
File control commands, random, sequential, forward and backward

Define path in FCT and use normal control commands as below

EXEC CICS READ
DATASET (‘FILEAAA’)
INTO (DATA-AREA)
RIDFILD (REC-KEY)
END-EXEC

Here the data set name should be the name of the path, which provides the logical linkage between the base cluster and alternate index
CICS allows users to handle VSAM KSDS files with an Alternative Index. A VSAM catalog entry needs called Path, which establishes relationship between the alternate index and it's base cluster, needs to be defined, before one can process the base cluster using an alternative Index. You specify the path name rather than the file name in the Dataset option of the file control commands, when you wish to access the files through Alternative Index.

No it is not possible to delete a VSAM ESDS file.

Define the file as recoverable. In cases where records have been inserted into the file, you may need to run a batch program to logically delete the inserted records.

Yes it is possible to do it with the REQID.

No

Yes

To read from the beginning of the file

Move Low-values to the record id field in the following command

EXEC CICS STRATBR
DATASET|FILE (NAME)
RIDFLD (DATA-AREA)
GTEQ
END-EXEC


To read from the end of the file

Move high-values to the record id field in the following command

EXEC CICS STRATBR
DATASET|FILE (NAME)
RIDFLD (DATA-AREA)
GTEQ
END-EXEC

To read the file from a desired position

Move the appropriate value to the record id field

EXEC CICS STRATBR
DATASET|FILE (NAME)
RIDFLD (DATA-AREA)
GTEQ
END-EXEC

Common exceptional conditions for STRATBR

DSIDERR – The file specified is not found in FCT
NOTFND  - The specified record is not found

Common exceptional conditions for READNEXT

DUPKEYThe key of the record is a duplicate of the next record’s key
ENDFILEThe end of file is detected
LENGERR The actual record length is greater than the length specified

Common exceptional conditions for READPREV

NOTFND The record positioned by the STRATBR and RESETBR is not found. In this case when a READPREV command is issued then this error is encountered.
INVREQ – The generic option must not be used in the STRATBR for a file in which a READPREV will be done.

Common exceptional conditions for RESETBR

INVREQ- This exception occurs when a resetbr command is issued without the prior STARTBR command.
DSIDERR, ENDFILE, ILLOGIC, INVREQ, IOERR, LENGERR, NOTFND and NOTOPEN.

No. HANDLE CONDITION is to be coded only at the beginning of the program before the first read command. If you need to change the Handle condition after a few reads or write, use PUSH and POP commands accordingly. If needed a few conditions also can be ignored by using the IGNORE CONDITION command coded before the File handling commands. If Ignore Condition is used, EIBRCODE can be used to check the return condition if needed.

STARTBR
READNEXT-AAA
READNEXT-BBB
READNEXT-CCC
Here the direction of browse is changed
READPREV-CCC
READPREV-BBB
READPREV-AAA

No.

No comments