Sie sind auf Seite 1von 9

CICS COMMANDS QUICK REFERNCE

Some Useful System Commands:


A brief introduction to CICS system tables and resources:
In the CICS region, all the resources (like files, transactions, TDQs, programs etc.) are
defined in system tables like (PCT, PPT, FCT, etc.). We cannot execute any transaction
without the transaction being predefined in PCT and the associated program that the
transaction initiates in PPT. Similarly we cannot use any files, which have not been
defined in the FCT. Similar is the case for all the resources. Of course exception being
resources like TSQs. But CICS gives the user very much flexibility in the sense that the
resources that are defined to CICS are all logical. All the physical allocations are to be
done by the user, which will cater to his needs and application requirements.
For example, the definition of a file to CICS is done in terms of its DDNAME. The user
can allocate any physical file, which contains the data that cater to his application/testing
needs as long as the properties of the file (like Key length, Key offset, Rec Size, etc) are
consistent with those defined to the CICS in FCT.
Similarly once a transaction and its associated program are defined to CICS, user can
compile and create a load module of any program with the name defined and use the predefined transaction to execute the program. For example, in PCT and PPT the entries of
transaction TRN1 and its associated program PGM1 are made. Now the user can compile
some program XYZ with its name as PGM1 and use TRN1 to execute this program.
But before we proceed further it is very important to note that for us to use/access any of
the resources that have been defined to CICS, they have to be enabled. And incase of
resources like files, they have to be open. We have a Master Transaction CEMT to
check the current status of a resource and also to change its current status as required by
the user.
Syntax:
Type CEMT I and press enter. A lot of options will be shown to you. Out of these the
options which will be of most concern to us are:
FIle, PROGram, TRAnsaction.
Now after I type the option you want along with the name of the resource you want to
check. Note that its enough if we type the letters in capital case. Also we can directly
inquire about a resource by directly typing the entire command
CEMT I option (resource name)
For example:
CEMT I FI (ddname) is same as CEMT I FILE (ddname)
Similarly, I PROG (program name); I TRA (transaction name)

The logical name we specify can also be generic. Suppose if we type in


CEMT I FI (*) and press enter, it will show us the status of all the files that are defined in
the region. If we want to limit our search then its better to give the entire resource name
(if we know) or give a generic name by specifying the start of resource name followed ny
an asterisks. Example:
CEMT I FI (TM*) will display the status of all files whose DDNAME start with TM. But
make sure to give *. If not it will search only for the file whose name is TM.
Similarly we can inquire about PROG and TRA.
Now let us see some examples:
Example-1 FIle:
CEMT I FI(FILENAME) <Enter>
Result:
I FI(FILENAME)
STATUS: RESULTS - OVERTYPE TO MODIFY
Fil(FILENAME ) Vsa Clo Ena Rea Upd Add Bro Del Sha
Dsn( PHYSICAL.FILENAME
)
Vsa tells us that it is a VSAM file. (Not modifiable)
Clo tells us that the file is Closed.
This can also be Ope meaning that the file is opened.
Ena tells us that the file is Enabled.
This can also be Dis meaning that the file is disabled.
Rea tells us that we have access to read this file
Upd tells us that we have access to update this file
Add tells us that we have access to add new records to this file
Bro tells us that we have access to browse through the file.
Del tells us that we have access to delete the records in this file.
Sha tells us the disposition of the file.
All the above 6 options are given while definition of the file to the region.
Depending on the application these definitions may vary from file to file.
Dsn gives us the name of the physical file that is currently allocated to this region.
We can allocate different files (of course only one at a time) provided the file we
are allocating has properties in consistent with those defined in the region.
For us to access any file, it should be open and enabled. If we want to change any status
then just go to that option and type the first letter. For example if we want to open the file
just go to Clo and type O in the place of Clo. The status will change to Ope (open)
provided the Physical file we mentioned in Dsn is existing and has consistent properties
with those defined in the region.
When we want to allocate a different physical file then follow the below steps:
Change the status of the file to Clo and Disable the file. When you do this, check the
message that pops up on to the right of the file name. It should be normal.

Once this is done, go to Dsn and type the name of the physical file name you want to
allocate in place of the existing file name.
Now again change the status to Ope and Ena from Clo and Dis. If the file is existing and
has consistent properties you will see the message as normal to your right. Else it will
give a message OPEN/CLOSE FAILED. Note that even if the the file does not exist, the
status can be changed to Ena from Dis but it will give an error when you are trying to
open the file.
Also CICS wont allow you to allocate a new physical file unless the status of the
existing file is closed and disabled.
Example-2 PROGram:
CEMT I PROG(PROGNAME) <ENTER>
Result:
I PROG(PROGNAME)
STATUS: RESULTS - OVERTYPE TO MODIFY
Prog(PROGNAME) Len(0000000000) Ass Pro Ena Pri
Res(000) Use(0000000000) Any Cex Ful Qua

Ced

Ass tells us that the program is written in Assembler. This can also be Cob (COBOL) or
Pli.
Pro tells us that this is a program. This can also be Map (MAP/MAPSET)
Ena tells us that this program is enabled. This can also be Dis (Disabled)
For us to execute any program its status should be enabled.
If you want to see the detailed description, place your cursor on the resource name or its
status fields and press Enter. You will be able to see the detailed descriptions for that
resource. This is true for all resources.
Example-3 TRAnsaction:
CEMT I TRA(TRNX) <Enter>
Result:
I TRA(TRNX)
STATUS: RESULTS - OVERTYPE TO MODIFY
Tra(TRNX) Pri( 001 ) Pro(PROGNAME ) Tcl( DFHTCL00 ) Ena Sta
Prf(DFHCICSA) Uda Bel Iso
Bac Wai
Pri tells us the priority of the transaction. Higher the value, least is the priority.
Pro tells us the name of the program that is associated with this transaction. i.e., when we
trigger this transaction program PROGNAME will get executed.
Ena tell us that the status is enabled. This can also be disabled.

For us to run any transaction, the transaction, and the program associated with that
transaction and all the resources likes files that the program uses should be enabled. Also
the files should be open.
CEBR:
Another useful system transaction is CEBR. This is used to browse through the TSQ
records.
Syntax:
CEBR TSQ-Name <Enter>
This will display all the records present in the TSQ.
CECI:
Another system transaction that can prove handy is CECI. This is a command level
interpreter. Using this transaction we can execute any CICS command with out having to
write an entire program. Example:
I want to execute ASKTIME.
CECI <enter> This will display all the options commands we can execute. In this we
can find an option ASKtime.
Type Ask and press Enter. The next screen that shows up is as follows:
ASK
STATUS: ENTER ONE OF THE FOLLOWING OR HIT ENTER FOR DEFAULT
Abstime
Now enter ABSTIME as follows:
ASK ABSTIME and hit enter.
It will show the following screen:
ASK ABSTIME ASK
STATUS: ABOUT TO EXECUTE COMMAND
EXEC CICS ASKtime Abstime()

NAME= DEFAULT

Now again press enter. The command will get executed and result will be obtained.
ASK ABSTIME
STATUS: COMMAND EXECUTION COMPLETE
EXEC CICS ASKtime Abstime( +003281070156140 )

NAME=

CEDF: This is a diagnostic facility available in CICS which executes all CICS
commands present in the program interactively showing the state of the program before
and after the execution of the Command. But having XPEDITOR we dont have to
concern ourselves with this.
CESF: To logoff from the region.

EIB variables generally/frequently used

EIBTIME
EIBDATE
EIBTASKN
EIBTRNID
EIBTRMID
EIBAID
EIBCPOSN
EIBCALEN

EIBDS
EIBFN
EIBRCODE

Exceptional Conditions.

Time the task was started.


Date the task was started.
Task number assigned to task by CICS.
Transaction ID
Terminal ID
Type of input operation performed on the terminal
Position of cursor on the screen at the time of input
Length of the Communication area passed to an
application program which is called by another application program.
Name of the last dataset referenced
Code representing function requested by the last CICS command
Response code for the last command processed

Handle
Ignore
Nohandle

File Control Commands (RANDOM ACCESS)


+ Read
EXEC CICS READ
DATASET(ddname)
INTO(record-layout)
LENGTH(length of record-layout)
RIDFLD(key-field)
KEYLENGTH (length of key-field)
GENERIC
GTEQ/EQUAL
UPDATE
END-EXEC
Default: EQUAL without GENRIC option
GTEQ with GENERIC option
When using GENERIC, KEYLENGTH must be mentioned and in this case the length
should be equal to the actual length of the key-part we are passing for generic read. When
generic option is not used, KEYLENGTH is optional and if given should hold the length
of the entire key.
+ Write
EXEC CICS WRITE
DATASET (ddname)

FROM (record-layout)
RIDFLD(key-field)
KEYLENGTH(length of key-field)
MASSINSERT
END-EXEC
MASSINSERT is very rarely used. Do not use this unless you know the complete
implications of this option.
+ Delete
EXEC CICS DELETE
DATASET(ddname)
RIDFLD(key-field)
KEYLENGTH(length of key-field)
GENERIC
NUMREC(data-area)
END-EXEC
If we have already issued a READ with UPDATE and then want to delete the record, then
DO NOT mention RIDFLD and KEYLENGTH. We mention RIDFLD only if we want to
delete the record directly with out issuing a READ with UPDATE.
GENERIC We cannot use this option when we issue a READ with UPDATE
command. If we want to use GENERIC then we should directly issue the DELETE
command. And the rules of RIDFLS and KEYLENGTH are same as for READ. If we use
this option, all the records whose key start with that mentioned in RLDFLD gets deleted.
When this option is used, if we specify NUMREC then after the command is
executed, data-area will hold the value of number of records that have been deleted.
+ Rewrite
EXEC CICS REWRITE
DATASET (ddname)
FROM (record-layout)
Length (length of record-layout)
END-EXEC
We issue this command only after a successful READ with UPDATE command.
+ Unlock
EXEC CICS UNLOCK
DATASET (ddname)
END-EXEC
When a READ with UPDATE is issued the records gets locked. This lock gets released
only when a REWRITE or DELETE is issued. (Of course the lock gets released even
when the task completes). But after we issue a READ with UPDATE, if we feel the
record needs no update then we can release the lock over the record by issuing this
command.

File Control Commands (SEQUENTIAL ACCESS)


+Startbr
EXEC CICS STARTBR
DATASET (ddname)
RIDFLD (record-layout)
KEYLENGTH (length of record-layout)
GENERIC
GTEQ/EQUAL
REQID (data-value)
END-EXEC
The use of GENERIC and the command defaults are same as for READ. We use REQID
when we are having multiple browses on the same file in the same program to distinguish
between each of them.
+Readnext
EXEC CICS READNEXT
DATASET (ddname)
INTO (record-layout)
LENGTH (length of record-layout)
RIDFLD (key-field)
KEYLENGTH (length of key-field)
REQID (data-value)
END-EXEC
After the command is issued, Key-field will hold the key of the record which has been
read.
+Readprev
EXEC CICS READPREV
DATASET (ddname)
INTO (record-layout)
LENGTH (length of record-layout)
RIDFLD (key-field)
KEYLENGTH (length of key-field)
REQID (data-value)
END-EXEC
All the options are same for READPREV as are for READNEXT
Points to be noted:
1. We cannot issue a READPREV immediately after we issue a STARTBR with
GENERIC option.
2. If we issue a READPREV after a READNEXT has been issued, the same record
will be read.
+Endbr
EXEC CICS ENDBR
DATASET (ddname)
REQID (data-value)

END-EXEC
If we do not do a ENDBR CICS does it for us as soon as the task terminates.
+Resetbr
EXEC CICS RESETBR
DATASET (ddname)
RIDFLD (key-field)
KEYLENGTH (length of key-field)
REQID (data-value)
GENERIC
GTEQ/EQUAL
END-EXEC
If we want to do a STARTBR with doing an ENDBR then we use RESETBR.
TSQ CONTROL COMMANDS
+WRITEQ
EXEC CICS WRITEQ TS
QUEUE (Queue-name)
FROM (Queue-record-layout)
LENGTH (length of Queue-record-layout)
ITEM (data-area)
REWRITE
MAIN/AUXILIARY
END-EXEC
The queue-record-layout does not include the Queue-Name and Item-nbr in it.
We mention REWRITE when we want to rewrite an existing TSQ record. There is no
READ with UPDATE command for TSQ as is for files.
+DELETEQ
EXEC CICS DELETEQ TS
QUEUE (Queue-name)
END-EXEC
+READQ
EXEC CICS READQ TS
QUEUE (Queue-name)
INTO (record-layout)
LENGTH (length of record-layout)
ITEM (data-value)/NEXT
END-EXEC
We can read the TSQ records sequentially, by mentioning NEXT instead of ITEM option.
It will start reading from 1st record.
We can read the TSQ records randomly, by mentioning the item number of the record we
want to read against the ITEM option.
We can combine both of above, first READQ TS with ITEM option followed by READQ
TS with NEXT option to achieve dynamic read of records.

Das könnte Ihnen auch gefallen