TIPS
1. Always FSET one field. If nothing changed on screen and user presses attention key (Enter, F1, ...)
CICS will receive a data stream that does not look like a map and will trigger a MAPFAIL error.
2. Make a program more efficient only when the program consumes a large amount of system resources.
Put seldom used storage areas in linkage and do getmain as needed.
3. Setting addresses
address-pointer USAGE IS POINTER.
SET address-pointer TO ADDRESS OF your-storage-area.
SET ADDRESS OF storage-area TO address-pointer
4. The DFCOMMAREA defined in a XCTL’ed or LINK’ed program must not be larger than the area being passed.
Defined the DFCOMMAREA to be the same size for all programs within the program group.
Other methods for passing data between programs is to use the:
CWA (common work area) - one area in CICS region or partition
TCTUA (terminal control table) - one for each terminal
TWA (transaction work are) - one for each transaction, disappears when task ends (program “scratchpad”)
The TWA must be specified in the PCT. Most sites use the DFHCOMMAREA rather that TCTUA or TWA
To pass large amounts of data use temporary storage.
5. Under VS COBOL II GOBACK and EXIT PROGRAM now mean “return to the calling module”, while STOP RUN
works like an EXEC CICS RETURN command.
CICS
Commands
Comments
|
|
RESP is optional response code field for most CICS commands CICS will place response value in field,
RESP2 is optional and can provide additional info. (RESP/RESP2 should be used in place of HANDLE...) Example of using RESP IF data-area = DFHRESP (NORMAL) PERFORM NORMAL-ROUTINE ELSE IF data-area = DFHRESP(ENDFILE) PERFORM ENDFILE... ELSE PERFORM ERROR..... |
|
EXEC
CICS SEND LENGTH
(data-value) ERASE END-EXEC |
Send message to screen data-area is the name of the field containing the message The LENGTH field can be omitted in Cobol II The ERASE parm will cause the screen to be cleared and the cursor returned to the upper left. If ERASE not specified
the message will be written starting at the current cursor position. |
|
EXEC
CICS RECEIVE {INTO
(data-area) | SET (pointer-ref) } LENGTH
(data-area) [MAXLENGTH
(data-value)] [NOTRUNCATE] [RESP
(data-area) [RESP2
(data-area)]] END-EXEC |
Receive message from screen. into data area or set pointer to linkage section use LENGTH to tell CICS how long of a message program prepared to receive (CICS will invoke LENGERR
if message longer than data-area otherwise CICS puts actually msg length in field |
|
|
|
|
EXEC
CICS RETURN END-EXEC |
Return to CICS or calling program |
|
EXEC
CICS GETMAIN SET
(pointer-ref) {LENGTH(data-value)
| FLENGTH (data-value)} {INITIMG(data-value) END-EXEC |
Obtain storage in linkage area. pass pointer in pointer-ref specify amount of storage needed using LENGTH or use FLENGTH if you want storage above the 16 MB line (XA) INITIMG is the initialization character for the storage area |
|
EXEC
CICS FREEMAIN DATA
(data-area) END-EXEC |
Storage obtained by GETMAIN is automatically freed when the program terminates. If the program does
other processing, links to another program, or doesn’t execute a RETURN, use FREEMAIN to free the linkage section. Note that you specify the data-area NOT the pointer. |
|
EXEC
CICS SEND MAP(name) [MAPSET(name)] [DATAONLY
| MAPONLY] [FROM
(data-area) LENGTH(data-value)] [CURSOR] [ERASE
|ERASEUP] [FREEKB] [FRSET] [ALARM] [other
device control options] END-EXEC |
The MAPSET parm can be omitted if the MAP and MAPSET are of the same name Specify MAPONLY to send only physical map contents(headers, field labels, etc.) Omitting MAPONLY and DATAONLY causes both the physical and symbolic (data values) to be sent ERASE clears old data first FROM(..) tells CICS where to find symbolic map If symbolic map fields filled with X’00’ CICS will insert values from physical map or if no default
specified, will allow existing value to remain in the field. To send only some of the data specify FROM(….) and MAPONLY The LENGTH parm is used only when the map is sent using symbolic map data. This isn’t needed however
when the using the MAPONLY parm, or if using Cobol II. Can also be used if send the map from a data area that is longer
than the map data itself. To position the CURSOR set the field length position to -1. (The map must be defined as INOUT) ERASE will clear all data from the screen. ERASEAUP erases all unprotected fields (all protected and autoskip field data remains. It won’t clear
old displayed text in error message fields with autoskip attributes. Please blanks in error fields to erase messages) |
|
EXEC
CICS SEND CONTROL [device
control options] END-EXEC |
Use this to send some device control info the the terminal, such as ERASEAUP and you don’t need to
send any map data |
|
EXEC
CICS RECEIVE MAP(name) [MAPSET(name)] [INTO(data-area)
| SET(pointer-ref)] [FROM(data-area)
LENGTH(data-value)| TERMINAL[ASIS]] END-EXEC |
Use the INTO parm if receiving the data into working storage, use SET if into the linkage area. The MAPSET name can be omitted if the name is the same as the MAP name ASIS overrides any upper-case translation built into the system, but it is not set up to work for
terminal I/O that has already been read by terminal control before the program runs. It works only for subsequent
RECEIVE MAP command executions within that program The FROM… LENGTH… option are used when map data has been received into a storage area but the data
has not been formatted as a map. |
|
|
|
|
EXEC
CICS RETURN [TRANSID(name) [COMMAREA(data-area) [LENGTH(data-area)]] END-EXEC |
Make sure (name) has DFHCOMMAREA first in linkage section and use EIBCALEN to check the actual length
of the COMMAREA sent. |
|
EXEC
CICS XCTL PROGRAM(name) [COMMAREA(data-area) LENGHT(data-value)] END-EXEC |
Transfer control to program (not transid). You don’t return to calling program |
|
EXEC
CICS LINK PROGRAM(name) [COMMAREA(data-area) LENGTH(data-value)] |
Link to program, return from called program or XCTL’ed program A LINK’ed program wukk always be found in a “refreshed” state (vs CALL below) |
|
CALL
‘PROGNAME’ USING DFHEIBLK DFHCOMMAREA YOUR-PARM |
(No
EXEC CICS …. END-EXEC used) If
subprogram is called repeatedly, then the CALL command is more efficient than a LINK. The
called program should end with an EXIT PROGRAM or GOBACK If
the called program is called again it will be found in the state it was in (unless the called module contains the
INITIAL clause) Note
– A subroutine without any CICS commands can be called by a CICS routine by providing 2 ‘dummy’ linkage areas in
the subroutine for DFHEIBLK and DFHCOMMAREA that are passed by the CICS main routine. |
|
EXEC
CICS START TRANSID(name) [INTERVAL(hhmmss)|INTERVAL
(0) | TIME(hhmmss)] FROM(data-area) LENGTH(data-value)] [TERMID(NAME)] (REQID(name)] END-EXEC |
Starts another transaction, either immediately or at another time of day or after a specific interval
Can start trans at another terminal (There are other options available) |
|
EXEC
CICS RETRIEVE [INTO(data-area)|SET(pointer-ref)] LEGNTH(data-area) END-EXEC |
RETRIEVE needed to obtain data sent by program issuing START |
|
EXEC
CICS CANCEL REQID(name) END-EXEC |
Cancel a task that has yet to execute REQID is from above START. |
|
|
|
|
EXEC
CICS ASSIGN CWALENG(data-area) TWALENG(data-area) TCTUALENG(data-area) ABCODE(?) FACILITY(?) OPCLASS(?) OPID(?) OPSECURITY(?) TERMCODE(?) QNAME(data-area) END-EXEC |
Check to see if storage areas exist and are of the expected length All areas are optional Abend codes Id of entity that started transaction signon and security stuff How current task started Type of terminal attached to task TD queue name |
|
EXEC
CICS ADDRESS CWA(pointer-ref) TWA(pointer-ref) TCTUA(pointer-ref) END-EXEC |
Acquire addressability to the areas |
|
|
|
|
EXEC
CICS LOAD PROGRAM(name) SET(pointer-ref) LENGTH(data-area)|FLENGH(data-area) [HOLD] [ENTRY(pointer-ref)] END-EXEC |
Generally loads data in program form (Entry in PPT needed) |
|
EXEC
CICS RELEASE PROGRAM(name) END-EXEC |
If HOLD option used above, releases (name) |
|
|
|
|
EXEC
CICS ASKTIME ABSTIME(data-area) END-EXEC |
Updates EIBDATE and EIBTIME fields and
places absolute time in full-word data area |
|
EXECI
CICS FORMATTIME ABSTIME
(data-value) [YYDDD
(data-area)] [DDMMYY(data-area)] …. (pg.
175) |
Formats ABSTIME value into ….. |
|
|
|
CICS
VSAM access
|
EXEC
CICS READ DATASET(name) [UPDATE] RIDFLD(data-area) {SET(pointer-ref)|INTO(data-area)} [LENGTH(data-area)] [KEYLENGTH(data-value)[GENERIC]] [RBA|RRN] [GTEQ|EQUAL] END-EXEC |
Read VSAM file Update locks a record being read RIDFLD specifies VSAM key (use area outside VSAM record) KEYLENGHT/GENERIC used for partial keys |
|
EXEC
CICS WRITE DATASET(name) RIDFLD(data-area) FROM(data-area) [KEYLENGTH(data-value)] [LENGTH(data-area) [RBA|RRN] [MASSINSERT] END-EXEC (pg.
212) |
Writes new records Must use RIDFLD for KSDS data sets Specify LENGTH if variable length RRN used of relative record data set |
|
EXEC
CICS UNLOCK DATASET(name) END-EXEC |
Use when READ for UPDATE was used by program decided not to complete the update or delete. (Only one READ for UPDATE can be pending against any one data set at a given time) |
|
EXEC
CICS DELETE DATASET(name) END-EXEC |
Record must have been READ for UPDATE |
|
EXEC
CICS DELETE DATASET(name) [RIDFLD(data-area)] [KEYLENGTH(data-value)] KEYLENGTH(data-value)] [GENERIC[NUMREC(data-area)]]]] [RBA|RRN] END-EXEC. |
Delete a record or group of records directly without previously doing a READ for UPDATE. |
|
EXEC
CICS STARTBR DATASET(name) RIDFLD(data-area) [KEYLENGTH(data-value)[GENERIC]] [RBA|RRN] [GTEQ|EQUAL] END-EXEC |
Start browse but doesn’t actually place a record in the working storage or linkage section.(Do a READNEXT
or READPREV) |
|
EXEC
CICS STARTBR DATASET(name) RIDFLD(data-area) [KEYLENGTH(data-value)[GENERIC]] [RBA|RRN] [GTEQ|EQUAL] END-EXEC |
End a browse and start a new browse (Equivalent to a ENDBR followed by a STARTBR) |
|
EXEC CICS READNEXT |