CICS Basic 280803
CICS Basic 280803
24/08/2003
1/256
24/08/2003
2/256
REFERENCES
1.MURACHs CICS for the COBOL programmer.
2.IBM manuals from the Book Manager CICS bookshelf.
3.The sample application used in the LAB exercises
is from the above MURACH book.
4.Some additional programs have been written to
illustrate advanced concepts.
5.Students are requested to refer to the MURACH
book as well as IBM manuals on the CICS product
for more details.
24/08/2003
CONTENTS
Start
1. Introduction
2. Introduction to CICS Programming
3. How to create a BMS mapset
4. How to code a CICS program
5. How to use Temporary Storage
6. Additional Programming Techniques
7. Introduction to debug a ASRA abend
8. How to process files sequentially
9. How to use vsam alternate indexes
10. Other file processing feature
11. Advanced Program control
12. Manipulating Dynamic Storage
13. Advanced BMS
14. Advanced File Control
15. Temporary Storage Control
16. Transient Data Control
17. Interval Control
18. Task Control
3/256
24/08/2003
4/256
INTRODUCTION
back
D is k s t o r a g e
O p e r a tin g s y s te m
A p p lic a t io n
p ro g ra m s
D a ta a c c e s s
(V S A M ,D B 2 ,IM S )
C IC S
C o m m u n ic a t io n
access
(V T A M , S N A ,
T C P /IP )
U s e r in te r f a c e
O S /3 9 0
A d d re s s s p a c e 1
A d d re s s s p a c e 2
A d d re s s s p a c e 3
A d d re s s s p a c e 4
C IC S p r o d u c tio n
r e g io n
B a tc h
Job
C IC S
te s t
r e g io n
TSO
user
24/08/2003
5/256
Operating system
OS/390, MVS, VSE
OS/400
AIX (UNIX)
Windows NT, OS/2
Description
The most used programming language for both batch and online
applications in a mainframe environment.
Assembler language is used mostly for special-purpose devices
like ATM machines.
PL/I
C and C++
Java
24/08/2003
6/256
3 2 7 0 d is p la y
IB M 3 x 7 4
c o n t r o lle r
3 2 7 0 d is p la y
S /3 9 0
m a in fr a m e
LAN/
W AN
In te r n e t/
In tr a n e t
3 2 7 0 d is p la y
PC 3270
e m u la tio n
PC 3270
e m u la tio n
PC 3270
e m u la tio n
PC 3270
e m u la t io n
PC 3270
e m u la t io n
PC 3270
e m u la t io n
24/08/2003
7/256
3270
P r e s e n t a t io n lo g ic
B u s in e s s lo g ic
P C
3 2 7 0 e m u la t io n
H TTP
W e b a p p lic a t io n
M Q S e r ie s
F ro n t-e n d
a p p lic a t io n
E C I
V is u a l B a s ic
a p p lic a t io n
When CICS is used with alternate user interfaces, the front-end program
provides the presentation logic, but the CICS application is still the
back-end program that provides the business logic.
24/08/2003
8/256
Task 2
Task 3
Task 4
Task 5
O rd e r e n try
p ro g ra m
(u s e r 1 )
C u s to m e r
in q u ir y
p ro g ra m
(u s e r 2 )
M a s te r m e n u
p ro g ra m
(u s e r 3 )
C u s to m e r
m a in te n a n c e
p ro g ra m
(u s e r 4 )
O rd e r e n try
p ro g ra m
(u s e r 5 )
Within CICS, two or more tasks can execute at the same time using a
CICS feature called multitasking.
User 5
User 1
User 5
Working
storage
With multithreading, two or more users can access the same copy of a
program at the same time. CICS accomplishes this by providing a separate
copy of working storage for each user running the program.
24/08/2003
9/256
T h e u s e r e n te rs
t r a n s - id O R D 1
ORD1
PCT
C I C S lo c a t e s
t r a n s - id O R D 1
in th e P r o g r a m
C o n tr o l T a b le
T r a n s a c tio n
P ro g ra m
D
D
M
O
O
D
D
M
O
O
M 01
M 01
MA1
RD1
RD2
M PG M 01
M PG M 02
MAPGM1
RDPGM1
RDPGM2
PPT
C I C S lo c a t e s
p ro g ra m
O R D P G M 1 in t h e
P r o c e s s in g
P r o g r a m T a b le
P ro g ra m
L o c a tio n
D
D
M
O
O
In s to ra g e
O n d is k
In s to ra g e
O n d is k
O n d is k
M PG M 01
M PG M 02
MAPGM1
RDPGM1
RDPGM2
C IC S a d d re s s s p a c e
DM PG M 01
C I C S lo c a t e s lo a d
m o d u le O R D P G M 1
o n d is k , lo a d s it
in to m e m o r y , a n d
s ta rts th e ta s k
L ib r a r y
L o a d m o d u le
DMPROG
D
D
M
O
O
MMAPROG
ORDPROG
M PG M 01
M PG M 02
MAPGM1
RDPGM1
RDPGM2
MMAPGM1
ORDPGM1
24/08/2003
10/256
D a ta
m anagem ent
s e r v ic e s
C IC S
m anagem ent
s e r v ic e s
A p p lic a tio n
P r o g r a m m in g
In te rfa c e
A p p lic a t io n
p ro g ra m s
D a ta
c o m m u n ic a tio n
s e r v ic e s
program
through
its
24/08/2003
11/256
O S /3 9 0
C IC S
T e r m in a l
c o n tro l
A p p lic a tio n
P r o g r a m m in g
In te r fa c e
A p p lic a tio n
p ro g ra m s
B a s ic
m a p p in g
s u p p o rt
M aps
VTAM , SN A,
T C P /IP
T e r m in a l
user
Basic
mapping
support
(BMS)
provides
application programs and terminal control.
the
CICS
interface
and
the
between
24/08/2003
D is k s to r a g e
O S /3 9 0
VSAM
D B2
IM S
SQ L
D L /I
C IC S
F ile c o n t r o l
A p p lic a tio n
P r o g r a m m in g
In te rfa c e
A p p lic a tio n
p ro g ra m s
12/256
24/08/2003
13/256
Description
Program control
Temporary storage
control
Interval control
Storage control
Task control
Dump control
Trace control
Journal control
Transient data control
24/08/2003
14/256
back
S ta r t
S e n d
fir s t
m a p
W a it
fo r
in p u t
E n d ?
Ye s
E n d
N o
R e c e ive
m a p
P ro c e s s
d a ta
S e n d
m a p
the
task
24/08/2003
15/256
Send
fir s t
m ap
W a it
fo r
in p u t
S ta r t
End?
Yes
End
N o
End
R e c e ive
m ap
P ro c e s s
d a ta
Send
m ap
End
and
24/08/2003
16/256
24/08/2003
17/256
Accept Date/Day/Day-Of-Week/Time
Sort / Merge
Sign is separate
Current-date
Date
Stop run
Day
Time
Exhibit
Unstring
Inspect
24/08/2003
18/256
C I C S tr a n s la t o r
T r a n s la t e d p r o g r a m
C o p y lib r a r ie s
C O B O L c o m p ile r
C o m p ile r o u tp u t
O b je c t m o d u le
O b je c t lib r a r ie s
L in k a g e e d ito r
L in k a g e e d it o r
o u tp u t
L o a d m o d u le
24/08/2003
19/256
NAME memname(R)
/*
//* THIS FOR USER LOADLIB FOR C0A2
//LKED.SYSLMOD DD DSN=<-loadlib->(memname),DISP=SHR
//
PROC
24/08/2003
20/256
//
UNIT=&WORK,SPACE=(80,(250,100))
//SYSUT1
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT2
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT3
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT4
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT5
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT6
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT7
DD UNIT=&WORK,SPACE=(460,(350,100))
//*
//COPYLINK EXEC PGM=IEBGENER,COND=(7,LT,COB)
//SYSUT1
DD DSN=&INDEX..&LIB(&STUB),DISP=SHR
//SYSUT2
DD DSN=&©LINK,DISP=(NEW,PASS),
//
DCB=(LRECL=80,BLKSIZE=400,RECFM=FB),
//
UNIT=&WORK,SPACE=(400,(20,20))
//SYSPRINT DD SYSOUT=&OUTC
//SYSIN
DD DUMMY
//*
//LKED
EXEC PGM=IEWL,REGION=®,
//
PARM='&LNKPARM',COND=(5,LT,COB)
//SYSLIB
DD DSN=&INDEX..SDFHLOAD,DISP=SHR
//
DD DSN=&COMPHLQ..SDFHLINK,DISP=SHR
//
DD DSN=CEE.SCEELKED,DISP=SHR
//
DD DSN=CEE.SCEERUN,DISP=SHR
//SYSUT1
DD UNIT=&WORK,DCB=BLKSIZE=1024,
//
SPACE=(1024,(200,20))
//SYSPRINT DD SYSOUT=&OUTC
//SYSLIN
DD DSN=&©LINK,DISP=(OLD,DELETE)
//
DD DSN=&&LOADSET,DISP=(OLD,DELETE)
//
DD DDNAME=SYSIN
The CICS-supplied procedures to install your online application programs
in a CICS library specify the CICS library member that contains the
INCLUDE statement for the appropriate language EXEC interface module.
These library members are named DFHEILIx, where x is A for assembler, C
for COBOL, D for C, or P for PL/I.
In this VS COBOL II example, the symbolic parameters STUB and LIB
default to DFHEILIC and SDFHCOB. The DFHEILIC member contains the
statement INCLUDE SYSLIB(DFHECI). The COPYLINK step ensures that DFHECI
is the first CSECT in the load module.
Language
Assembler
C
COBOL
PL/I
24/08/2003
21/256
DSN510.SDSNLOAD and TCPIP.SEZATCP. Note that the HLQ DSN510 for the DB2
dataset will change with the DB2 version. DSN510 is for V5.1.
you
to
5. To code a BMS mapset, you use two assembler commands (PRINT NOGEN and
END) and three macros (DFHMSD, DFHMDI, and DFHMDF).
6. A DFHMSD macro marks the start and end of each mapset.
7. A DFHMDI macro marks the beginning of each map.
8. A DFHMDF macro defines each field.
Sample
PRINT NOGEN
DFHMSD TYPE=&SYSPARM,
X
LANG=COBOL,
X
MODE=INOUT,
X
TERM=3270-2,
X
CTRL=FREEKB,
X
STORAGE=AUTO,
X
TIOAPFX=YES
***********************************************************************
INQMAP1 DFHMDI SIZE=(24,80),
X
LINE=1,
X
COLUMN=1
***********************************************************************
DFHMDF POS=(1,1),
X
LENGTH=7,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='INQMAP1'
DFHMDF POS=(1,20),
X
LENGTH=16,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='Customer Inquiry'
TRANID
DFHMDF POS=(1,76),
X
LENGTH=4,
X
ATTRB=(NORM,PROT),
X
INQSET1
24/08/2003
22/256
COLOR=BLUE,
X
INITIAL='XXXX'
***********************************************************************
DFHMDF POS=(3,1),
X
LENGTH=42,
X
ATTRB=(NORM,PROT),
X
COLOR=NEUTRAL,
X
INITIAL='Type a customer number. Then press Enter.'
DFHMDF POS=(5,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='Customer number. . . . .'
CUSTNO
DFHMDF POS=(5,26),
X
LENGTH=6,
X
ATTRB=(NORM,UNPROT,IC),
X
COLOR=TURQUOISE,
X
INITIAL='______'
DFHMDF POS=(5,33),
X
LENGTH=1,
X
ATTRB=ASKIP
***********************************************************************
DFHMDF POS=(7,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='Name and address . . . :'
LNAME
DFHMDF POS=(7,26),
X
LENGTH=30,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
FNAME
DFHMDF POS=(8,26),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
ADDR
DFHMDF POS=(9,26),
X
LENGTH=30,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
CITY
DFHMDF POS=(10,26),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
STATE
DFHMDF POS=(10,47),
X
LENGTH=2,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
ZIPCODE DFHMDF POS=(10,50),
X
LENGTH=10,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
***********************************************************************
MESSAGE DFHMDF POS=(23,1),
X
LENGTH=79,
X
ATTRB=(BRT,PROT),
X
COLOR=YELLOW
DFHMDF POS=(24,1),
X
24/08/2003
23/256
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='F3=Exit
F12=Cancel'
DUMMY
DFHMDF POS=(24,79),
X
LENGTH=1,
X
ATTRB=(DRK,PROT,FSET),
X
INITIAL=' '
***********************************************************************
DFHMSD TYPE=FINAL
END
The symbolic map definition
The fields in a symbolic map represent the data thats sent to and
received from a terminal by a COBOL program.
You use a COPY statement to copy the symbolic map into the WorkingStorage Section of your program.
A symbolic map includes two 01-level items that occupy the same
storage space: one for input and one for output.
For each input field in the mapset (I), the symbolic map contains a
length field (L), a flag field (F), and an attribute field (A).
For each output field (O), the symbolic map contains a Picture for
the output data, which can be different from the picture for the
input field.
01 INQMAP1I.
03 FILLER
03 TRANIDL
03 TRANIDF
03 FILLER REDEFINES
05 TRANIDA
03 TRANIDI
03 CUSTNOL
03 CUSTNOF
03 FILLER REDEFINES
05 CUSTNOA
03 CUSTNOI
03 LNAMEL
03 LNAMEF
03 FILLER REDEFINES
05 LNAMEA
03 LNAMEI
03 FNAMEL
03 FNAMEF
03 FILLER REDEFINES
05 FNAMEA
03 FNAMEI
03 ADDRL
03 ADDRF
03 FILLER REDEFINES
05 ADDRA
03 ADDRI
PIC X(12).
PIC S9(4) COMP.
PIC X.
TRANIDF.
CUSTNOF.
PIC X.
PIC X(4).
PIC S9(4) COMP.
PIC X.
PIC X.
PIC X(6).
PIC S9(4) COMP.
PIC X.
LNAMEF.
FNAMEF.
PIC X.
PIC X(30).
PIC S9(4) COMP.
PIC X.
PIC X.
PIC X(20).
PIC S9(4) COMP.
PIC X.
ADDRF.
PIC X.
PIC X(30).
24/08/2003
24/256
STATEF.
PIC X.
PIC X(20).
PIC S9(4) COMP.
PIC X.
PIC X.
PIC X(2).
PIC S9(4) COMP.
PIC X.
ZIPCODEF.
MESSAGEF.
PIC X.
PIC X(10).
PIC S9(4) COMP.
PIC X.
PIC X.
PIC X(79).
PIC S9(4) COMP.
PIC X.
DUMMYF.
PIC X.
PIC X(1).
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X(12).
X(3).
X(4).
X(3).
X(6).
X(3).
X(30).
X(3).
X(20).
X(3).
X(30).
X(3).
X(20).
X(3).
X(2).
X(3).
X(10).
X(3).
X(79).
X(3).
X(1).
24/08/2003
25/256
//
REG=2048K,
REGION FOR ASSEMBLY
//
OUTC=A,
PRINT SYSOUT CLASS
//
WORK=SYSDA
WORK FILE UNIT
//ASMMAP
EXEC PGM=&ASMBLR,REGION=®,
// PARM='SYSPARM(MAP),DECK,NOOBJECT'
//SYSPRINT DD SYSOUT=&OUTC
//SYSLIB
DD DSN=&INDEX..SDFHMAC,DISP=SHR
//
DD DSN=SYS1.MACLIB,DISP=SHR
//SYSUT1
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSUT2
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSUT3
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSPUNCH DD DSN=&&MAP,DISP=(,PASS),UNIT=&WORK,
//
DCB=(RECFM=FB,LRECL=80,BLKSIZE=400),
//
SPACE=(400,(50,50))
//SYSIN
DD DSN=USER01.MAPSET.SOURCE(&MAPNAME),DISP=SHR
//LINKMAP EXEC PGM=IEWL,PARM='LIST,LET,XREF,RMODE(&RMODE)'
//SYSPRINT DD SYSOUT=&OUTC
//SYSLMOD DD DSN=,<----cics mapset library --->(&MAPNAME),DISP=SHR
//SYSUT1
DD UNIT=&WORK,SPACE=(1024,(20,20))
//SYSLIN
DD DSN=&&MAP,DISP=(OLD,DELETE)
//ASMDSECT EXEC PGM=&ASMBLR,REGION=®,
// PARM='SYSPARM(DSECT),DECK,NOOBJECT'
//SYSPRINT DD SYSOUT=&OUTC
//SYSLIB
DD DSN=&INDEX..SDFHMAC,DISP=SHR
//
DD DSN=SYS1.MACLIB,DISP=SHR
//SYSUT1
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSUT2
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSUT3
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSPUNCH DD DSN=&DSCTLIB(&MAPNAME),DISP=OLD
//SYSIN
DD DSN=USER01.MAPSET.SOURCE(&MAPNAME),DISP=SHR
JOB
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//
JCLLIB ORDER=(USER01.PROCLIB)
//STEP1 EXEC DFHMAPT,MAPNAME=memname
//
24/08/2003
26/256
24/08/2003
27/256
back
Inputmsg Command
EXEC CICS
LINK PROGRAM(name)
[COMMAREA(data_area)[ LENGTH(data_value)][DATALENGTH(data_value)]]
[ INPUTMSG (data_area) [ INPUTMSGLEN(data_value)]]
[ SYSID(name)]
[ SYNCONRETURN ]
END-EXEC
Options
PROGRAM
COMMAREA
LENGTH
DATALENGTH
Use this when the called program returns more data than is
passed. This length specifies the passed data. This is
useful in DPL where less data needs to be transmitted across
the link to the called program.
INPUTMSG
NOTAUTH
PGMIDERR
ROLLEDBACK
24/08/2003
SYSIDERR
TERMERR
28/256
RECEIVE Command
Use the RECEIVE command to access the data passed via INPUTMSG. The
syntax of the RECEIVE command is below:EXEC
CICS
END-EXEC
Options
INTO
SET
LENGTH
A half word binary PIC S9(4) COMP which on return from the
call has the length of the actual data received.
FLENGTH
NOTRUNCATE
conditions
LENGERR
The data length exceeds the buffer and the excess has been
discarded.
24/08/2003
29/256
LOAD COMMAND
This command fetches a Load module from a Load Library into storage and
returns the address and length to the issuing program. Such loaded
programs are usually modules which represent tables created by coding DS
and DC instructions in an assembler source file. The loaded program does
not have executable code. The loaded program code (table data) is mapped
into a LINKAGE SECTION 01 level data item. The loaded program is read
only and any changes made to its data is not reflected back to the load
module in the PDS.
EXEC CICS
LOAD PROGRAM(name)
[ SET(pointer-ref)]
[LENGTH(data-area) | FLENGTH(data-area)]
[ ENTRY(pointer-ref) ]
[ HOLD ]
Options
PROGRAM
SET
LENGTH | FLENGTH
ENTRY
HOLD
Conditions
LENGERR
24/08/2003
30/256
set when the size of the loaded module is more than 32K and
LENGTH was specified in the call instead of FLENGTH.
NOTAUTH
PGMIDERR
Notes
LOAD is used to remove embedded constants from mainline programs and put
these into a table created using assembler. That way the table entries
can be changed by recompiling the assembler code and avoiding changes to
much larger complex COBOL program. Typical examples could be a fare
table, which can undergo frequent change.
Example OS/VS COBOL.
LINKAGE SECTION
*
01 BLL-CELLS.
05
FILLER
PIC S9(8) COMP.
05
BLL-STATE-TABLE
PIC S9(8) COMP.
*
1
STATE-TABLE.
*
05
STATE-CODE
OCCURS 52 PIC XX.
*
PROCEDURE DIVISION.
*
0000-ACCEPT-CUSTOMER-ORDERS.
*
EXEC CICS
LOAD PROGRAM(STATABL)
SET(BLL-STATE-TABLE)
HOLD
END-EXEC.
SERVICE RELOAD STATE-TABLE.
Example COBOL II example
LINKAGE SECTION
*
1
STATE-TABLE.
*
05
STATE-CODE
OCCURS 52
*
PROCEDURE DIVISION.
*
0000-ACCEPT-CUSTOMER-ORDERS.
*
EXEC CICS
LOAD PROGRAM(STATABL)
SET(ADDRESS OF STATE-TABLE)
HOLD
END-EXEC.
*
PIC X(10).
24/08/2003
31/256
conditions
INVREQ
24/08/2003
32/256
NOTAUTH
PGMIDERR
USAGE
0500-RELEASE-STATE-TABLE.
*
EXEC CICS
RELEASE PROGRAM(STATATBL)
END-EXEC.
+---------------------------+
CICA +-------------------+
DEFINE
PROGRAM('PGA')
REMOTESYSTEM(CICB)
+-------------------+
24/08/2003
33/256
+---------------------------+
CICB +-----------------+
DEFINE
PROGRAM('PGA')
+-----------------+
+---------------+
+--------------+
.
EXEC CICS LINK
CICS mirror
PROGRAM('PGA') +--+
ISC or MRO
transaction +-+
COMMAREA(...) +----------<---->------ (issues LINK
.
session
command and
.
passes back
.
commarea)
+---------------+
+--------------+
+---------------------------+
+---------------------------+
Client programs can run in a CICS intercommunication environment and use
DPL without being aware of the location of the server program.
DEFINE PROGRAM(PG1) REMOTESYSTEM(CICB) ...
DEFINE PROGRAM(PG99) REMOTENAME(PG1) REMOTESYSTEM(CICC) ...
In the second definition above the requested program is known by a
different name on the remote system.
A transformer program DFHXFP is used to transform the call request to a
form suitable for sending across the link. At the remote system a mirror
transaction (represented by program DFHMIRS) is used to link to the
target user program. If a user transaction identifier points to DFHMIRS
then that must be specified by the TRANID of the link call. Else by
default CSMI or CVMI is used. The definitions for all these system level
Objects are defined in group DFHISC.
Examples of DPL
This section gives some examples to illustrate the lifetime of the
mirror transaction and the information flowing between the client
program and its mirror transaction.
System A
Application Transaction
.
.
EXEC CICS LINK
PROGRAM('PGA')
COMMAREA(...) ...
.
.
Transmitted
Information
24/08/2003
34/256
System B
Attach mirror,
'LINK' request
------------------>
Attach
mirror transaction.
Mirror performs LINK
to PGA.
PGA runs, issues RETURN.
Reply passed to
client program.
.
.
EXEC CICS SYNCPOINT
Syncpoint completed.
Client program
continues.
Commarea data
<-----------------'SYNCPOINT'
request, last
------------------>
Positive response
<------------------
System B
+----------+
Synchronous Processing (DTP)
+------+-------+
TRAN1 +--<---->-- TRAN2
+------+-------+
+------+-------+
TRAN3 +---->----- TRAN4
+------+------TRAN5 +----<----+------+-------+
+----------+
+----------+
and sends
TRAN5
exists
TRAN3 and
24/08/2003
35/256
0.
0.
24/08/2003
36/256
PERFORM END-PARA.
MAIN-PARA.
EXEC CICS
RETRIEVE
INTO(WS-LINK)
LENGTH(WS-LINK-DATA-LEN)
RTRANSID(WS-RTRANSID)
RTERMID(WS-RTERMID)
RESP(WS-RESP)
END-EXEC
MOVE "SAMP13" TO WS-SERVER-DATA
EXEC CICS
START
TRANSID(WS-RTRANSID)
TERMID(WS-RTERMID)
FROM(WS-LINK-DATA)
LENGTH(WS-LINK-DATA-LEN)
RESP(WS-RESP)
END-EXEC.
END-PARA.
EXEC CICS
RETURN
END-EXEC.
SAMP14
tranid SM14
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMP14.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VARS.
03 WS-RESP
PIC S9(08) COMP VALUE
01 WS-LINK.
03 WS-LINK-DATA
PIC X(30).
03 WS-SERVER-DATA
PIC X(8) VALUE " ".
03 WS-CLIENT-DATA
PIC X(8) VALUE " ".
01 WS-LINK-DATA-LEN
PIC S9(04) COMP VALUE 46.
PROCEDURE DIVISION.
PERFORM MAIN-PARA
PERFORM END-PARA.
MAIN-PARA.
EXEC CICS
RETRIEVE
INTO(WS-LINK)
LENGTH(WS-LINK-DATA-LEN)
RESP(WS-RESP)
END-EXEC
MOVE "SAMP14" TO WS-CLIENT-DATA
EXEC CICS
SEND TEXT
FROM(WS-LINK-DATA)
LENGTH(WS-LINK-DATA-LEN)
RESP(WS-RESP)
END-EXEC.
END-PARA.
EXEC CICS
RETURN
0.
24/08/2003
37/256
END-EXEC.
24/08/2003
38/256
The WAIT option of the RETRIEVE command can be used to put the
transaction into a wait state pending the arrival of the next start
request from the remote system.
24/08/2003
39/256
back
Prog
A
Instruction Address
+------------------------------------------------------------+
The fields are described in the ESA/390 principles of operation. However
Note the 4 bit storage protection key field. Whenever a program runs on
the S/390, the storage that the program can access is determined by the
Key field in the PSW. The system sets a key for every 4k page of virtual
storage in the address space in which the program is running. The key of
the 4k page that the program is accessing and the key field in the PSW
must match for the program to access the storage.
User programs run under PSW key 8. Historically CICS has always run as a
user program from the perspective of the operating system and used user
key storage. So did user programs running under CICS. This made CICS
vulnerable to badly written programs. Current releases of CICS have an
option of defining one of two keys under which a user program is to run.
You can specify (its the default) user key. In this case a bad program
cannot affect CICS but it could affect other programs, perhaps unrelated
ones. You specify CICS KEY when you want to access and perhaps modify
CICS owned storage. Typical are applications that use the CICS system
programming interface.
You specify this option when you use CEDA to define a program resource
to CICS.
In addition, for critical transactions, you can specify transaction
isolation when you define the transaction. In the CEDA define
transaction screen,
ISOLATE({YES|NO})
specifies whether CICS is to isolate the transaction's user-key tasklifetime storage to provide transaction-to-transaction protection.
Isolation means that the user-key task-lifetime storage is protected
from both reading and writing by the user-key programs of other
transactions--that is, from programs defined with EXECKEY(USER).
24/08/2003
40/256
+------------------------------------------------------------------------+
Transactions with
+---+
+---+
+---+
+---+
+-----------------
User-key
TRN
TRN
TRN
TRN
TRN TRN TRN
task-lifetime
A
B
C
D
E F G
storage
+---+
+---+
+---+
+---+
+-----------------
+----------------------------------------------------
CICS-key storage
Write access for all EXECKEY(CICS) programs
+----------------------------------------------------
+------------------------------------------------------------------------+
Conceptual view of key protection and transaction isolation.
SIT Parameters that affect Storage access
CMDPROT={YES|NO}
specifies that you want to allow, or inhibit, CICS validation of start
addresses of storage referenced as output parameters on EXEC CICS
commands.
YES
NO
CWAKEY={USER|CICS}
specifies the storage key for the common work area (CWA) if you are
operating CICS with storage protection (STGPROT=YES). (You specify how
much storage you want for the CWA on the WRKAREA parameter.)
The
permitted values are USER (the default), or CICS:
STGPROT={NO|YES}
specifies whether you want storage protection in the CICS region.
permitted values are NO (the default), or YES:
The
NO
YES
If you specify YES, and if you have the required hardware and
software, CICS operates with storage protection, and observes the
storage keys and execution keys that you specify in various system
and resource definitions.
GETMAIN COMMAND
Get main storage.
24/08/2003
41/256
EXEC CICS
GETMAIN SET(ptr-ref)
FLENGTH(data-value)
BELOW
LENGTH(data value)
INITIMG(data value)
SHARED
NOSUSPEND
USERDATAKEY | CICSDATAKEY
END-EXEC
Options
SET
LENGTH
FLENGTH
BELOW
INITMG
NOSUSPEND
SHARED
USERKEY
CICSKEY
Conditions
LENGERR
NOSTG
of
requested
storage
is
not
immediately
24/08/2003
42/256
Notes
1. BELOW gets storage below 16MB line, typically for AMODE(24) programs.
Be aware that the amount of storage below the line is severely
limited.
2. INITMG initializes the storage with the data value. Be aware that
this can cause excessive paging activity for large storage blocks.
3. SHARED The acquires storage will not be freed on task termination. It
needs an explicit FREEMAIN from this or any other task. Be aware that
if the storage is not explicitly freed, and repeated calls are made
to acquire shared storage, you will eventually get a CICS Short on
Storage condition.
4. NOSUSPEND will make CICS return immediately with the NOSTG response
code when adequate storage is not available, else the task is
suspended until enough storage is available.
5. CICSDATAKEY causes CICS to acquire storage with CICS key. A task
running in USER key will not be able to use storage acquired in
CICSDATAKEY. Use this when the task is running in CICSKEY and you
want to protect the storage from errant tasks running in USERKEY
Example
OS/VS COBOL
LINKAGE SECTION
*
01 BLL-CELLS.
05
FILLER
PIC S9(8) COMP.
05
BLL-INVENTORY-RECORD
PIC S9(8) COMP.
*
1
INVENTORY-RECORD.
.
.
*
PROCEDURE DIVISION.
*
.
.
EXEC CICS
GETMAIN SET(BLL-INVENTORY-RECORD)
LENGTH(2048)
INITIMG(HEX-00)
END-EXEC.
SERVICE RELOAD INVENTORY-RECORD.
COBOL II example
LINKAGE SECTION
*
01
INVENTORY-RECORD.
.
.
PROCEDURE DIVISION.
.
.
24/08/2003
43/256
EXEC
CICS
GETMAIN SET(ADDRESS OF INVENTORY-RECORD)
LENGTH(2048)
INITMG(HEX-00)
END-EXEC.
01
BLL-CELLS.
05
FILLER
05
BLL-TABLE-ADDRESS-1
05
BLL-TABLE-ADDRESS-2
*
1
BLL-TABLE-ADDRESS-3
TABLE
24/08/2003
44/256
PROCEDURE DIVISION.
0000-ACCEPT-CUSTOMER-ORDERS.
EXEC
CICS
LOAD PROGRAM(STATABL)
SET(BLL-TABLE-ADDRESS-1)
END-EXEC.
ADD 4096 BLL-TABLE-ADDRESS-1 GIVING BLL-TABLE-ADDRESS-2
ADD 4096 BLL-TABLE-ADDRESS-2 GIVING BLL-TABLE-ADDRESS-3
SERVICE RELOAD TABLE.
In general If an address is moved into a BLL cell, addressability must
be established in the same way, for example:
MOVE B-POINTER TO A-POINTER.
SERVICE RELOAD A-DATA.
CICS Allocation of storage
CICS always allocates on double-word boundaries and rounds the requested
length up to the nearest double-word multiple.
Because there is no
default initialization, you must use the INITIMG option if you require
the storage to be initialized to a specific bit configuration.
CICS allocates storage from one of six different dynamic storage areas
(DSAs):
The CICS dynamic storage area (CDSA), below the 16MB line
The user dynamic storage area (UDSA), below the 16MB line
The shared dynamic storage area (SDSA), below the 16MB line
The extended CICS dynamic storage area (ECDSA), above the 16MB line
The extended user dynamic storage area (EUDSA), above the 16MB line
The extended shared dynamic storage area (ESDSA), above the 16MB line
There are two other dynamic storage areas--the read-only DSA (RDSA)
and the extended read-only DSA (ERDSA)--but you cannot GETMAIN
storage from these DSAs.
24/08/2003
45/256
+------------------------------------------------------------------------
No data-key
USERDATAKEY specified
CICSDATAKEY specified
option
+--------------+----------------------------+----------------------------
Determined
User-key storage
CICS-key storage
by
(from UDSA or EUDSA)
(from CDSA or ECDSA)
TASKDATAKEY
on
transaction
definition
+------------------------------------------------------------------------+
+------------------------------------------------------------------------+
+------------------------------------------------------------------------
No data-key
USERDATAKEY specified
CICSDATAKEY specified
option
+--------------+----------------------------+----------------------------
Determined
User-key storage
CICS-key storage
by
(from SDSA or ESDSA)
(from CDSA or ECDSA)
TASKDATAKEY
on
transaction
definition
+------------------------------------------------------------------------+
Note:-Shared DSA are for long life, shared Storage. SHARED storage is
available for all tasks, even those that run with Transaction isolation.
Example of GETMAIN OS/VS Cobol
LINKAGE SECTION.
*
01 BLL-CELLS.
*
05 FILLER
PIC S9(8)
COMP.
05 BLL-INVENTORY-RECORD
PIC S9(8)
COMP.
*
1
INVENTORY-RECORD.
.
.
.
PROCEDURE DIVISION.
.
.
EXEC CICS
GETMAIN
SET(BLL-INVENTORY-RECORD)
24/08/2003
46/256
LENGTH(2048)
INITMG(HEX-00)
.
END-EXEC
24/08/2003
47/256
CWAKEY={USER|CICS}
specifies the storage key for the common work area (CWA) if you are
operating CICS with storage protection (STGPROT=YES). The permitted
values are USER (the default), or CICS:
USER
CICS obtains storage for the CWA in user key. This allows a
user program executing in any key to modify the CWA.
CICS
TCTUAKEY={USER|CICS}
specifies the storage key for the terminal control table user areas
(TCTUAs)
if
you
are
operating
CICS
with
storage
protection
(STGPROT=YES).
USER
CICS
ANY
The system programmer defines the size of the area. The CWA could be
accessed by all CICS transactions. The TCTUA is an area shared by all
transactions run from the same terminal. This area is rarely used as
front ends have changed from 3270s to client systems that do not
communicate as a terminal to CICS.
TWA
All programs that run as a result of an instance of the transaction
execution share this work area. It is specified in the RDO for a
transaction via TWASIZE parameter and can be up to 32767 bytes.
24/08/2003
48/256
CWA
EIB
TCTUA
TWA
Condition
INVREQ
Notes
The ADDRESS command simply returns the address requested. You have to
provide the 01 level structure in the linkage section to map over the
addressed area.
The format and size of the CWA is installation dependent. The size is
specified in the SIT. The format is decided by the programs that
access this area.
The size and format of the TCTUA and TWA are also installation
dependent as in the case of the CWA.
24/08/2003
49/256
24/08/2003
50/256
ADVANCED BMS
back
A logical message is a single unit of output thats created from one or
more SEND TEXT or SEND MAP commands. When you use SEND TEXT or SEND MAP
to build a logical message BMS collects the output from one or more such
commands and treats it as a single logical unit.
BMS provides a set of message retrieval commands to fetch pieces of the
logical message. Logical message building or just message building is
also known as terminal paging and page building. They all mean the same
thing and use a message building program to create a logical message.
The logical message building program uses SEND TEXT or SEND MAP commands
with special options to build the message.
Once a message is built it is delivered to the terminal. Three factors
affect the building and delivery process:1. Message disposition
2. Terminal status
3. Message routing
Message disposition
Two dispositions are possible, terminal or paging, which you specify as
an option in the SEND TEXT or SEND MAP command.
When you specify Terminal disposition, the message is sent directly to
the terminal as it is created.
BMS
User Task
SEND MAP
or
SEND TEXT
Terminal page
processor
Page buffer
The three BMS components build one page at a time and deliver the
completed page immediately to the output device.
Terminal
24/08/2003
51/256
Paging Disposition
With this disposition the logical message is not sent directly to the
terminal. Instead the entire message is held in temporary storage until
the operator retrieves it. You use this disposition for a terminal as it
needs user interaction to fetch the pages.
Temporary storage
area for Logical
messages
BMS
User Task
SEND MAP
or
SEND TEXT
Terminal page
processor
Page buffer
Page 1
Page 2
Page n
24/08/2003
52/256
Terminal Status
Each terminal in the CICS system has a terminal status that affects the
way messages with the paging disposition are delivered to it. Two
options are possible, paging and autopage.
For terminals with a paging status BMS delivers pages one at a time as
the operator requests them.
Temporary storage
area for Logical
messages
Terminal
BMS
Page 1
Page retrieval
program
Page 2
Page requests
Page n
Paging status indicates that operators can request pages one at a time
by issuing retrieval commands. In contrast paging disposition means a
logical message is written to temporary storage for later delivery.
Paging status is meaningful only for output with paging disposition.
Autopage status
For a terminal with autopage status, usually a printer, the entire
message is delivered automatically as soon as the terminal is ready.
That way no message retrieval commands are necessary from the device.
Sometimes a program can route a message to a terminal(usually a printer)
other than the one to which it is attached. This is called message
routing.
Message Retrieval
Two commands are used getpage and msgterm.
The getpage Command
P/n
Retrieve page n
P/+n Retrieve the page
P/-n Retrieve the page
P/L
Retrieve the last
P/N
Retrieve the next
24/08/2003
53/256
Terminate the page retrieval session and purge the message being
displayed.
P/1
P/L
P/P
P/N
T/B
The PF keys assume the above meaning only when page retrieval session is
active. If you use a 3270 display device under BTAM or VTAM, you can use
PA or PF keys, as defined in the SKRxxxx system initialization
parameter, to enter page retrieval commands, and greatly reduce the
number of keystrokes necessary in a page retrieval session.
System Considerations for Page Retrieval
The page retrieval command allows you to retrieve a specified page.
CSPG getpage B
getpage
This is the user-defined identification code for the retrieval
transaction, and is 1-7 characters long.
This code is defined by the
PGRET system initialization parameter. For convenience, make the code
as short as possible; for example, P/.
B
Defines the next operation to be performed on the logical message at the
current level, or at the level specified by the a option It can be one
of the following:
n
page n
+n
page n pages forward
-n
page n pages backward
P
previous page
C
redisplay current page (after clearing the screen)
N
next page
L
last page
Examples
In the following examples, P/ is the page retrieval transaction
identifier:
P/7
P/N
CSPG msgterm B
msgterm
24/08/2003
54/256
Similarly the SIT parameter PGPURGE specifies the character string for
msgterm, usually set to T/.
A
Terminates all logical messages destined for and being displayed on that
terminal (including routed messages not yet displayed).
B
Terminates the logical message being displayed on that terminal and all
logical messages chained to it. This does not include routed messages.
Whenever you have finished with all the output from a transaction, you
should terminate the base message by entering a command of the form
msgtermB. If the message has been built using a SEND PAGE command with
the OPERPURGE option omitted, you can terminate the paging session by
entering data other than a paging command.
C
Terminates the current (level) logical message and any messages chained
below it.
The SEND TEXT command
EXEC CICS
SEND TEXT FROM(data-area)
[ LENGTH(data-area) ]
[ ACCUM ]
[ PAGING ]
[ ERASE ]
[ HEADER(data-area) ]
[ TRAILER(data-area) ]
[ REQID(name) ]
END-EXEC
Options
FROM
LENGTH
ACCUM
PAGING
ERASE
HEADER
TRAILER
REQID
24/08/2003
55/256
Conditions
IGREQID
INVREQ
LENGERR
TSIOERR
Notes
1. When you use send text data is broken into lines, the break taking
place between words, so words are not split across lines. You can
force a line break by introducing a new line character X15.
2. When you are building a message be sure to use the ACCUM and PAGING
options. The HEADER and TRAILER options let you specify data areas
that contain header and trailer information. This data is included in
the output if the text data overflows a page. The header and trailer
areas start with a 4 byte prefix. The first two bytes indicate the
length in binary form, excluding the 4 byte prefix. The third byte
indicates whether the page should be numbered. The fourth byte is
reserved by IBM.
3. The JUSTIFY, JUSFIRST and JUSLAST lets you alter the output datas
position. With JUSTIFY you specify the line number at which the data
is to be positioned. JUSFIRST and JUSLAST allows you to position data
at the top or bottom of the page after allowing for the header and
trailer areas. If you omit JUSTIFY, JUSFIRST and JUSLAST the data is
positioned at the next available line.
4. ACCUM means that output from one or more SEND TEXT commands is used
to build a logical message. PAGING indicates paging disposition which
means that the output is written to temporary storage. If you omit
PAGING it is written directly to the terminal buffer.
5. When you use the HEADER and TRAILER options BMS automatically inserts
the TRAILER before a page overflow and a HEADER at the start of a new
page. BMS counts the output lines written in between to determine
when it should insert the trailer. The header of course is written at
the start of a new page.
6. If you want page numbering, include a four byte prefix at the start
of both the header and trailer data blocks. The prefix is of the form
PIC S9(4) comp field which is set to the length of the header or
trailer area not counting the prefix.
[
[
[
[
24/08/2003
56/256
END-EXEC
Options
RELEASE
TRANSID
RETAIN
OPERPURGE
The OPERPURGE command option tells BMS that the message has
to be explicitly purged by the operator by entering T/B.
TRAILER
AUTOPAGE
Conditions
INVREQ
TSIOERR
that
is
to
be
Notes
If you omit both RETAIN and RELEASE the page retrieval command is
attached as a separate task.
The DFHMDI macro revisited
Name DFHMDI
SIZE=(lines,columns),
[ LINE = {line-number | NEXT}, ]
[ COLUMN = column-number ]
[ JUSTIFY = {FIRST | LAST }, ]
[ { HEADER=YES | TRAILER=YES } ]
Options
SIZE
LINE
24/08/2003
57/256
COLUMN
JUSTIFY
HEADER
TRAILER
Notes
When you attempt to send a detail map, if there is enough room only
for the trailer, BMS signals this via OVERFLOW. The program has to
detect this condition and send first the trailer map followed by the
header. If either map contains fields like Date, Page number or Page
total, the application has to set these fields with the right values
before issuing the SEND MAP.
Overflow does not occur when you send a header or trailer map, so
that you can send these without having to deal with another overflow
condition.
The SEND MAP command revisited
EXEC CICS
SEND
MAP(name)
[ MAPSET(name) ]
[ FROM(data-area) ]
[ MAPONLY | DATAONLY
[ ACCUM ]
[ PAGING ]
[ ERASE ]
END-EXEC
Options
MAP
MAPSET
FROM
MAPONLY
DATAONLY
ACCUM
PAGING
ERASE
24/08/2003
58/256
1. Use SEND TEXT which does not need a mapset, EXAMPLE PROLST1
2. Use SEND MAP which needs a mapset, EXAMPLE PROLST2
The product listing Program(send text version)
Program
PROLST1
Overview
Input /
Output
Specs
PRODUCT
Subprogram
SYSERR
Product file
Processing Specifications
1. For each record in the product file, list the product code,
description, unit price, and quantity on hand. At the end of the
listing, list the number of products in the file.
2. Create the listing using BMS message building facility and the SEND
TEXT command.
Product Listing
Product
Code
Description
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
Page: ***
Unit
Price
Quantity
On Hand
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
24/08/2003
Product Listing
Product
Code
Description
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
Page: ***
Unit
Price
Quantity
On Hand
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
59/256
24/08/2003
60/256
Test Data
Create PRODUCT file with Test Data
JCL(member PRODC)
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE userid.PRODUCT CLUSTER
DEFINE CLUSTER (NAME(userid.PRODUCT) INDEXED KEYS(10,0) RECORDSIZE(39,39) TRACKS(1,1)) DATA(CONTROLINTERVALSIZE(1024))
//
Use this program to generate test data with which you can check out your
BMS programs that implement paging.
SAMP18
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMP18.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VARS.
03 WS-RESP
PIC S9(08) COMP VALUE 0.
01 PRODUCT-MASTER-RECORD.
*
05 PRM-PRODUCT-CODE
PIC 9(10) VALUE 10.
05 PRM-PRODUCT-DESCRIPTION.
10 PROD-KEY
PIC 9(10).
10 DESCRIPTION
PIC X(10) VALUE "ABCDEFGH".
05 PRM-UNIT-PRICE
PIC S9(7)V99 COMP-3 VALUE 10.00.
05 PRM-QUANTITY-ON-HAND
PIC S9(7)
COMP-3 VALUE 10.
*
01 WS-COUNT
PIC 9(10) VALUE 1.
PROCEDURE DIVISION.
PERFORM MAIN-PARA VARYING WS-COUNT FROM 0 BY 1
UNTIL WS-COUNT EQUAL 100
PERFORM END-PARA.
MAIN-PARA.
MOVE WS-COUNT TO PROD-KEY
MOVE WS-COUNT TO PRM-PRODUCT-CODE
ADD 1 TO PRM-UNIT-PRICE
ADD 1 TO PRM-QUANTITY-ON-HAND
EXEC CICS
WRITE FILE('PRODUCT')
FROM(PRODUCT-MASTER-RECORD)
RIDFLD(PRM-PRODUCT-CODE)
RESP(WS-RESP)
END-EXEC.
END-PARA.
EXEC CICS
RETURN
END-EXEC.
24/08/2003
61/256
Structure chart for the product listing program (send text version)
0000
prepare
product
listing
1000
start
product
browse
2000
produce
product
line
3000
send
total
line
2200
send
product
line
2100
read
product
record
Copy books
01 PRODUCT-MASTER-RECORD.
05 PRM-PRODUCT-CODE
05 PRM-PRODUCT-DESCRIPTION
05 PRM-UNIT-PRICE
05 PRM-QUANTITY-ON-HAND
01
ERROR-PARAMETERS.
05 ERR-RESP
05 ERR-RESP2
05 ERR-TRNID
05 ERR-RSRCE
PIC
PIC
PIC
PIC
S9(8)
S9(8)
X(4).
X(8).
PIC
PIC
PIC
PIC
X(10).
X(20).
S9(7)V99
S9(7)
COMP-3.
COMP-3.
COMP.
COMP.
Notes
The source for the subprogram SYSERR is shown later in this material.
24/08/2003
62/256
PIC
PIC
PIC
PIC
X(10).
X(20).
S9(7)V99
S9(7)
COMP-3.
COMP-3.
24/08/2003
63/256
05 FILLER
PIC XX
VALUE SPACE.
05 PL-QUANTITY
PIC Z,ZZZ,ZZ9.
05 PL-NL
PIC X
VALUE X'15'.
01 TOTAL-LINE.
05 TL-NL
PIC X
VALUE X'15'.
05 TL-RECORD-COUNT PIC ZZ,ZZ9.
05 FILLER
PIC X(15) VALUE ' records in the'.
05 FILLER
PIC X(15) VALUE ' product file. '.
01 TRAILER-AREA.
05 TA-PREFIX.
10 TA-LENGTH
PIC S9(4) VALUE 26 COMP.
10 FILLER
PIC XX
VALUE SPACE.
05 TRAILER-LINE.
10 TA-NL
PIC X
VALUE X'15'.
10 FILLER
PIC X(20) VALUE 'Continued on next pa'.
10 FILLER
PIC X(5)
VALUE 'ge...'.
COPY PRODUCT.
COPY ERRPARM.
PROCEDURE DIVISION.
0000-PRODUCE-PRODUCT-LISTING.
PERFORM 1000-START-PRODUCT-BROWSE.
PERFORM 2000-PRODUCE-PRODUCT-LINE
UNTIL PRODUCT-EOF.
PERFORM 3000-SEND-TOTAL-LINE.
EXEC CICS
SEND PAGE
OPERPURGE
END-EXEC.
EXEC CICS
RETURN
END-EXEC.
1000-START-PRODUCT-BROWSE.
MOVE LOW-VALUE TO PRM-PRODUCT-CODE.
EXEC CICS
STARTBR DATASET('PRODUCT')
RIDFLD(PRM-PRODUCT-CODE)
GTEQ
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(NOTFND)
MOVE 'Y' TO PRODUCT-EOF-SW
ELSE IF RESPONSE-CODE NOT = DFHRESP(NORMAL)
GO TO 9999-TERMINATE-PROGRAM.
2000-PRODUCE-PRODUCT-LINE.
PERFORM 2100-READ-PRODUCT-RECORD.
IF NOT PRODUCT-EOF
PERFORM 2200-SEND-PRODUCT-LINE.
2100-READ-PRODUCT-RECORD.
EXEC CICS
READNEXT DATASET('PRODUCT')
RIDFLD(PRM-PRODUCT-CODE)
INTO(PRODUCT-MASTER-RECORD)
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(NORMAL)
ADD 1 TO RECORD-COUNT
ELSE IF RESPONSE-CODE = DFHRESP(ENDFILE)
24/08/2003
64/256
ELSE
GO TO 9999-TERMINATE-PROGRAM.
2200-SEND-PRODUCT-LINE.
MOVE PRM-PRODUCT-CODE
TO PL-PRODUCT-CODE.
MOVE PRM-PRODUCT-DESCRIPTION TO PL-DESCRIPTION.
MOVE PRM-UNIT-PRICE
TO PL-UNIT-PRICE.
MOVE PRM-QUANTITY-ON-HAND
TO PL-QUANTITY.
EXEC CICS
SEND TEXT FROM(PRODUCT-LINE)
ACCUM
PAGING
ERASE
HEADER(HEADER-AREA)
TRAILER(TRAILER-AREA)
END-EXEC.
3000-SEND-TOTAL-LINE.
MOVE RECORD-COUNT TO TL-RECORD-COUNT.
EXEC CICS
SEND TEXT FROM(TOTAL-LINE)
ACCUM
PAGING
ERASE
END-EXEC.
9999-TERMINATE-PROGRAM.
MOVE EIBRESP TO ERR-RESP.
MOVE EIBTRNID TO ERR-TRNID.
MOVE EIBRSRCE TO ERR-RSRCE.
EXEC CICS
XCTL PROGRAM('SYSERR')
COMMAREA(ERROR-PARAMETERS)
END-EXEC.
When you use SEND TEXT command the field you specify in the FROM option
can contain one or more lines of text. Line endings are indicated by the
new line character X15.
24/08/2003
65/256
Input /
Output
Specs
PRODUCT
LSTSET1
Product file
Mapset
Processing Specifications
1. For each record in the product file, list the product code,
description, unit price, and quantity on hand. At the end of the
listing, list the number of products in the file
2. Create the listing using BMS message building facility and the SEND
MAP command.
The LSTSET1 mapset
Study the following Mapset. It has four maps. One for the Header, one
for a detail line, one for the trailer and the last map for the total
line.
The LSTSET1 mapset
PRINT NOGEN
LSTSET1 DFHMSD TYPE=&SYSPARM,
X
LANG=COBOL,
X
MODE=INOUT,
X
TERM=3270-2,
X
CTRL=FREEKB,
X
STORAGE=AUTO,
X
TIOAPFX=YES
***********************************************************************
LSTMAP1 DFHMDI SIZE=(5,80),
X
JUSTIFY=FIRST,
X
HEADER=YES
***********************************************************************
DFHMDF POS=(1,16),
X
LENGTH=15,
X
ATTRB=(NORM,PROT),
X
INITIAL='Product Listing'
DFHMDF POS=(1,47),
X
LENGTH=5,
X
ATTRB=(NORM,PROT),
X
INITIAL='Page:'
PAGENO
DFHMDF POS=(1,53),
X
LENGTH=3,
X
ATTRB=(NORM,PROT),
X
PICOUT='ZZ9'
DFHMDF POS=(3,1),
X
LENGTH=7,
X
ATTRB=(NORM,PROT),
X
INITIAL='Product'
DFHMDF POS=(3,43),
X
LENGTH=17,
X
ATTRB=(NORM,PROT),
X
INITIAL='Unit
Quantity'
DFHMDF POS=(4,1),
X
24/08/2003
66/256
LENGTH=23,
X
ATTRB=(NORM,PROT),
X
INITIAL='Code
Description'
DFHMDF POS=(4,42),
X
LENGTH=18,
X
ATTRB=(NORM,PROT),
X
INITIAL='Price
On Hand'
***********************************************************************
***********************************************************************
LSTMAP2 DFHMDI SIZE=(1,80),
X
LINE=NEXT,
X
COLUMN=1
***********************************************************************
PCODE
DFHMDF POS=(1,1),
X
LENGTH=10,
X
ATTRB=(NORM,PROT)
DESCR
DFHMDF POS=(1,13),
X
LENGTH=20,
X
ATTRB=(NORM,PROT)
UPRICE
DFHMDF POS=(1,35),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
PICOUT='Z,ZZZ,ZZ9.99'
ONHAND
DFHMDF POS=(1,49),
X
LENGTH=9,
X
ATTRB=(NORM,PROT),
X
PICOUT='Z,ZZZ,ZZ9'
***********************************************************************
***********************************************************************
LSTMAP3 DFHMDI SIZE=(2,80),
X
JUSTIFY=LAST,
X
TRAILER=YES
DFHMDF POS=(2,1),
X
LENGTH=25,
X
ATTRB=(NORM,PROT),
X
INITIAL='Continued on next page...'
***********************************************************************
***********************************************************************
LSTMAP4 DFHMDI SIZE=(2,80),
X
LINE=NEXT,
X
COLUMN=1,
X
TRAILER=YES
COUNT
DFHMDF POS=(2,1),
X
LENGTH=6,
X
ATTRB=(NORM,PROT),
X
PICOUT='ZZ,ZZ9'
DFHMDF POS=(2,8),
X
LENGTH=28,
X
ATTRB=(NORM,PROT),
X
INITIAL='records in the product file.'
***********************************************************************
DFHMSD TYPE=FINAL
END
Notes
24/08/2003
67/256
1. The SIZE parameter tells BMS about the number of lines and columns in
the map. SIZE=(5,80) indicates that there are 5 rows and 80 columns
and that is the size of the header map.
2. You use the LINE, COLUMN and JUSTIFY to specify the starting position
of the map within the current page.
3. If you code LINE=NEXT the map is positioned in the next available
line in the current page. You usually code this for the detail line
map.
4. If you code JUSTIFY=FIRST the map is positioned at the beginning of
the next page. You usually code this for a header map. The effect of
JUSTIFY=FIRST is the similar as coding as LINE=1 and COLUMN=1. The
big difference is that when you code JUSTIFY=FIRST the existing
contents of the page buffer are written to Temporary Storage and the
map is written at the top of the new page buffer. LINE=1 and COLUMN=1
does not cause the page buffer to be written to the Temporary
Storage.
5. JUSTIFY=LAST causes the map to be positioned at the bottom of the
current page.
6. You use the HEADER and TRAILER parameters to indicate that the map is
a header or a trailer.
Product Listing
Product
Code
Description
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
Page: ***
Unit
Price
Quantity
On Hand
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
24/08/2003
Product Listing
Product
Code
Description
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
Page: ***
Unit
Price
Quantity
On Hand
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
Z,ZZZ,ZZ9
68/256
24/08/2003
69/256
PIC X(12).
PIC S9(4) COMP.
PIC X(01).
PIC X(01).
PIC X(003).
PIC X(12).
PIC X(03).
PIC ZZ9.
PIC X(12).
PIC S9(4) COMP.
PIC X(01).
PIC
PIC
PIC
PIC
X(01).
X(010).
S9(4) COMP.
X(01).
PIC
PIC
PIC
PIC
X(01).
X(020).
S9(4) COMP.
X(01).
PIC
PIC
PIC
PIC
X(01).
X(012).
S9(4) COMP.
X(01).
PIC X(01).
PIC X(009).
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X(12).
X(03).
X(010).
X(03).
X(020).
X(03).
Z,ZZZ,ZZ9.99.
X(03).
Z,ZZZ,ZZ9.
PIC X(12).
PIC X(12).
PIC X(12).
PIC S9(4) COMP.
PIC X(01).
PIC X(01).
PIC X(006).
PIC X(12).
01
01
01
01
01
01
01
01
05 FILLER
05 COUNTO
LSTMAP1I.
05 FILLER
05 PAGENOL
05 PAGENOF
05 FILLER REDEFINES PAGENOF.
10 PAGENOA
05 PAGENOI
LSTMAP1O REDEFINES LSTMAP1I.
05 FILLER
05 FILLER
05 PAGENOO
LSTMAP2I.
05 FILLER
05 PCODEL
05 PCODEF
05 FILLER REDEFINES PCODEF.
10 PCODEA
05 PCODEI
05 DESCRL
05 DESCRF
05 FILLER REDEFINES DESCRF.
10 DESCRA
05 DESCRI
05 UPRICEL
05 UPRICEF
05 FILLER REDEFINES UPRICEF.
10 UPRICEA
05 UPRICEI
05 ONHANDL
05 ONHANDF
05 FILLER REDEFINES ONHANDF.
10 ONHANDA
05 ONHANDI
LSTMAP2O REDEFINES LSTMAP2I.
05 FILLER
05 FILLER
05 PCODEO
05 FILLER
05 DESCRO
05 FILLER
05 UPRICEO
05 FILLER
05 ONHANDO
LSTMAP3I.
05 FILLER
LSTMAP3O REDEFINES LSTMAP3I.
05 FILLER
LSTMAP4I.
05 FILLER
05 COUNTL
05 COUNTF
05 FILLER REDEFINES COUNTF.
10 COUNTA
05 COUNTI
LSTMAP4O REDEFINES LSTMAP4I.
24/08/2003
70/256
PIC X(03).
PIC ZZ,ZZ9.
PIC X(12).
PIC S9(4) COMP.
PIC X(01).
PIC X(01).
PIC X(003).
PIC X(12).
PIC X(03).
PIC ZZ9.
PIC X(12).
PIC S9(4) COMP.
PIC X(01).
PIC
PIC
PIC
PIC
X(01).
X(010).
S9(4) COMP.
X(01).
PIC
PIC
PIC
PIC
X(01).
X(020).
S9(4) COMP.
X(01).
PIC
PIC
PIC
PIC
X(01).
X(012).
S9(4) COMP.
X(01).
PIC X(01).
PIC X(009).
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X(12).
X(03).
X(010).
X(03).
X(020).
X(03).
Z,ZZZ,ZZ9.99.
X(03).
Z,ZZZ,ZZ9.
PIC X(12).
PIC X(12).
PIC X(12).
PIC S9(4) COMP.
PIC X(01).
PIC X(01).
PIC X(006).
24/08/2003
FILLER
FILLER
COUNTO
71/256
PIC X(12).
PIC X(03).
PIC ZZ,ZZ9.
Start 1000
Product
Browse
Send 2230
Header
map
Produce 2000
Product
line
Read 2100
Product
record
Send
3000
Total
line
Send
2200
Product
line
Send 2210
Detail
map
Send 2220
Trailer
map
PIC
PIC
PIC
PIC
S9(8)
S9(8)
X(4).
X(8).
COMP.
COMP.
Send
2230
Header
map
COMP-3.
COMP-3.
24/08/2003
72/256
COMP-3.
COMP-3.
24/08/2003
END-EXEC.
IF RESPONSE-CODE = DFHRESP(NORMAL)
ADD 1 TO RECORD-COUNT
ELSE IF RESPONSE-CODE = DFHRESP(ENDFILE)
MOVE 'Y' TO PRODUCT-EOF-SW
ELSE
GO TO 9999-TERMINATE-PROGRAM.
2200-SEND-PRODUCT-LINE.
MOVE PRM-PRODUCT-CODE
TO PCODEO.
MOVE PRM-PRODUCT-DESCRIPTION TO DESCRO.
MOVE PRM-UNIT-PRICE
TO UPRICEO.
MOVE PRM-QUANTITY-ON-HAND
TO ONHANDO.
PERFORM 2210-SEND-DETAIL-MAP.
IF PAGE-OVERFLOW
PERFORM 2220-SEND-TRAILER-MAP
PERFORM 2230-SEND-HEADER-MAP
PERFORM 2210-SEND-DETAIL-MAP
MOVE 'N' TO PAGE-OVERFLOW-SW.
2210-SEND-DETAIL-MAP.
EXEC CICS
SEND MAP('LSTMAP2')
MAPSET('LSTSET1')
FROM(LSTMAP2O)
ACCUM
PAGING
ERASE
NOFLUSH
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(OVERFLOW)
MOVE 'Y' TO PAGE-OVERFLOW-SW
ELSE IF RESPONSE-CODE NOT = DFHRESP(NORMAL)
GO TO 9999-TERMINATE-PROGRAM.
2220-SEND-TRAILER-MAP.
EXEC CICS
SEND MAP('LSTMAP3')
MAPSET('LSTSET1')
MAPONLY
ACCUM
PAGING
ERASE
END-EXEC.
2230-SEND-HEADER-MAP.
MOVE PAGE-NO TO PAGENOO.
EXEC CICS
SEND MAP('LSTMAP1')
MAPSET('LSTSET1')
FROM(LSTMAP1O)
ACCUM
PAGING
ERASE
END-EXEC.
ADD 1 TO PAGE-NO.
3000-SEND-TOTAL-MAP.
MOVE RECORD-COUNT TO COUNTO.
EXEC CICS
SEND MAP('LSTMAP4')
73/256
END-EXEC.
9999-TERMINATE-PROGRAM.
MOVE EIBRESP TO ERR-RESP.
MOVE EIBTRNID TO ERR-TRNID.
MOVE EIBRSRCE TO ERR-RSRCE.
EXEC CICS
XCTL PROGRAM('SYSERR')
COMMAREA(ERROR-PARAMETERS)
END-EXEC.
24/08/2003
74/256
24/08/2003
75/256
back
24/08/2003
76/256
If the source data set is allocated with DISP=SHR, there is a risk that
it could be updated by a region other than the FOR. If this happened,
the data table would no longer match the source data set. To minimize
this risk, the VSAM cross-region SHAREOPTION should be set to 1 or 2.
1. 1 means that either one region can have update access to the data set
or many regions can have read-only access.
2. 2 means that one region can have update access to the data set and,
at the same time, many regions can have read-only access.
A file that uses a CICS-maintained data table can be defined as a
recoverable resource.
The source data set is recovered in the normal
way after a system or transaction failure:
After a system failure, the data table is reloaded from the recovered
source data set when the file is reopened.
After a transaction failure, changes that are made to the source data
set by dynamic transaction backout are also made to the data table.
CICS handles a CICS-maintained data table and its source data set as a
single entity. After the data table has been loaded, CICS automatically
keeps the contents of the data table and the source data set consistent;
any changes that an application makes to the file are reflected in both.
24/08/2003
77/256
All file control commands and options can be used and the use of a data
table is transparent to the application programmer. The following
information is provided to allow you to get the maximum benefits from
your data tables.
Some commands are performed by access only to the data table (using
cross-memory services for shared files), some by access only to the
source data set (using function shipping for shared files), and some by
access to both.
The following commands usually access only the data table:
STARTBR, RESETBR, READNEXT, and READPREV commands with the RBA option
ENDBR command for a browse sequence that has accessed the source data
set
The following commands might access both the data table and the source
data set:
READ and browse commands (which would usually access only the data
table) that find a gap in the sequence of records in the data table.
This gap might indicate that one or more records are missing from the
data table because:
-
READ, READNEXT, and READPREV commands for records that are currently
being processed by a WRITE, REWRITE, or DELETE command.
These
commands need to first access the data table to determine that this
situation exists.
24/08/2003
78/256
CICS handles a user-maintained data table and its source data set as
separate entities. When loading is complete, all file control commands
that access the filename are performed only on the data table.
There are some restrictions on which commands and options can be used.
There are also some exceptional conditions that are unique to usermaintained data tables. These restrictions and conditions are described
below.
The following commands are not supported; they
condition and a value of 44 in the EIBRESP2 field:
return
the
INVREQ
READ commands with the UPDATE option plus either the GENERIC or GTEQ
options
READ commands with neither the RBA option nor the UPDATE option. If
the record does not exist in the data table, the NOTFND condition is
returned.
ENDBR commands.
The following commands are supported (using function shipping for remote
requests):
24/08/2003
79/256
File
==> APPLE
Group
==> FRUIT
DEscription ==>
VSAM PARAMETERS
DSNAme
==> CIC01.CICOWN.APPLES
Password
==>
PASSWORD NOT SPECIFIED
RLSACCESS
==> NO
YES|NO
Lsrpoolid
==> 2
1-8 | None
READINTEG
==> UNCOMMITTED
UNCOMMITTED|CONSISTENT|REPEATABLE
DSNSharing
==> Allreqs
Allreqs | Modifyreqs
STRings
==> 005
1 - 255
Nsrgroup
==>
REMOTE ATTRIBUTES
REMOTESystem ==>
REMOTEName
==>
RECORDSize
==>
1 - 32767
Keylength
==>
1 - 255
INITIAL STATUS
STAtus
==> Enabled
Enabled | Disabled | Unenabled
Opentime
==> Startup
Firstref | Startup
BUFFERS
DATATABLE PARAMETERS
Table
==> CICS
No | Cics | User
Maxnumrecs
==> 1000000
16 - 16777215
DATA FORMAT
RECORDFormat ==> F
V | F
OPERATIONS
Add
==> Yes
No | Yes
BRowse
==> No
No | Yes
DELete
==> Yes
No | Yes
REAd
==> Yes
Yes | No
Update
==> Yes
No | Yes
AUTO JOURNALING
JOurnal
==> No
No | 1 - 99
JNLRead
==> None
None | Updateonly | Readonly | All
JNLSYNCRead ==> No
No | Yes
JNLUpdate
==> No
No | Yes
JNLAdd
==> None
None | Before | AFter |ALl
RECOVERY PARAMETERS
RECOVery
==> All
None | Backoutonly | All
Fwdrecovlog ==> 10
No | 1-99
BAckuptype
==> STAtic
STAtic | DYNamic
SECURITY
RESsecnum
: 00
0-24 | Public
+----------------------------------------------------------------------------------+
24/08/2003
80/256
File
==> COURGETT
Group
==> VEGS
DEscription ==>
VSAM PARAMETERS
DSNAme
==> CIC02.CICOWN.COURGETT
Password
==>
PASSWORD NOT SPECIFIED
RLSACCESS
==> NO
YES|NO
Lsrpoolid
==> 5
1-8 | None
READINTEG
==> UNCOMMITTED
UNCOMMITTED|CONSISTENT|REPEATABLE
DSNSharing
==> Allreqs
Allreqs | Modifyreqs
STRings
==> 005
1 - 255
Nsrgroup
==>
REMOTE ATTRIBUTES
REMOTESystem ==>
REMOTEName
==>
RECORDSize
==>
1 - 32767
Keylength
==>
1 - 255
INITIAL STATUS
STAtus
==> Enabled
Enabled | Disabled | Unenabled
Opentime
==> Firstref
Firstref | Startup
BUFFERS
DATATABLE PARAMETERS
Table
==> User
No | Cics | User
Maxnumrecs
==> 2000000
16 - 16777215
DATA FORMAT
RECORDFormat ==> V
V | F
OPERATIONS
Add
==> Yes
No | Yes
BRowse
==> Yes
No | Yes
DELete
==> No
No | Yes
REAd
==> Yes
Yes | No
Update
==> Yes
No | Yes
AUTO JOURNALING
JOurnal
==> No
No | 1 - 99
JNLRead
==> None
None | Updateonly | Readonly | All
JNLSYNCRead ==> No
No | Yes
JNLUpdate
==> No
No | Yes
JNLAdd
==> None
None | Before | AFter |ALl
RECOVERY PARAMETERS
RECOVery
==> Backoutonly
None | Backoutonly | All
Fwdrecovlog ==> No
No | 1-99
BAckuptype
==> STAtic
STAtic | DYNamic
SECURITY
RESsecnum
: 00
0-24 | Public
+----------------------------------------------------------------------------------+
24/08/2003
81/256
INTO
SET
LENGTH
RIDFLD
KEYLENGTH
GENERIC
SYSID
RBA
Full word PIC S9(8) COMP field which specifies the relative
byte address of the record for a KSDS or ESDS file.
RRN
Full word PIC S9(8) COMP field which specifies the relative
record number of the record for a RRDS file.
24/08/2003
82/256
GTEQ
EQUAL
UPDATE
Conditions
The RESP field can have the following values:DISABLED
DSIDERR
LENGERR
DUPKEY
ENDFILE
ILLOGIC
INVREQ
IOERR
An IOERR occurred
NOTAUTH
NOTFND
NOTOPEN
SYSIDERR
Notes
To read from an alternate index specify the PATH name instead of the
file name when you define the file using CEDA. Only the first of many
records with the same key can be read by the READ command. If you
want to read all records with the same key you must use READNEXT.
24/08/2003
83/256
FILE(name)
FROM
LENGTH
RIDFLD
KEYLENGTH
SYSID
RBA
Full word PIC S9(8) COMP field which specifies the relative
byte address of the record for a KSDS or ESDS file.
RRN
Full word PIC S9(8) COMP field which specifies the relative
record number of the record for a RRDS file.
MASSINSERT
Conditions
The RESP field can have the following values:DISABLED
DSIDERR
24/08/2003
84/256
LENGERR
DUPREC
ILLOGIC
INVREQ
The write operation is not enabled for this File when it was
defined using CEDA , or the key length specified is
incorrect, or a READ UPDATE has exclusive control of this
record.
IOERR
An IOERR occurred
NOTAUTH
NOTOPEN
SYSIDERR
file.
value
allow
files
Notes
When you write to an ESDS the record is always added to the end of
the file. The input via RIDFLD is ignored. On return though, it has
the RBAS of the record that has just been added.
The only exception condition that you normally can expect to handle
in your program is DUPREC.
FROM
LENGTH
24/08/2003
85/256
Conditions
The RESP field can have the following values:DISABLED
DSIDERR
DUPREC
ILLOGIC
INVREQ
IOERR
An IOERR occurred
NOTAUTH
NOTOPEN
SYSIDERR
Notes
To REWRITE a record you must first read it with UPDATE option. If the
file is recoverable, the lock on the CI is held until the task ends
or a syncpoint is taken. Else the lock is released when you issue a
REWRITE or UNLOCK command.
When you rewrite a record, you can change any field except the key
field, or change the length of the record.
24/08/2003
86/256
RIDFLD
KEYLENGTH
GENERIC
NUMREC
RBA
RRN
SYSID
Conditions
The RESP field can have the following values:DISABLED
DSIDERR
DUPKEY
ILLOGIC
INVREQ
The
was
not
the
IOERR
An IOERR occurred
NOTAUTH
NOTOPEN
NOTFND
SYSIDERR
Notes
24/08/2003
87/256
For recoverable files, the DELETE command causes your task to hold
the control interval that contains the record until you take a
syncpoint or your task ends.
You can get an exception of NOTFND if you do a DELETE with RIDFLD and
the specified record does not exist. You can also get a DUPKEY if
deleting via a path and duplicate alternate keys are permitted and
exist.
Browsing
Accessing files sequentially is called browsing. The commands that are
needed for browsing are:STARTBR
READNEXT
READPREV
RESETBR
ENDBR
You can browse a KSDS, RRDS or ESDS. Browsing a KSDS is on key sequence.
For an RRDS it is based on relative record numbers. For an ESDS it is
based on RBA.
The STARTBR command
EXEC CICS
STARTBR
DATASET(file-name)
RIDFLD(data-area)
[ RRN | RBA ]
[ GTEQ | EQUAL ]
[ GENERIC ]
[ KEYLENGTH(data-value)
[ REQID(data-value) ]
[ SYSID(name) ]
END-EXEC
Options
DATASET
RIDFLD
For a KSDS specifies the key of the record where the browse
Will start. For a RRDS it specifies the relative record
number and for an ESDS it specifies the RBA (PIC S9(8)
COMP).
RRN
RBA
24/08/2003
88/256
GTEQ
EQUAL
GENERIC
KEYLENGTH
REQID
SYSID
Conditions
The RESP field can have the following values:DISABLED
DSIDERR
ILLOGIC
INVREQ
IOERR
An IOERR occurred
NOTAUTH
NOTFND
NOTOPEN
SYSIDERR
Notes
You must issue a STARTBR command before you issue READNEXT or
READPREV.
To browse via a alternate index specify a path name for the data set
when you define the file.
24/08/2003
89/256
You can skip records when browsing simply by changing the RIDFLD
value when you browse using READNEXT or READPREV on the file. This is
called skip sequential processing. You can also do this by RESETBR
but with this command the string resource is released and reacquired.
There is therefore a possibility of the transaction going into string
wait.
CICS sets the data area corresponding to the RIDFLD field with the
key of the record fetched using READNEXT or READPREV.
In the case of a KSDS you can start at the beginning of the file by
moving low values to the RIDFLD when you issue STARTBR. If you have
defined a numeric key field, move zeroes to the key field, as the
compiler wont allow you to move low values to the key field. In the
case of an ESDS move 0 to the RIDFLD. In the case of a RRDS move 1 to
the RIDFLD.
To start the browse at the end of a file, for a KSDS move high values
(XFF) to the RIDFLD. High values is a special case, it does not
cause a NOTFND condition. Unfortunately moving all 9s to a numeric
key field will cause a NOTFND condition if the record is not found.
In this case redefine the field as a alphanumeric field and move high
values to it to start the browse at the end of the file. For an ESDS
or a RRDS move HIGH VALUES to the RIDFLD.
INTO
SET
LENGTH
24/08/2003
90/256
KEYLENGTH
RBA
RRN
REQID
SYSID
Conditions
The RESP field can have the following values:DISABLED
DSIDERR
LENGERR
DUPKEY
24/08/2003
91/256
ILLOGIC
INVREQ
IOERR
An IOERR occurred
NOTAUTH
NOTFND
NOTOPEN
SYSIDERR
Notes
You must issue STARTBR before issuing this command. Note that each
STARTBR holds a VSAM string.
For browsing via an alternate index specify the PATH name in the data
set option when you define the file using CEDA. Check for the DUPKEY
condition if the file permits duplicate alternate keys. The order of
records are not assured to be in prime key sequence.
DUPKEY (if accessing via a PATH) or ENDFILE are the only conditions
you should expect to handle in your program.
24/08/2003
92/256
SET
LENGTH
RIDFLD
KEYLENGTH
RBA
RRN
REQID
SYSID
Conditions
The RESP field can have the following values:DISABLED
DSIDERR
LENGERR
DUPKEY
ENDFILE
24/08/2003
93/256
ILLOGIC
INVREQ
IOERR
An IOERR occurred
NOTAUTH
NOTFND
NOTOPEN
SYSIDERR
Notes
You must issue STARTBR before issuing this command. Note that each
STARTBR holds a VSAM string.
For browsing via an alternate index specify the PATH name in the data
set option when you define the file using CEDA. Note that DUPKEY
conditions are possible when browsing via an alternate index.
DUPKEY (if accessing via a PATH) or ENDFILE are the only conditions
you should expect to handle in your program.
At STARTBR position at the end of the file (by moving high values
into the RIDFLD) before issuing this command if you want to read this
file backwards.
GENERIC
] ]
24/08/2003
94/256
RBA
GTEQ
EQUAL
GENERIC
KEYLENGTH
REQID
SYSID
Conditions
The RESP field can have the following values:DISABLED
DSIDERR
ILLOGIC
INVREQ
IOERR
An IOERR occurred
NOTAUTH
NOTFND
NOTOPEN
SYSIDERR
24/08/2003
95/256
Notes
You can issue RESETBR only after a STARTBR.
To browse via a alternate index specify a path name for the data set
when you define the file.
You can skip records when browsing simply by changing the RIDFLD
value when you browse using READNEXT or READPREV on the file. This is
called skip sequential processing. This is an alternative to using
RESETBR.
24/08/2003
96/256
File
==>
Group
==>
DEscription ==>
VSAM PARAMETERS
DSNAme
==>
Password
==>
PASSWORD NOT SPECIFIED
RLSACCESS
==> NO
YES|NO
Lsrpoolid
==> 1
1-8 | None
READINTEG
==> UNCOMMITTED
UNCOMMITTED|CONSISTENT|REPEATABLE
DSNSharing
==> Allreqs
Allreqs | Modifyreqs
STRings
==> 001
1 - 255
Nsrgroup
==>
REMOTE ATTRIBUTES
REMOTESystem ==>
REMOTEName
==>
RECORDSize
==>
1 - 32767
Keylength
==>
1 - 255
INITIAL STATUS
STAtus
==> Enabled
Enabled | Disabled | Unenabled
Opentime
==> Firstref
Firstref | Startup
BUFFERS
DATATABLE PARAMETERS
Table
==> No
No | Cics | User
Maxnumrecs
==>
16 - 16777215
DATA FORMAT
RECORDFormat ==> V
V | F
OPERATIONS
Add
==> No
No | Yes
BRowse
==> No
No | Yes
DELete
==> No
No | Yes
REAd
==> Yes
Yes | No
Update
==> No
No | Yes
AUTO JOURNALING
JOurnal
==> No
No | 1 - 99
JNLRead
==> None
None | Updateonly | Readonly | All
JNLSYNCRead ==> No
No | Yes
JNLUpdate
==> No
No | Yes
JNLAdd
==> None
None | Before | AFter |ALl
RECOVERY PARAMETERS
RECOVery
==> None
None | Backoutonly | All
Fwdrecovlog ==> No
No | 1-99
BAckuptype
==> STAtic
STAtic | DYNamic
SECURITY
RESsecnum
: 00
0-24 | Public
+----------------------------------------------------------------------------------+
24/08/2003
97/256
ADD(NO|YES)
specifies whether records can be added to the file.
BACKUPTYPE(STATIC|DYNAMIC)
CICS VSAM files can be defined as eligible for backup while open for
update.
BROWSE(NO|YES)
specifies whether records can be retrieved sequentially from the
file.
DATABUFFERS(2|value)
specifies the number of buffers to be used for data. Use a value in
the range 2 through 32767. The minimum value you may specify is one
more than the number of strings defined in the STRINGS attribute.
DELETE(NO|YES)
specifies whether records can be deleted from the file.
DESCRIPTION(text)
You can provide a description of the resource you are defining in
this field.
DISPOSITION(SHARE|OLD)
specifies the disposition of this file
1. OLD Equivalent to the DISP=OLD parameter in JCL.
2. SHARE Equivalent to the DISP=SHR parameter in JCL.
DSNAME(name)
specifies the data set name (as known to the operating system) to be
used for this file.
DSNSHARING(ALLREQS|MODIFYREQS)
specifies whether VSAM data set name sharing is used for the VSAM
file.
FILE(name)
specifies the name of
characters in length.
the
file.
The
name
can
be
up
to
eight
FWDRECOVLOG(NO |number)
specifies the journal name that corresponds to the MVS system logger
log stream that is to be used for forward recovery.
GROUP(groupname)
specifies the group name
INDEXBUFFERS(1|value)
24/08/2003
98/256
KEYLENGTH(value)
specifies the length in bytes, in the range 1 through 255, of the
logical key for remote files. If not defined here, the length option
must be specified in the application program that refers to this
file.
LSRPOOLID(1-8|None)
specifies the identity of the local shared resource pool. For a data
table, the default value for LSRPOOLID is 1, unless a value has been
specified for the NSRGROUP attribute, in which case the default value
for LSRPOOLID is NONE.
None Specifies that the data set associated with this file uses VSAM
non shared resources (NSR).
1-8 The value, in the range 1 through 8, identifies the number of
the VSAM shared resource pool that is used by the VSAM data set
associated with this file.
The data set is defined as using VSAM
local shared resources (LSR).
You are recommended to define the
buffers, strings, and other resources explicitly in an LSRPOOL
resource definition that corresponds to this LSRPOOLID.
By default, if the file definition specifies RLSACCESS(YES), the
LSRPOOLID is ignored when CICS opens the file.
MAXNUMRECS(value)
specifies the maximum number of entries to be accommodated in the
data table, in the range 16 through 16777215, if you have specified
'CICS' or 'USER' for the TABLE attribute.
NSRGROUP(value)
specifies a symbolic name (up to eight characters) to group together
file definitions that refer to the same VSAM base data set. The
value is purely symbolic and need not refer to any particular file
definition.
It is merely necessary that all file definitions that
need to be grouped together have the same name. You do not have to
specify this attribute to ensure correct processing, but if you do
not provide it, performance of your system may be degraded.
The NSRGROUP attribute takes effect only for files referencing data
sets that use VSAM non shared resources. The NSRGROUP parameter must
not be coded for a data table.
It is associated with the VSAM
concept of data set name sharing which causes VSAM to create a single
control block structure for the strings and buffers required by all
the files that relate to the same base data set.
When the first member of such a group of files is opened, the total
number of strings to be allocated for all file entries in the group
must be specified to VSAM. CICS adds together the STRINGS values in
all the file definitions with the same NSRGROUP attribute. This
allows CICS to assess the requirements at one time of all files that
are in the same NSRGROUP.
24/08/2003
99/256
Data set name sharing is forced by CICS as the default for all VSAM
files. Data set name sharing is not in effect if a file is opened
for read-only processing with DSNSHARING=MODIFYREQS.
If a file is using VSAM non shared resources, and you do not provide
an NSRGROUP attribute, the VSAM control block structure may be built
with insufficient strings for later processing. When this happens,
VSAM invokes the dynamic string addition feature to provide the extra
control blocks for the strings as they are required. This mechanism
is, however, inefficient and the extra storage is not released until
the end of the CICS run.
For files specifying that VSAM local shared resources are to be used
(LSRPOOLID=n, where n is in the range 1 to 8), NSRGROUP has no
effect.
Figure below shows an example of how to specify the required file
control definition for a VSAM base data set and alternate index path.
+------------------------------------------------------------------------+
DSNAME(DTGCAT.VSAM10B)
DISPOSITION(SHARE) ADD(YES)
UPDATE(NO) RECORDFORMAT(F)
STRINGS(8) LSRPOOLID(NONE)
RECOVERY(NONE) NSRGROUP(GROUP1)
INDEXBUFFERS(8) DATABUFFERS(9)
DSNAME(DTGCAT.VSAM10P)
LSRPOOLID(NONE) DISPOSITION(SHARE)
STRINGS(5) NSRGROUP(GROUP1)
RECOVERY(NONE) INDEXBUFFERS(5)
DATABUFFERS(6)
+------------------------------------------------------------------------+
OPENTIME(FIRSTREF|STARTUP)
specifies when the file is opened.
PASSWORD(name)
READ(YES|NO)
specifies whether records on this file can be read.
READINTEG( UNCOMMITTED|CONSISTENT|REPEATABLE)
specifies the level of read integrity required for files defined with
RLSACCESS(YES). Read integrity does not apply to non-RLS access mode
files or to any form of data tables.
24/08/2003
100/256
You can use READINTEG to set a default level of read integrity for a
file. The default level of read integrity is used by programs that
do not specify one of the API read integrity options UNCOMMITTED,
CONSISTENT, or REPEATABLE on the READ, READNEXT, or READPREV
commands. However, if an application program uses one of these
explicitly to specify read integrity, the API option overrides any
value specified on this READINTEG attribute.
You can specify CONSISTENT or REPEATABLE in a file resource
definition, to make read integrity available to programs written
before these options were available on the API, and without having to
modify those programs.
However, if you do this, be aware that
enforcing consistent or repeatable reads can introduce unexpected
deadlocks. Programs may also encounter the LOCKED condition.
CONSISTENT The record is read with consistent read integrity. If the
record is being modified by another transaction, the READ request
waits until the update is complete, the timing of which depends on
whether the data set is recoverable or non recoverable:
1. For a recoverable data set, the READ request completes when the
updating transaction completes its next syncpoint or rollback.
2. For a non recoverable data set, the READ completes as soon as the
VSAM request performing the update completes.
CONSISTENT is valid only if you also specify RLSACCESS(YES)--the
resource definition is rejected with an error if you specify
CONSISTENT for a non-RLS file.
REPEATABLE The record is read with repeatable read integrity. If the
record is being modified by another transaction, the READ request
waits until the update is complete, the timing of which depends on
whether the data set is recoverable or non recoverable:
1. For a recoverable data set, the READ request completes when the
updating transaction completes its next syncpoint or rollback.
2. For a non recoverable data set, the READ completes as soon as the
VSAM request performing the update completes.
After the read completes, a shared lock remains held until syncpoint.
This guarantees that any record read within a unit-of-work cannot be
modified while the task makes further read requests.
REPEATABLE is valid only if you also specify RLSACCESS(YES)--the
resource definition is rejected with an error if you specify
REPEATABLE for a non-RLS file.
UNCOMMITTED The record is read without read integrity. CICS obtains
the current value of the record as known to VSAM.
No attempt is
made to serialize this read request with any concurrent update
activity for the same record. The record returned may be a version
updated by another transaction, but not yet committed, and this
record may change if the update is subsequently backed out.
24/08/2003
101/256
RECORDFORMAT(V|F)
specifies the format of the records on the file.
F
RECORDSIZE(number)
specifies the maximum length in bytes, in the range 1 through 32767,
of the logical record. For a fixed-length remote file, this value is
the length of the records. Needed only for defining a remote file.
RECOVERY(NONE|BACKOUTONLY|ALL)
specifies the type of recovery required for the file.
This attribute is not used for files defined with RLSACCESS(YES), or
if the recovery options are defined in the ICF catalog and RLS=YES is
specified as a system initialization parameter. If RLS=YES, and LOG
is defined in the ICF catalog, CICS ignores the recovery setting and
takes the LOG value from the ICF catalog, even for files defined with
RLSACCESS(NO).
If LOG(ALL) is specified in the ICF catalog, CICS
also takes the LOGSTREAMID and BWO values from the ICF catalog.
For files that are accessed in RLS mode, you must specify the
recovery parameters with the data set definition in the ICF catalog.
ALL
Log before images to the system log, and after images to the
journal specified in the FWDRECOVLOG attribute.
RECOVERY=ALL together with FWDRECOVLOG provide a means of separating
the needs of a forward recovery utility from those of automatic
journaling.
Additional information, not available via automatic
journaling, is recorded on the FWDRECOVLOG. RECOVERY=ALL plus
FWDRECOVLOG is the recommended way to provide forward recovery
support.
For CICS-maintained data tables, the data table and its source data
set are logged, journaled, and recovered together.
For usermaintained tables, specifying ALL has the same effect as specifying
BACKOUTONLY: only dynamic backout is provided. There is no forward
recovery support for user-maintained tables.
BACKOUTONLY Log before images to the system log. For CICS-maintained
data tables, BACKOUTONLY specifies that the data table and its source
data set are recoverable.
They are both updated in step and, if
required, recovered in step. For user-maintained tables, this
specifies only dynamic backout. No log records are written and,
therefore, there is no recovery at emergency restart.
NONE No recovery logging for this file.
RLSACCESS(NO|YES)
specifies whether CICS is to open the file in RLS mode.
24/08/2003
102/256
NO
The file is not to be opened in RLS mode.
If you specify
RLSACCESS(NO) or allow it to default, CICS opens the file in LSR or
NSR access mode, depending on the LSRPOOLID attribute. If you also
specify
LSRPOOLID(NONE),
the
access
mode
is
NSR;
if
LSRPOOLID(number), the access mode is LSR.
YES
The file is to be opened in RLS mode.
If you specify
RLSACCESS(YES), it takes precedence over the LSRPOOLID attribute,
which is ignored when the FILE is opened.
Specifying RLSACCESS(YES) alters the effect of some other attributes
defined in the FILE definition (see manual).
REMOTENAME(name)
specifies the name by which this file is known in the system or
region in which it is resident.
REMOTESYSTEM(name)
If you are operating in an ISC or MRO environment, and the file is
held by a remote system, this specifies the name of the system or
region in which the file is resident.
STATUS({ ENABLED|DISABLED|UNENABLED})
specifies the initial status of the file
initialization with START=COLD or START=INITIAL.
following
CICS
STRINGS(1|value)
specifies the number, in the range 1 through 255, of concurrent
requests that can be processed against the file. When the number of
requests reaches this value, CICS queues any additional requests
until one of the active requests terminates.
This applies both to
files using shared resources, and to those not using shared
resources.
When coding STRINGS, be aware that a proportion (20%) of the
specified number of strings is reserved by CICS for use in read-only
requests.
For VSAM files using shared resources, this number is not used by
VSAM. It is used by CICS, not only as described above, but also to
calculate the default value in the buffer pool definition.
TABLE(NO|CICS|USER)
specifies the type of data table that you require.
CICS CICS-maintained data tables.
These automatically reflect all
modifications to their source data set.
If you specify CICS, you
must also specify LSRPOOLID with a value of 1 through 8, and
MAXNUMRECS with the value you require.
NO
24/08/2003
103/256
UPDATE(NO|YES)
specifies whether records on this file can be updated.
LSRPOOL
VSAM buffers play an important role in VSAM performance. CICS allows us
to define what are known as LSR or Local Shared Resource Pools for VSAM
buffers. The LSR pools are defined using CEDA and the resource name is
LSRPOOL. 1 to 8 LSRPOOLS can be defined. A sample CEDA screen is shown
below:+----------------------------------------------------------------------------------+
Lsrpool
==> ....
Group
==> ....
DEscription ==>
Lsrpoolid
==> 1
1 - 8
Maxkeylength ==>
0 - 255
SHarelimit
==>
1 - 100
STrings
==>
1 - 255
DATA BUFFERS
DATA512
==>
3 - 32767
DATA1K
==>
3 - 32767
DATA2K
==>
3 - 32767
DATA4k
==>
3 - 32767 increments of 4 up to 32
DATA32k
==>
3 - 32767
INDEX BUFFERS
INDEX512
==>
3 - 32767
INDEX1K
==>
3 - 32767
INDEX2K
==>
3 - 32767
INDEX4k
==>
3 - 32767 increments of 4 up to 32
INDEX32k
==>
3 - 32767
HSDATA4K
==>
0 - 16777215 increments of 4 up to 32
HSDATA32K
==>
0 - 16777215
HSINDEX4K
==>
0 - 16777215 increments of 4 up to 32
HSINDEX32K ==>
0 - 16777215
+----------------------------------------------------------------------------------+
installed
into
the
system
24/08/2003
it
may
not
104/256
take
effect
CICS sets default attributes if an LSRPOOL is not defined, but you are
advised to define the LSRPOOL anyway, for reasons of performance. In a
production system, for example, delay may be incurred while pool
requirements are being calculated by CICS. Another possible problem is
that if files in the FCT are not allocated at the time the pool is
built, the data set names will not be known to CICS. In this case, the
pool is built based on the information available, but the subsequent
performance of the system may suffer or files may fail to open.
See example below of SAMP10 and SAMP11 which illustrate a deadlock
caused by CI waits.
Define SAMP10 as transaction SM10 and SAMP11 as SM11. You need two KSDS
files defined as FILE61 and FILE62 with record size of 80 fixed and a
key in first 5 positions before you run SM10 transaction. SM10 starts
SM11 and creates a deadlock condition over the two files (FILE61 and
FILE62).
Defining the File61 data set
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE USER01.FILE61 CLUSTER
DEFINE CLUSTER (NAME(USER01.FILE61) INDEXED KEYS(5,0) RECORDSIZE(80,80) TRACKS(1,1)) DATA(CONTROLINTERVALSIZE(1024))
//
Defining the File61 data set
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE USER01.FILE62 CLUSTER
DEFINE CLUSTER (NAME(USER01.FILE62) INDEXED KEYS(5,0) RECORDSIZE(80,80) TRACKS(1,1)) DATA(CONTROLINTERVALSIZE(1024))
//
Loading the data sets
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO INDATASET(userid.FILE61.LOADDATA) OUTDATASET(userid.FILE61)
//
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO INDATASET(userid.FILE62.LOADDATA) OUTDATASET(userid.FILE62)
//
24/08/2003
105/256
transaction-id SM10
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMP10.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VARS.
03 WS-MSG-DATA
PIC X(30).
03 WS-MSG-DATA-LEN
PIC S9(4) COMP VALUE 30.
03 WS-RESP
PIC S9(08) COMP VALUE 0.
03 WS-QUEUE-RECORD-LEN
PIC S9(4) COMP VALUE 10.
03 WS-POST
PIC S9(8) COMP.
03 WS-POST-BIN REDEFINES WS-POST PIC X(4).
03 WS-CLEAR
PIC S9(8) COMP.
03 WS-CLEAR-BIN REDEFINES WS-CLEAR PIC X(4).
03 WS-SAMP8-PTR
USAGE IS POINTER.
03 WS-SAMP8-PTR-LEN
PIC S9(4) COMP VALUE 4.
01 WS-QUEUE-RECORD.
03 WS-QUEUE-DATA
PIC X(10) VALUE "SAMP10".
01 WS-DATA
PIC X(80).
01 WS-KEY-ONE
PIC X(5) VALUE '00001'.
01 WS-KEY-TWO
PIC X(5) VALUE '00001'.
LINKAGE SECTION.
01 WS-ECBS.
03 ECB-ONE
PIC S9(8) COMP.
03 ECB-ONE-PTR
POINTER.
03 ECB-ONE-PTR-PTR
POINTER.
PROCEDURE DIVISION.
PERFORM INIT-PARA.
PERFORM MAIN-PARA
PERFORM END-PARA.
MAIN-PARA.
MOVE "SAMP10 STARTING ...." TO WS-MSG-DATA
EXEC CICS
SEND TEXT FROM(WS-MSG-DATA)
LENGTH(WS-MSG-DATA-LEN)
RESP(WS-RESP)
END-EXEC
PERFORM LOOP-PARA
MOVE "SAMP10 ENDING..." TO WS-MSG-DATA
EXEC CICS
SEND TEXT FROM(WS-MSG-DATA)
LENGTH(WS-MSG-DATA-LEN)
RESP(WS-RESP)
END-EXEC.
24/08/2003
106/256
LOOP-PARA.
EXEC CICS WAITCICS
ECBLIST(ECB-ONE-PTR-PTR)
NUMEVENTS(1)
RESP(WS-RESP)
END-EXEC
MOVE WS-CLEAR TO ECB-ONE
EXEC CICS
WRITEQ TS QUEUE("SAMP10")
FROM(WS-QUEUE-RECORD)
LENGTH(WS-QUEUE-RECORD-LEN)
RESP(WS-RESP)
END-EXEC
EXEC CICS
READ FILE('FILE62') INTO(WS-DATA) RIDFLD(WS-KEY-TWO)
UPDATE
END-EXEC.
END-PARA.
EXEC CICS
RETURN
END-EXEC.
INIT-PARA.
MOVE X'40008000' TO WS-POST-BIN
MOVE X'00000000' TO WS-CLEAR-BIN
EXEC CICS
GETMAIN SET(ADDRESS OF WS-ECBS)
FLENGTH(LENGTH OF WS-ECBS)
USERDATAKEY
END-EXEC
MOVE WS-CLEAR TO ECB-ONE
SET ECB-ONE-PTR TO ADDRESS OF ECB-ONE
SET ECB-ONE-PTR-PTR TO ADDRESS OF ECB-ONE-PTR
EXEC CICS
DELETEQ TS QUEUE("SAMP10")
RESP(WS-RESP)
END-EXEC
EXEC CICS
READ FILE('FILE61') RIDFLD(WS-KEY-ONE) INTO(WS-DATA)
UPDATE
END-EXEC
SET WS-SAMP8-PTR TO ADDRESS OF WS-ECBS
EXEC CICS
START TRANSID("SM11")
INTERVAL(0)
FROM(WS-SAMP8-PTR)
LENGTH(WS-SAMP8-PTR-LEN)
END-EXEC.
SAMP11
transaction-id SM11
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMP11.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VARS.
03 WS-RESP
03 WS-QUEUE-RECORD-LEN
24/08/2003
107/256
WS-QUEUE-RECORD.
03 WS-QUEUE-DATA
PIC X(10) VALUE "SAMP11".
03 WS-COUNT
PIC 9(4) VALUE 0.
03 WS-POST
PIC S9(8) COMP.
03 WS-POST-BIN REDEFINES WS-POST PIC X(4).
03 WS-CLEAR
PIC S9(8) COMP.
03 WS-CLEAR-BIN REDEFINES WS-CLEAR PIC X(4).
01 WS-ECBS-LEN
PIC S9(4) COMP VALUE 4.
01 WS-SAMP5-WS-PTR
USAGE IS POINTER.
01 WS-SAMP5-WS-PTR-LEN
PIC S9(4) COMP VALUE 4.
01 NUMEVENTS
PIC S9(8) COMP VALUE 1.
01 WS-DATA
PIC X(80).
01 WS-KEY-ONE
PIC X(5) VALUE '00001'.
01 WS-KEY-TWO
PIC X(5) VALUE '00001'.
LINKAGE SECTION.
01 WS-ECBS.
03 ECB-ONE
PIC S9(8) COMP.
03 ECB-ONE-PTR
POINTER.
03 ECB-ONE-PTR-PTR
POINTER.
PROCEDURE DIVISION.
PERFORM INIT-PARA.
PERFORM MAIN-PARA
PERFORM END-PARA.
MAIN-PARA.
EXEC CICS
READ FILE('FILE62') RIDFLD(WS-KEY-TWO) INTO(WS-DATA)
UPDATE
END-EXEC
PERFORM LOOP-PARA.
LOOP-PARA.
EXEC CICS
WRITEQ TS QUEUE("SAMP10")
FROM(WS-QUEUE-RECORD)
LENGTH(WS-QUEUE-RECORD-LEN)
RESP(WS-RESP)
END-EXEC.
MOVE WS-POST TO ECB-ONE
EXEC CICS
READ FILE('FILE61') RIDFLD(WS-KEY-ONE) INTO(WS-DATA)
UPDATE
END-EXEC.
END-PARA.
EXEC CICS
RETURN
END-EXEC.
INIT-PARA.
MOVE X'40008000' TO WS-POST-BIN
MOVE X'00000000' TO WS-CLEAR-BIN
EXEC CICS
RETRIEVE INTO(WS-SAMP5-WS-PTR)
LENGTH(WS-SAMP5-WS-PTR-LEN)
END-EXEC
SET ADDRESS OF WS-ECBS TO WS-SAMP5-WS-PTR.
24/08/2003
108/256
24/08/2003
109/256
FILE(myfile)
RIDFLD(rid-area)
The next command causes shared control to be relinquished:
EXEC CICS ENDBR
FILE(myfile)
The next command initially causes shared control to be acquired.
The
record is read into "input-area", and then exclusive control is acquired
in place of shared control.
EXEC CICS READ
FILE(myfile)
INTO(input-area)
RIDFLD(rid-area)
UPDATE
The transaction now resumes. Exclusive control is relinquished following
the next REWRITE or UNLOCK command on file "myfile".
Resolving deadlocks
You can diagnose deadlocks between tasks wanting an exclusive lock on
the same resource (such as a record in a non-RLS file, a recoverable
transient data queue, or any resource represented by an EXEC CICS
ENQUEUE).
Enqueue deadlocks between tasks occur when each of two transactions
(say, A and B) needs an exclusive lock on a resource that the other
holds already.
Transaction A waits for transaction B to release the
resource. However, if transaction B cannot release the resource because
it, in turn, is enqueued on a resource held by transaction A, the two
transactions are deadlocked. Further transactions may then queue,
enqueued on the resources held by transactions A and B.
You can use CEMT online to identify
identify the resources they hold.
deadlocked
transactions,
and
The CEMT INQUIRE UOWENQ command displays information about the owners of
all enqueues held. More importantly, for deadlock diagnosis purposes,
it displays information about the tasks waiting for the enqueues. Note
that CEMT INQUIRE UOWENQ can be used only for files accessed in non-RLS
mode, because files accessed in RLS mode have their locks managed by
VSAM, not by CICS. Deadlock and timeout detection for files accessed in
RLS mode is also performed by VSAM.
An example of deadlock diagnosis using CEMT INQUIRE UOWENQ
Consider the following example. The user of task 32 complains that his
terminal is locked:
he cannot enter data and his terminal does not
respond to any prompt. If you enter CEMT INQUIRE TASK at a different
terminal at this time, a display similar to the following might appear:
+------------------------------------------------------------------------------+
INQUIRE TASK
24/08/2003
110/256
Hva(DFHZARQ1)
Hva(FCDSRECD)
Hva(FCDSRECD)
Hva(FCDSRECD)
Hva(FCDSRECD)
INQUIRE UOWENQ
STATUS: RESULTS
STATUS: RESULTS
24/08/2003
111/256
UOW identifier
Transaction identifier
Task identifier
Enqueue state (active, or retained)
Enqueue type
Relation (whether owner of the enqueue or waiter).
In order to see more information, press ENTER alongside the item that
interests you.
If you press ENTER alongside the first entry of the
output from CEMT INQUIRE UOWENQ TASK(32), a screen similar to the
following might be displayed:
+--------------------------------------------------------------------------+
RESULT
Uowenq
Uow(AA8E950545DAC004)
Transid(FUPD)
Taskid(0000032)
State(Active)
Type(Dataset)
Relation(Owner)
Resource(ACCT.CICS520.ACCTFILE)
Qualifier(SMITH)
Netuowid(..GBIBMIYA.IYA2T774.n......)
Enqfails(00000000)
RESULT
Uowenq
Uow(AA8E950545DAC004)
Transid(FUPD)
Taskid(0000032)
24/08/2003
State(Active)
Type(Dataset)
Relation(Waiter)
Resource(INDX.CICS520.ACIXFILE)
Qualifier(SMITH)
Netuowid(..GBIBMIYA.IYA2T774.n......)
Enqfails(00000000)
112/256
STATUS: RESULTS
STATUS: RESULTS
24/08/2003
113/256
RESULT
Uowenq
Uow(AA8E97FE9592F403)
Transid(FUP2)
Taskid(0000039)
State(Active)
Type(Dataset)
Relation(Waiter)
Resource(ACCT.CICS520.ACCTFILE)
Qualifier(SMITH)
Netuowid(..GBIBMIYA.IYA2T776.p.nk4..)
Enqfails(00000000)
STATUS: RESULTS
24/08/2003
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VARS.
03 WS-MSG-DATA
PIC X(30).
03 WS-MSG-DATA-LEN
PIC S9(4) COMP VALUE 30.
03 WS-RESP
PIC S9(08) COMP VALUE 0.
03 WS-QUEUE-RECORD-LEN
PIC S9(4) COMP VALUE 10.
03 WS-POST
PIC S9(8) COMP.
03 WS-POST-BIN REDEFINES WS-POST PIC X(4).
03 WS-CLEAR
PIC S9(8) COMP.
03 WS-CLEAR-BIN REDEFINES WS-CLEAR PIC X(4).
03 WS-SAMP8-PTR
USAGE IS POINTER.
03 WS-SAMP8-PTR-LEN
PIC S9(4) COMP VALUE 4.
01 WS-QUEUE-RECORD.
03 WS-QUEUE-DATA
PIC X(10) VALUE "SAMP8 ".
01 WS-RESOURCE-ONE
PIC X(8) VALUE 'ONE'.
01 WS-RESOURCE-TWO
PIC X(8) VALUE 'TWO'.
LINKAGE SECTION.
01 WS-ECBS.
03 ECB-ONE
PIC S9(8) COMP.
03 ECB-ONE-PTR
POINTER.
03 ECB-ONE-PTR-PTR
POINTER.
PROCEDURE DIVISION.
PERFORM INIT-PARA.
PERFORM MAIN-PARA
PERFORM END-PARA.
MAIN-PARA.
MOVE "SAMP8 STARTING ...." TO WS-MSG-DATA
EXEC CICS
SEND TEXT FROM(WS-MSG-DATA)
LENGTH(WS-MSG-DATA-LEN)
RESP(WS-RESP)
END-EXEC
PERFORM LOOP-PARA
MOVE "SAMP8 ENDING..." TO WS-MSG-DATA
EXEC CICS
SEND TEXT FROM(WS-MSG-DATA)
LENGTH(WS-MSG-DATA-LEN)
RESP(WS-RESP)
END-EXEC.
LOOP-PARA.
EXEC CICS WAITCICS
ECBLIST(ECB-ONE-PTR-PTR)
NUMEVENTS(1)
RESP(WS-RESP)
END-EXEC
MOVE WS-CLEAR TO ECB-ONE
EXEC CICS
WRITEQ TS QUEUE("SAMP8")
FROM(WS-QUEUE-RECORD)
LENGTH(WS-QUEUE-RECORD-LEN)
RESP(WS-RESP)
END-EXEC
EXEC CICS
ENQ RESOURCE(WS-RESOURCE-TWO) LENGTH(8)
END-EXEC.
END-PARA.
114/256
24/08/2003
EXEC CICS
RETURN
END-EXEC.
INIT-PARA.
MOVE X'40008000' TO WS-POST-BIN
MOVE X'00000000' TO WS-CLEAR-BIN
EXEC CICS
GETMAIN SET(ADDRESS OF WS-ECBS)
FLENGTH(LENGTH OF WS-ECBS)
USERDATAKEY
END-EXEC
MOVE WS-CLEAR TO ECB-ONE
SET ECB-ONE-PTR TO ADDRESS OF ECB-ONE
SET ECB-ONE-PTR-PTR TO ADDRESS OF ECB-ONE-PTR
EXEC CICS
DELETEQ TS QUEUE("SAMP8")
RESP(WS-RESP)
END-EXEC
EXEC CICS
ENQ RESOURCE(WS-RESOURCE-ONE) LENGTH(8)
END-EXEC
SET WS-SAMP8-PTR TO ADDRESS OF WS-ECBS
EXEC CICS
START TRANSID("SM09")
INTERVAL(0)
FROM(WS-SAMP8-PTR)
LENGTH(WS-SAMP8-PTR-LEN)
END-EXEC.
SAMP9
transaction-id SM09
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMP9.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VARS.
03 WS-RESP
PIC S9(08) COMP VALUE 0.
03 WS-QUEUE-RECORD-LEN
PIC S9(4) COMP VALUE 14.
01 WS-QUEUE-RECORD.
03 WS-QUEUE-DATA
PIC X(10) VALUE "SAMP9 ".
03 WS-COUNT
PIC 9(4) VALUE 0.
03 WS-POST
PIC S9(8) COMP.
03 WS-POST-BIN REDEFINES WS-POST PIC X(4).
03 WS-CLEAR
PIC S9(8) COMP.
03 WS-CLEAR-BIN REDEFINES WS-CLEAR PIC X(4).
01 WS-ECBS-LEN
PIC S9(4) COMP VALUE 4.
01 WS-SAMP5-WS-PTR
USAGE IS POINTER.
01 WS-SAMP5-WS-PTR-LEN
PIC S9(4) COMP VALUE 4.
01 WS-RESOURCE-ONE
PIC X(8) VALUE 'ONE'.
01 WS-RESOURCE-TWO
PIC X(8) VALUE 'TWO'.
01 NUMEVENTS
PIC S9(8) COMP VALUE 1.
LINKAGE SECTION.
01 WS-ECBS.
03 ECB-ONE
PIC S9(8) COMP.
03 ECB-ONE-PTR
POINTER.
03 ECB-ONE-PTR-PTR
POINTER.
PROCEDURE DIVISION.
115/256
24/08/2003
PERFORM INIT-PARA.
PERFORM MAIN-PARA
PERFORM END-PARA.
MAIN-PARA.
EXEC CICS
ENQ RESOURCE(WS-RESOURCE-TWO) LENGTH(8)
END-EXEC
PERFORM LOOP-PARA.
LOOP-PARA.
EXEC CICS
WRITEQ TS QUEUE("SAMP8")
FROM(WS-QUEUE-RECORD)
LENGTH(WS-QUEUE-RECORD-LEN)
RESP(WS-RESP)
END-EXEC.
MOVE WS-POST TO ECB-ONE
EXEC CICS
ENQ RESOURCE(WS-RESOURCE-ONE) LENGTH(8)
END-EXEC.
END-PARA.
EXEC CICS
RETURN
END-EXEC.
INIT-PARA.
MOVE X'40008000' TO WS-POST-BIN
MOVE X'00000000' TO WS-CLEAR-BIN
EXEC CICS
RETRIEVE INTO(WS-SAMP5-WS-PTR)
LENGTH(WS-SAMP5-WS-PTR-LEN)
END-EXEC
SET ADDRESS OF WS-ECBS TO WS-SAMP5-WS-PTR.
116/256
24/08/2003
117/256
More efficient use of virtual storage because buffers and strings are
shared.
The general recommendation is to use LSR for all VSAM data sets except
where you have one of the following situations:
1. A file is very active but there is no opportunity for lookaside
because, for instance, the file is very large.
2. High performance
buffers.
is
required
by
the
allocation
of
extra
index
24/08/2003
118/256
VSAM requires one or more strings for each concurrent file operation.
For non update requests (for example, a READ or BROWSE), an access using
a base needs one string, and an access using an AIX needs two strings
(one to hold position on the AIX and one to hold position on the base
data set).
If access to a file is read only with no browsing, there is no need to
have a large number of strings; just one may be sufficient. Note that,
while a read operation only holds the VSAM string for the duration of
the request, it may have to wait for the completion of an update
operation on the same CI.
CICS manages string usage for both files and LSR pools. For each file,
whether it uses LSR or NSR, CICS limits the number of concurrent VSAM
requests to the STRNO= specified in the FCT file entry. For each LSR
pool, CICS also prevents more requests being concurrently made to VSAM
than can be handled by the strings in the pool.
When deciding the number of strings for a particular file, consider the
maximum number of concurrent tasks. Because CICS command level does not
allow more than one request to be outstanding against a particular data
set from a particular task, there is no point in allowing strings for
more concurrent requests.
If you want to distribute your strings across tasks of different types,
the transaction classes may also be useful.
You can use transaction
class limits to control the transactions issuing the separate types of
VSAM request, and for limiting the number of task types that can use
VSAM strings, thereby leaving a subset of strings available for other
uses.
Size of control intervals
The size of the data set control intervals is not an operand specified
to CICS; it is defined through VSAM AMS. However, it can have a
significant performance effect on a CICS system that provides access to
the control interval.
In general, direct I/O runs slightly more quickly when data CIs are
small, whereas sequential I/O is quicker when data CIs are large.
However, with NSR files, it is possible to get a good compromise by
using small data CIs but also assigning extra buffers, which leads to
chained and overlapped sequential I/O.
However, all the extra data
buffers get assigned to the first string doing sequential I/O.
VSAM functions most efficiently when its control areas are the maximum
size, and it is generally best to have data CIs larger than index CIs.
Thus, typical CI sizes for data are 4KB to 12KB and, for index, 1KB to
2KB.
In general, you should specify the size of the data CI for a file, but
allow VSAM to select the appropriate index CI to match.
Number of buffers (NSR)
The next decision is the number of buffers to be provided for each file.
Enough buffers must be provided to support the concurrent accesses
specified in the STRNO operand for the file.
24/08/2003
119/256
Specify the number of data and index buffers for NSR using the
DATABUFFER and INDEXBUFFER operands of the file definition (or
explicitly by coding the BUFND and BUFNI operands in the file
definition). It is important to specify sufficient index buffers. If a
KSDS consists of just one control area (and, therefore, just one index
CI), the minimum index buffers equal to STRNO is sufficient. But when a
KSDS is larger than this, at least one extra index buffer needs to be
specified so that at least the top level index buffer is shared by all
strings. Further index buffers reduces index I/O to some extent.
BUFND should generally be the minimum at STRNO + 1, unless the aim is to
enable overlapped and chained I/O in sequential operations or it is
necessary to provide the extra buffers to speed up CA splits.
Number of buffers (LSR)
The set of buffers of one size in an LSR pool is called a "subpool."
The number of buffers for each subpool is controlled by the DATA and
INDEX operands of the LSRPOOL definition.
Take care to include buffers of the right size. If no buffers of the
required size are present, VSAM uses the next larger buffer size.
VSAM resource usage (LSRPOOL)
The default for all VSAM data sets is LSR.
If multiple pools are
supported CICS provides for the use of pools 1 through 8.
The LSRPOOL operand specifies whether a file is to use LSR or NSR and,
if LSR, which pool. The LSRPOOL operand can be used in CICS systems with
VSAM data sets.
All files with the same base data set, except read-only files with
DSNSHR=UPDATE specified in the FCT file entry, must use either the same
LSR pool or all use NSR.
VSAM buffer allocations for NSR (BUFNI and BUFND)
For files using non shared resources (NSR), the BUFNI and BUFND operands
define VSAM index buffers and data buffers respectively.
BUFNI and BUFND specify the number of index and data buffers for an NSR
file.
The number of buffers can have a significant effect
use of many buffers can permit multiple concurrent
are the corresponding number of VSAM strings) and
operations and CA splits. Providing extra buffers
records can reduce physical I/O operations.
on performance. The
operations (if there
efficient sequential
for high-level index
The BUFND and BUFNI operands should be used in CICS systems that use
VSAM NSR files in CICS file control.
The BUFNI and BUFND operands are defined in the file definition on the
CSD. They correspond exactly to VSAM ACB operands: BUFNI is the number
of index buffers, BUFND is the number of data buffers. For LSR files,
they are ignored.
BUFND and BUFNI map to DATABUFFERS and INDEXBUFFERS in RDO.
24/08/2003
120/256
24/08/2003
121/256
back
Introduction
Temporary Storage provides a scratchpad area for applications to store
data for short term use. One example of usage is passing data between
executions of a pseudo conversational program.
Temporary Storage, also called TS is divided into TS queues and records,
which are also known as items. It is incorrect to relate the term record
to a file based record. A TS record or item size can be different for
the record size of the underlying data set. The underlying data set over
which TS is implemented is pointed to by DFHTEMP dd name in the CICS
startup. This is a VSAM ESDS file, set up by the systems programmer. All
CICS instance wide TS queues use this one file and the application
programmer need not be bothered about setting this file up.
You do not need to define TS queues to CICS if you do not want them to
be recoverable, or under syncpoint control. Be aware though that if you
do need to define them, online CEDA does not support TS queue
definitions. You have to code assembler macros and assemble and Link
edit the definition into the CICS libraries. This is a system programmer
/ CICS administrators job.
System Considerations
The temporary storage table (TST) is a list of generic names (or
prefixes) used to identify sets of temporary storage queues.
Generic
names are formed from the leading characters of the appropriate queue
names, and can be up to seven characters long.
The generic names coded on a DFHTST TYPE=RECOVERY macro identify queues
for which CICS provides backout of changes in the event of transaction
failure or protection against system failure.
The generic name coded on a DFHTST TYPE=REMOTE macro identifies queues
for which CICS routes the temporary storage request to a remote CICS
region or TS server, unless the remote system name (SYSIDNT) is the same
as that of the local CICS.
If SYSIDNT is the same name as the local
CICS, the queues specified by the DATAID option are treated by CICS as
local queues.
The generic name coded on a DFHTST TYPE=LOCAL macro identifies queues as
local queues that reside in the CICS region in which the TST is
installed.
The generic name coded on a DFHTST TYPE=SECURITY macro identifies queues
for which resource security checking is required.
CICS searches the TST for the first prefix that satisfies the particular
search criteria.
For example, if CICS searches for temporary storage
queue ABCDEFGH, and the TST contains prefix A followed by prefix AB, A
is selected. To avoid this, define the less-generic entries to the TST
before any more-generic entries, so that the first to be found is the
least generic of all possible matches.
Note that when CICS is looking for DATAIDs to match against a TS queue
name, it searches only the types of entry in which it is interested for
that particular search. CICS searches:
24/08/2003
122/256
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
DFHTST TYPE=RECOVERY,
DATAID=R
The following macro specifies that queues with names
beginning with C,D,E, and X are local queues:
DFHTST TYPE=LOCAL,
DATAID=(C,D,E,X)
The following macro specifies that queues with names
beginning with AB,L,M,N are remote queues on system RSYS:
DFHTST TYPE=REMOTE,
DATAID=(AB,L,M,N),
SYSIDNT=RSYS,
Queue names on remote system
RMTNAME=LC
begin with letters LC
The following macro specifies that queues with names
beginning with SAQ require security checking.
Note that the full TS queue name is passed to the ESM.
*
*
*
DFHTST TYPE=SECURITY,
DATAID=SAQ
*
DFHTST TYPE=FINAL
END
24/08/2003
123/256
FROM
LENGTH
A binary half word PIC S9(4) COMP field that specifies the
length of the record to be written.
ITEM
A half word PIC S9(4) COMP field which specifies the item to
be rewritten when REWRITE is specified. If REWRITE is not
specified, CICS ignores this field on input and sets it with
the item number of the newly written item on return.
REWRITE
NUMITEMS
A binary half word field that CICS sets with the number of
items (including this one just written) in the queue. Not
valid if ITEM is coded.
SYSID
MAIN
AUXILIARY
NOSUSPEND
24/08/2003
124/256
The queue name is invalid, or the queue was created for CICS
internal use and cant be written into by a user program.
IOERR
An IOERR occurred.
ITEMERR
NOSPACE
QIDERR
SYSIDERR
The system
accessed.
ISCINVREQ
defined
by
SYSID
could
not
be
located
or
Notes
1. TS queues are automatically created when you write a record to a
queue that does not exist.
2. Main or auxiliary lets you choose between the queue being on main or
auxiliary storage.
3. If the data being passed between applications is
commarea. If more than say 4k use a queue instead.
small
use
the
4. If you want the queue name to be unique, use the terminal ID in the
EIBTRMID field as the queue name.
5. If you code NOSUSPEND, control is returned immediately to your
program if sufficient space does not exist for the record. You can
detect it by the NOSPACE condition.
The READQ TS command
EXEC CICS
READQ TS
QUEUE(name)
{ INTO(data-area) | SET(pointer-ref)
[ LENGTH(data-value) ]
[ NUMITEMS(data-value) ]
[ ITEM(data-area) | NEXT ]
[ SYSID(name) ]
END-EXEC
options
QUEUE
INTO
The data area into where the data from the queue is to be
written.
SET
Specifies the data area that will contain the address of the
retrieved record.
LENGTH
24/08/2003
125/256
ITEM
A half word PIC S9(4) COMP field which specifies the item to
be read from the queue.
NUMITEMS
A binary half word field that CICS sets with the number of
items in the queue.
SYSID
Exceptions
INVREQ
The queue was created for CICS internal use and cannot be
written into by a user program.
IOERR
An IOERR occurred.
ISCINVREQ
ITEMERR
LENGERR
QIDERR
SYSIDERR
The system
accessed.
defined
by
SYSID
could
not
be
located
or
Notes
The access to TS queues can be sequential or direct. For direct access
specify the item number. Note however that CICS maintains one and only
one position in the queue for all tasks that access the queue. If
multiple tasks access the queue sequentially, tasks may not get the next
record due to intervening access by another task. If tasks want to
reserve the queue for exclusive use they must use CICS ENQ and DEQ
specifying the same resource name.
Since temporary storage queues are created and deleted dynamically,
always check for the QIDERR. If you specify ITEM check for the ITEMERR
condition.
The DELETQ TS command
EXEC CICS
DELETQ TS QUEUE(name)
[ SYSID(name)
END-EXEC
QUEUE
SYSID
Exceptions
INVREQ
The queue was created for CICS internal use and cannot be
written into by a user program.
24/08/2003
126/256
ISCINVREQ
QIDERR
SYSIDERR
The system
accessed.
defined
by
SYSID
could
not
be
located
or
Notes
1. TS queues are automatically created when you write a record to a
queue that does not exist. Once created they have to be explicitly
deleted using the DELETQ command.
2. Queues can be created in virtual storage or via DFHTEMP in a vsam
ESDS file.
3. You can create a unique queue name by using the value in EIBTRMID
field of the EIB.
4. Another way to delete a queue is to issue CEBR and issue a purge
command. Since queues can be deleted so easily, checking of QIDERR is
a must.
A sample Program using TS queues
This is a variant of the CUSTOMER maintenance program presented earlier.
Since the program is pseudo conversational, special considerations need
to be given to the update program function. Between the time the record
to be updated is read and thrown on the terminal screen for user change,
some other transaction may change the record in the data set. Another
version of the maintenance program defended itself against this
possibility by maintaining a copy of the original record in the commarea
which is preserved
across pseudo conversational executions. The
contents of the original record in the commarea are always checked
against the contents after a READ with UPDATE option. The REWRITE is
done only if the just read copy and the commarea copy match.
This version achieves the same result by storing a copy of the original
record in a TS queue rather than in the commarea. This is a good idea if
the record size is large.
This program
APPLICATION.
and
artifacts
are
described
in
the
section
SAMPLE
24/08/2003
127/256
24/08/2003
128/256
back
24/08/2003
129/256
FROM
LENGTH
SYSID
Exception Conditions
DISABLED
The destination is disabled
24/08/2003
130/256
INVREQ
IOERR
ISCINVREQ
LENGERR
NOSPACE
NOTOPEN
QIDERR
SYSIDERR
the
maximum
record
length
Notes
There are two types of queues. One is intrapartition and implemented
on VSAM ESDS pointed to by DFHNTRA. The other is a QSAM and is an
extrapartition queue.
To have exclusive use of the queue use CICS ENQ and DEQ.
INTO
Specifies the data area to where the record from the queue
is to be written.
SET
Specifies the data area that will contain the address of the
retrieved record.
LENGTH
SYSID
24/08/2003
131/256
Exception Conditions
DISABLED
The destination is disabled
INVREQ
IOERR
ISCINVREQ
LENGERR
NOTOPEN
QBUSY
QZERO
QIDERR
SYSIDERR
Notes
There are two types of queues. One is intrapartition and implemented
on VSAM ESDS pointed to by DFHNTRA. The other is a QSAM and is an
extrapartition queue.
Records are always fetched from the queue in the order in which they
were written. Also the read is destructive, the record is deleted.
To have exclusive use of the queue use CICS ENQ and DEQ.
You can get a QBUSY condition only if you specified NOSUSPEND. If you
had not specified NOSUSPEND, your task blocks until the queue is no
longer busy and your request completes.
24/08/2003
132/256
Exceptions
DISABLED
INVREQ
ISCINVREQ
QIDERR
SYSIDERR
The system
accessed.
defined
by
SYSID
could
not
be
located
or
Notes
1. Although the reads to a TD queue are destructive, the space occupied
by the deleted records is not released until you issue a DELETEQ TD.
2. The DELETEQ TD just deletes any unread records and reclaims space
from deleted records. The destination itself is not deleted.
3. You can issue a DELETEQ TD only against an intrapartition TD queue.
The ENQ command
EXEC CICS
ENQ
RESOURCE(data-area)
[ LENGTH(data-value) ]
END-EXEC
RESOURCE
LENGTH
A half word PIC S9(4) COMP field that indicates the length
of the resource name in the data-area. If you omit this CICS
takes the address of the data-area as the resource that you
want to ENQ.
LENGTH
A half word PIC S9(4) COMP field that indicates the length
of the resource name in the data-area. If you omit this CICS
takes the address of the data-area as the resource that you
want to DEQ
A Sample Program
Program
PROLST5.
Overview
Input / Output
PRODUCT
Product File
24/08/2003
133/256
Process Specifications
1. Control is transferred to the program via XCTL from the menu program
INVMENU with no communication area. The user can also start the
program by entering transaction id LST1
2. For each record in the product file, list the product code,
description, unit price and quantity on hand. At the end of the
listing, list the number of products in the file.
3. Use a transient data destination to route the output data to a
printer. An installation developed utility (not included in this
material) will be responsible for reading data from the destination
and writing to the printer.
4. Use ASA control characters in the first position of the destination
record to control printer spacing. The control characters are
Blank
skip one line before printing
0
skip two lines before printing
skip three lines before printing
1 skip to the top of next page before printing
5. CICS ENQ and DEQ are used to reserve the queue to prevent other tasks
from making intervening writes while our listing program is running.
0000
Produce
Product
listing
1000
start
Product
browse
2000
Produce
Product
line
2100
read
Product
record
3000
Print
total
line
2200
Print
Product
line
2210
Print
heading
lines
2220
write
queue
record
2220
write
queue
record
2220
Write
Queue
record
24/08/2003
134/256
PIC
PIC
PIC
PIC
S9(8)
S9(8)
X(4).
X(8).
PIC
PIC
PIC
PIC
X(10).
X(20).
S9(7)V99
S9(7)
COMP-3.
COMP-3.
COMP.
COMP.
You must define and install INTra destination L86P before you run this
program (PROLST5).
The Program PROLST5
IDENTIFICATION DIVISION.
*
PROGRAM-ID. PROLST5.
*
ENVIRONMENT DIVISION.
*
DATA DIVISION.
*
WORKING-STORAGE SECTION.
*
01 SWITCHES.
*
05 PRODUCT-EOF-SW PIC
88 PRODUCT-EOF
*
01 WORK-FIELDS.
*
05 RECORD-COUNT
PIC
*
01 PRINT-FIELDS.
*
05 LINE-COUNT
PIC
05 LINES-ON-PAGE
PIC
05 PAGE-NO
PIC
05 PRINT-AREA
PIC
05 LINE-LENGTH
PIC
*
01 RESPONSE-CODE
PIC
*
VALUE 'N'.
VALUE 'Y'.
S9(5)
VALUE ZERO
S99
VALUE 99
S99
VALUE 50
S999
VALUE 1
X(133).
S9(4)
S9(8)
COMP.
COMP-3.
COMP-3.
COMP-3.
COMP-3.
COMP.
01
01
01
01
01
01
01
PIC
PIC
PIC
PIC
X
X(20)
X(20)
X(15)
VALUE
VALUE
VALUE
VALUE
'0'.
' PRODUCT
SPACE.
' UNIT
PIC
PIC
PIC
PIC
X
X(20)
X(20)
X(17)
VALUE
VALUE
VALUE
VALUE
' '.
'
CODE
'ION
' PRICE
PR'.
'.
HL2-CC
FILLER
FILLER
FILLER
'.
QTY'.
HL3-CC
FILLER
FILLER
FILLER
DESCRIPT'.
'.
ON HAND'.
PL-CC
PL-PRODUCT-CODE
FILLER
PL-DESCRIPTION
FILLER
PL-UNIT-PRICE
FILLER
PL-QUANTITY
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X
VALUE
X(10).
XX
VALUE
X(20).
XX
VALUE
Z,ZZZ,ZZZ.99.
XX
VALUE
Z,ZZZ,ZZ9.
' '.
PIC
PIC
PIC
PIC
X
VALUE '-'.
ZZ,ZZ9.
X(15)
VALUE ' RECORDS IN THE'.
X(15)
VALUE ' PRODUCT FILE. '.
SPACE.
SPACE.
SPACE.
TL-CC
TL-RECORD-COUNT
FILLER
FILLER
FILLER
FILLER
PIC X(15)
PIC X(11)
PRODUCT-MASTER-RECORD.
05
05
05
05
'1'.
'
'ODUCT LISTING
'
PAGE: '.
COMPLETION-MESSAGE.
05
05
VALUE
VALUE
VALUE
VALUE
TOTAL-LINE.
05
05
05
05
X
X(20)
X(20)
X(14)
ZZ9.
PRODUCT-LINE.
05
05
05
05
05
05
05
05
PIC
PIC
PIC
PIC
PIC
HEADING-LINE-3.
05
05
05
05
HL1-CC
FILLER
FILLER
FILLER
HL1-PAGE-NO
HEADING-LINE-2.
05
05
05
05
135/256
HEADING-LINE-1.
05
05
05
05
05
24/08/2003
PRM-PRODUCT-CODE
PRM-PRODUCT-DESCRIPTION
PRM-UNIT-PRICE
PRM-QUANTITY-ON-HAND
DESTINATION-ID
COPY ERRPARM.
PROCEDURE DIVISION.
PIC
PIC
PIC
PIC
X(10).
X(20).
S9(7)V99
S9(7)
PIC X(4)
COMP-3.
COMP-3.
VALUE 'L86P'.
24/08/2003
0000-PRODUCE-PRODUCT-LISTING.
PERFORM 1000-START-PRODUCT-BROWSE.
EXEC CICS
ENQ RESOURCE(DESTINATION-ID)
END-EXEC.
PERFORM 2000-PRODUCE-PRODUCT-LINE
UNTIL PRODUCT-EOF.
PERFORM 3000-PRINT-TOTAL-LINE.
EXEC CICS
DEQ RESOURCE(DESTINATION-ID)
END-EXEC.
EXEC CICS
SEND TEXT FROM(COMPLETION-MESSAGE)
ERASE
FREEKB
END-EXEC.
EXEC CICS
XCTL PROGRAM('INVMENU')
RESP(RESPONSE-CODE)
END-EXEC.
EXEC CICS
RETURN
END-EXEC.
1000-START-PRODUCT-BROWSE.
PERFORM 2100-READ-PRODUCT-RECORD.
IF NOT PRODUCT-EOF
PERFORM 2200-PRINT-PRODUCT-LINE.
2100-READ-PRODUCT-RECORD.
EXEC CICS
READNEXT DATASET('PRODUCT')
RIDFLD(PRM-PRODUCT-CODE)
INTO(PRODUCT-MASTER-RECORD)
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(ENDFILE)
MOVE 'Y' TO PRODUCT-EOF-SW
ELSE IF RESPONSE-CODE = DFHRESP(NORMAL)
136/256
24/08/2003
ADD 1 TO RECORD-COUNT
ELSE
GO TO 9999-TERMINATE-PROGRAM.
2200-PRINT-PRODUCT-LINE.
EXEC CICS
WRITEQ TD QUEUE(DESTINATION-ID)
FROM(PRINT-AREA)
LENGTH(LINE-LENGTH)
END-EXEC.
3000-PRINT-TOTAL-LINE.
MOVE
MOVE
MOVE
MOVE
EXEC
EIBRESP
EIBRESP2
EIBTRNID
EIBRSRCE
CICS
TO
TO
TO
TO
ERR-RESP.
ERR-RESP2.
ERR-TRNID.
ERR-RSRCE.
137/256
24/08/2003
138/256
XCTL PROGRAM('SYSERR')
COMMAREA(ERROR-PARAMETERS)
END-EXEC.
Notes
1. Note the CICS ENQ and DEQ to reserve and free the TD queue resource
2. You can write a simple spool output program that writes to SYSOUT
using the following CICS calls:The SPOOLOPEN command
EXEC CICS
SPOOLOPEN OUTPUT
TOKEN(data-area)
USERID(data-value)
NODE(data-value)
CLASS(data-value)
ASA
PRINT
RECORDLENGTH(data-value)
RESP(data-area)
END-EXEC
Options
ASA
CLASS
If
RECORDLENGTH
TOKEN
USERID
NODE
Conditions
ALLOCERR, ILLOGIC, INVREQ, LENGERR, NODEIDERR, NOSPOOL,NOSTG, NOTFND,
NOTOPEN, OPENERR, OUTDESCERR, SPOLBUSY, STRELERR. See CICS Application
Programming Reference for details.
24/08/2003
139/256
TOKEN
Conditions
ALLOCERR, INVREQ, NOSPOOL, NOSTG, NOTFND, NOTOPEN,
STRELERR
FROM
TOKEN
Conditions
ALLOCERR, INVREQ, LENGERR, NOSPOOL, NOSTG, NOTOPEN, SPOLBUSY, SPOLERR,
STRELERR
A Sample Program
SAMP7
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMP7.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 LINE1 PIC X(80) VALUE
"//SCB000JB JOB (SCB-SCB-SCB000-XXX-999),CLASS=C,".
01 LINE2 PIC X(80) VALUE
"//
MSGCLASS=X,MSGLEVEL=(1,1),NOTIFY=SCB000,".
01 LINE2A PIC X(80) VALUE
"//
USER=SCB000,PASSWORD=PAPA15A1".
24/08/2003
140/256
0.
24/08/2003
141/256
FLENGTH(OUTLEN)
TOKEN(TOKEN)
END-EXEC
EXEC CICS SPOOLWRITE
FROM(LINE4)
RESP(RESP) RESP2(RESP2)
FLENGTH(OUTLEN)
TOKEN(TOKEN)
END-EXEC
EXEC CICS SPOOLWRITE
FROM(LINE5)
RESP(RESP) RESP2(RESP2)
FLENGTH(OUTLEN)
TOKEN(TOKEN)
END-EXEC
EXEC CICS SPOOLWRITE
FROM(LINE6)
RESP(RESP) RESP2(RESP2)
FLENGTH(OUTLEN)
TOKEN(TOKEN)
END-EXEC
EXEC CICS SPOOLWRITE
FROM(LINE7)
RESP(RESP) RESP2(RESP2)
FLENGTH(OUTLEN)
TOKEN(TOKEN)
END-EXEC.
END-PARA.
EXEC CICS
RETURN
END-EXEC.
24/08/2003
"
REPRO INFILE(IN) OUTFILE(SYSP)".
01 LINE7 PIC X(80) VALUE
"/*".
01 LINE8 PIC X(80) VALUE
"//SYSP DD SYSOUT=*".
01 LINE9 PIC X(80) VALUE
"//IN DD *".
01 LINE10 PIC X(80) VALUE
"/*".
01 LINE11 PIC X(80) VALUE
"//".
01 RESP
PIC 9(8) COMP.
01 RESP2
PIC 9(8) COMP.
01 TOKEN
PIC X(8).
01 OUTLEN
PIC S9(8) COMP VALUE +80.
01 WS-COUNT
PIC S9(8) COMP.
01 WS-VARS.
03 WS-RESP
PIC S9(08) COMP VALUE 0.
03 WS-LINE-LENGTH
PIC S9(08).
03 WS-BUFF
PIC X(80)
VALUE " ".
03 WS-DESTINATION-ID
PIC X(4)
VALUE "L86P".
01 WS-FLAGS.
03 WS-FLAG
PIC S9(08) COMP VALUE 0.
LINKAGE SECTION.
PROCEDURE DIVISION.
PERFORM MAIN-PARA.
PERFORM END-PARA.
MAIN-PARA.
EXEC CICS SPOOLOPEN OUTPUT
NODE ('HCLDX390')
USERID ('INTRDR')
RESP(RESP) RESP2(RESP2)
TOKEN(TOKEN)
END-EXEC.
PERFORM LOOP-PARA
EXEC CICS SPOOLCLOSE
TOKEN(TOKEN)
RESP(RESP) RESP2(RESP2)
END-EXEC.
LOOP-PARA.
EXEC CICS SPOOLWRITE
FROM(LINE1)
RESP(RESP) RESP2(RESP2)
FLENGTH(OUTLEN)
TOKEN(TOKEN)
END-EXEC
EXEC CICS SPOOLWRITE
FROM(LINE2)
RESP(RESP) RESP2(RESP2)
FLENGTH(OUTLEN)
TOKEN(TOKEN)
END-EXEC
EXEC CICS SPOOLWRITE
FROM(LINE2A)
RESP(RESP) RESP2(RESP2)
FLENGTH(OUTLEN)
TOKEN(TOKEN)
142/256
24/08/2003
143/256
24/08/2003
144/256
24/08/2003
145/256
Interval Control
back
CICS Interval control provides a variety of time related functions. They
are ASKTIME, FORMATTIME, START, RETRIEVE, DELAY, POST and CANCEL
commands.
The EIBTIME and EIBDATE fields in the EIB block provide the date and
time the task was dispatched. These fields are not updated when the task
executes and this may not be acceptable for long running tasks. For this
reason the ASKTIME and FORMATTIME commands are provided to get the
time / date which is current at the time of the call. The EIB fields
today have the following format:EIBDATE
contains the date the task is started; this field is updated by the
ASKTIME command. The date is in packed decimal form (0CYYDDD+) where C
shows the century with values 0 for the 1900s and 1 for the 2000s.
For example, the dates 31 December 1999 and 1 January 2000 have EIBDATE
values of 0099365 and 0100001 respectively. The field is represented in
COBOL as PIC S9(7) COMP-3 or in PL/I as FIXED DEC(7,0).
EIBTIME
contains the time at which the task is started (this field is updated by
the ASKTIME command). The time is in packed decimal form (0HHMMSS+).
The fields are represented in COBOL as PIC S9(7) COMP-3 and in PL/I as
FIXED DEC(7,0).
The ASKTIME command places the absolute elapsed time from 0000hours on
January 1st 1900 in milliseconds in your specified data area which must
be a PIC S9(15) COMP-3 field. In PL/I it must be a DECIMAL FIXED(15)
field.
The ASKTIME command
EXEC CICS
ASKTIME [ABSTIME(data-area)
END-EXEC
Note that the receiving data area is optional because the call updates
the EIBDATE and EIBTIME fields as well.
In most cases, you dont need to specify a receiving field if the format
of the EIBTIME and EIBDATE is acceptable. If you need a different
format, you can specify a receiving area and then call FORMATTIME using
the data area as an argument.
The FORMATTIME command
EXEC CICS
FORMATTIME ABSTIME(data-area)
[ DDMMYY(data-area)]
[ DDMMYYYY(data-area)]
[ MMDDYY(data-area)]
[ MMDDYYYY(data-area)]
[YYDDD(data-area)]
[YYDDMM(data-area)]
[YYMMDD(data-area)]
[YYYYDDD(data-area)]
[YYYYDDMM(data-area)]
24/08/2003
146/256
[YYYYMMDD(data-area)]
[ DATE(data-area) [ DATEFORM(data-area)]]
[ FULLDATE(data-area)]
[ DATESEP [(data-value)]]
[ DAYCOUNT(data-area)]
[ DAYOFWEEK(data-area) ]
[ DAYOFMONTH(data-area) ]
[ MONTHOFYEAR(data-area) ]
[ YEAR(data-area) ]
[ TIME(data-area) [ TIMESEP [(data-value)]]]
END-EXEC
Options
ABSTIME
YY..DD..MM
DAYCOUNT,DAYOFWEEK,DAYOFMONTH,MONTHOFYEAR,YEAR,TIME
fields of type PIC S9(8) COMP.
TIMESEP
are
set
into
fullword
Condition: INVREQ
Example
The following example shows the effect of some of the options of the
command. Let "utime" contain the value 002837962864828 in milliseconds.
EXEC CICS ASKTIME ABSTIME(utime)
EXEC CICS FORMATTIME ABSTIME(utime)
DATESEP('-') DDMMYY(date)
TIME(time) TIMESEP
This gives the values 06-12-89 for "date" and 19:01:05 for "time".
Automatic time-ordered transaction initiation
This facility allows you to start a new task using a START command. You
can pass data to the started task, that can be retrieved by the started
task using the RETRIEVE command. You can also request a CANCEL command
for the started task before it starts. This is because the START command
also accepts arguments which let you specify when or after what time
interval the new task is to be started. The START command runs the
started task asynchronously. In other words the task issuing the START
command and the started task can run concurrently. In contrast the LINK
is a synchronous call as the caller blocks until the linked to program
exits. Also the linked to program and the program issuing the LINK run
as one task.
24/08/2003
147/256
INTERVAL
TIME
AFTER
HOURS,
MINUTES,
Each is a PIC S9(8) COMP full word. Hours can be from 0-99
minutes can be from 0 to 59 or 0 to 5999
24/08/2003
148/256
SECONDS.
TERMID
SYSID
REQID
FROM
LENGTH
RTRANSID
QUEUE
NOCHECK
Specifies that the task issuing the START command should not
wait until the remote system has confirmed that the START
was successfully processed.
PROTECT
Specifies that the task should not be started until the task
issuing the START takes a syncpoint.
Conditions
INVREQ
IOERR
ISCINVREQ
LENGERR
SYSIDERR
TERMIDERR
24/08/2003
149/256
Notes
1. The START command is useful to divide an application functions into
two separate independent tasks, which can run concurrently. It can
also be used to start transactions at a predetermined time or after a
time interval.
2. If more than one START command is issued for the same target
transaction, the first started task can retrieve all the passed data
by issuing RETRIEVE calls more than once. If it does this CICS does
not start a new started task for each start request.
3. If you specify only one of HOURS | MINUTES | SECONDS, you are not
bound by the limit of 60 for seconds and minutes or 24 for hours. You
can use the higher limits.
The CANCEL command
EXEC CICS
CANCEL
[ REQID(name)]
[ TRANSID(name) ]
[ SYSID(name) ]
END-EXEC
Options
TRANSID
SYSID
REQID
Conditions
INVREQ
ISCINVREQ
NOTFND
SYSIDERR
Notes
1. The key element used by CICS to identify the command
cancelled is the REQID. You can get this by fetching it
EIBREQID field of the EIB after a START, DELAY or POST
Alternately you can specify your own application generated
the REQID field of the START, DELAY or POST command.
you want
from the
command.
REQID in
24/08/2003
150/256
2. The CANCEL command wont work if the expiration interval of the ICE
has already expired. If you do so you will get a NOTFND condition.
The DELAY command
This command lets you suspend the issuing task until the time interval
has expired, or a specific time of day has arrived.
EXEC
CICS DELAY
{
INTERVAL(hhmmss)
TIME(hhmmss)
FOR
[HOURS(hh)] [MINUTES(mm)] [SECONDS(ss)]
UNTIL [HOURS(hh)] [MINUTES(mm)] [SECONDS(ss)]
}
[ REQID(name) ]
END-EXEC
Options
INTERVAL
Specifies the duration for the delay. You can code a literal
in the form hhmmss. If you specify a data area it must be a
PIC S9(7) COMP-3 field and the value must be in the form
0hhmmss.
TIME
Specifies a time of the day when the delay will end. You can
code a literal in the form hhmmss. If you specify a data
area it must be a PIC S9(7) COMP-3 field and the value must
be in the form 0hhmmss.
FOR
UNTIL
HOURS,
MINUTES,
SECONDS.
Each is a PIC S9(8) COMP full word. Hours can be from 0-99
minutes can be from 0 to 59 or 0 to 5999
Seconds can be from 0 to 59 or 0 to 359999
If INTERVAL, TIME, FOR and UNTIL are omitted, INTERVAL(0) is
assumed.
REQID
Conditions
EXPIRED
INVREQ
Notes
1. One good use of the DELAY command is to retry operations that have
failed due to transient conditions. Such operations are worth a retry
after a suitable delay. This delay, or momentary suspension of task
execution can be achieved by the DELAY command.
24/08/2003
151/256
Specifies the data area that will contain the data sent via
the FROM option of the START command.
LENGTH
RTRANSID
RTERMID
QUEUE
WAIT
Suspend this task until another ICE expires and the data
associated with that START command is available.
Conditions
ENDDATA
ENVDEFERR
INVREQ
IOERR
LENGERR
NOTFND
Notes
1. You can code a iterative server process which issues RETRIEVE
repeatedly until ENDDATA is raised. This prevents more similar tasks
from being started. You can use the WAIT option to good effect if you
are expecting more data in the short term.
24/08/2003
152/256
2. The RTRANSID, RTERMID and QUEUE are provided to pass specific types
of data to the started task. See asynchronous client server scenarios
described earlier in this material.
3. You should always check for the ENDDATA condition.
The POST command
The POST command creates a Timer event control area that expires when a
specified time interval has expired. You can then use a WAIT EVENT
command to block the task until the posted event expires.
EXEC
CICS POST
{
INTERVAL(hhmmss)
TIME(hhmmss)
AFTER [HOURS(hh)] [MINUTES(mm)] [SECONDS(ss)]
AT
[HOURS(hh)] [MINUTES(mm)] [SECONDS(ss)]
}
SET(pointer-ref)
[ REQID(name) ]
END-EXEC
Options
INTERVAL
TIME
Specifies a time of the day when the event expires. You can
code a literal in the form hhmmss. If you specify a data
area it must be a PIC S9(7) COMP-3 field and the value must
be in the form 0hhmmss.
AFTER
AT
HOURS,
MINUTES,
SECONDS.
Each is a PIC S9(8) COMP full word. Hours can be from 0-99
minutes can be from 0 to 59 or 0 to 5999
Seconds can be from 0 to 59 or 0 to 359999
If INTERVAL, TIME, FOR and UNTIL are omitted, INTERVAL(0) is
assumed.
REQID
SET
Specifies a Full Word binary field PIC S9(8) COMP where CICS
places the address of the Timer Event Control area.
Conditions
EXPIRED
24/08/2003
153/256
Notes
1. One useful implementation of this command is to force a minimum
response time on the transaction. Do this by issuing a POST at the
start of the program and then issuing a WAIT EVENT just before
sending the final data.
The WAIT EVENT command
EXEC CICS
WAIT EVENT ECADDR(pointer-ref)
END-EXEC
Options
ECADDR
Conditions
INVREQ
24/08/2003
COMP VALUE 30.
COMP VALUE 0.
154/256
tranid SM03
24/08/2003
END-PARA.
EXEC CICS
RETURN
END-EXEC.
Example of POST
tranid SM04
COMP
COMP
COMP
COMP
VALUE 30.
VALUE 0.
VALUE 4.
VALUE 0.
155/256
24/08/2003
Task Control
156/256
back
You can:
Wait for events that post MVS format ECBs when they complete.
Two commands are available, WAITCICS and WAIT EXTERNAL.
These
commands cause the issuing task to be suspended until one of the
ECBs has been posted; that is, until one of the events has occurred.
The task can wait on one or more ECBs. If it waits on more than one,
it is dispatchable as soon as one of the ECBs is posted.
You must
ensure that each ECB is cleared (set to binary zeros) no later than
the earliest time it could be posted. CICS cannot do this for you.
If you wait on an ECB that has been previously posted and is not
subsequently cleared, your task is not suspended and continues to run
as though the WAITCICS or WAIT EXTERNAL command had not been issued.
WAIT EXTERNAL usually has less overhead, but the associated ECBs must
always be posted using the MVS POST facility.
They must never be
24/08/2003
157/256
posted by any other method. If you are in any doubt about the method
of posting, use the WAITCICS command. When dealing with ECBs passed
on a WAIT EXTERNAL command, CICS extends the ECBs and uses the MVS
POST exit facility. A given ECB must not be waited on by more than
one task at once (or appear twice in one task's ECBLIST). Failure to
follow this rule leads to an INVREQ response.
WAITCICS must be used if ECBs are to be posted by any method other
than the MVS POST facility. For example, if your application posts
the ECB by moving a value into it, WAITCICS must be used.
(The
WAITCICS command can also be used for ECBs that are posted using the
MVS POST facility or optimized post.) Whenever CICS goes into an MVS
WAIT, it passes a list to MVS of all the ECBs being waited on by
tasks that have issued a WAITCICS command.
The ECBLIST passed by
CICS on the MVS WAIT contains duplicate addresses, and MVS abends
CICS.
If you use MVS POST, WAIT EXTERNAL, WAITCICS, ENQ, or DEQ commands,
you could create inter-transaction affinities that adversely affect
your ability to perform dynamic transaction routing.
Storage for the timer-event control area on WAIT EVENT and storage
for event control blocks (ECBs) specified on WAIT EXTERNAL and
WAITCICS commands must reside in shared storage if you have specified
ISOLATE(YES).
If CICS is executing with or without transaction isolation, CICS
checks that the timer-event control area and the ECBs are not in
read-only storage.
Controlling sequence of access to resources
If you want a resource to be accessed by two or more tasks in a specific
order, instead of the ENQ and DEQ commands, use one or more WAITCICS
commands in conjunction with one or more hand-posted ECBs.
To hand-post an ECB, a CICS task sets a 4-byte field to either the
cleared state of binary zeros(clear), or the posted state of
X'40008000'(post).
The task can use a START command to start another
task and pass the address of the ECB. The started task receives the
address through a RETRIEVE command.
Either task can set the ECB or wait on it. Use the ECB to control the
sequence in which the tasks access resources. Two tasks can share more
than one ECB if necessary. You can extend this technique to control as
many tasks as you wish. Only one task can wait on a given ECB at any one
time.
The example in Figure below shows how two tasks can sequentially access
a temporary storage queue by using hand-posted ECBs and the WAITCICS
command.
24/08/2003
158/256
PTR_ECB1_ADDR_LIST
+-------------------+
A(ECB1_ADDR_LIST)
+-------------------+
ECB1_ADDR_LIST
ECB1
+-------------------+
+------------+
+-----_
+--------_
A(ECB1)
+-------------------+
+------------+
PTR_ECB2_ADDR_LIST
+-------------------+
A(ECB2_ADDR_LIST)
+-------------------+
ECB2_ADDR_LIST
ECB2
+-------------------+
+------------+
+-----_
+--------_
A(ECB2)
+-------------------+
+------------+
Two tasks sequentially accessing a temporary storage queue
The example uses two ECBs, (ECB1 and ECB2), addressed by the pointers
illustrated in Table below.
In theory, these tasks could exchange data through the temporary storage
queue for ever. In practice, some code would be included to close the
process down in an orderly way.
24/08/2003
159/256
+------------------------------------------------------------------------+
Table
Example of task control
+------------------------------------------------------------------------
Task A
Task B
+------------------------------------+-----------------------------------
Delete temporary storage queue
+------------------------------------+-----------------------------------
Clear ECB1 (set to X'00000000')
+------------------------------------+-----------------------------------
Clear ECB2
+------------------------------------+-----------------------------------
EXEC CICS START TASK B and pass
EXEC CICS RETRIEVE the addresses
the addresses of
passed.
PTR_ECB1_ADDR_LIST and
PTR_ECB2_ADDR_LIST.
+------------------------------------+-----------------------------------
+------------------------------------+-----------------------------------
START OF LOOP:
START OF LOOP:
+------------------------------------+-----------------------------------
+------------------------------------+-----------------------------------
ECBLIST(PTR_ECB1_ADDR_LIST
NUMEVENTS(1)
+------------------------------------+-----------------------------------
Clear ECB1
ECBLIST(PTR_ECB2_ADDR_LIST
+------------------------------------+-----------------------------------
NUMEVENTS(1)
+------------------------------------+-----------------------------------
Clear ECB2
+------------------------------------+-----------------------------------
+------------------------------------+-----------------------------------
+------------------------------------+-----------------------------------
Post ECB2
+------------------------------------+-----------------------------------
Go to START OF LOOP
Go to START OF LOOP
+------------------------------------------------------------------------+
The CHANGE TASK command
CHANGE TASK changes the priority of the issuing task. It has immediate
effect (unlike SET TASK), because control is relinquished during
execution of the command so that the current task has to be redispatched.
The re-dispatch does not happen until tasks that are of
higher or equal priority, and that are also ready to run, are
dispatched.
EXEC CICS
CHANGE TASK PRIORITY(data-value)
END-EXEC
Options
PRIORITY(data-value)
24/08/2003
160/256
Specifies a full word binary value PIC S9(8) COMP in the range 0-255,
defining the priority of the task. You can also have a value of -1 but
this does not change the priority or cause a redispatch.
Conditions
INVREQ
RESP2 values: 1
Options
ECBLIST(ptr-value)
24/08/2003
161/256
NAME(name)
NUMEVENTS(data-value)
Conditions
INVREQ
24/08/2003
162/256
Usage of ECBLIST
The following figure shows how to use the ECBLIST parameter to point to
a list of ECB addresses that in turn point to individual ECBs.
Note
that the ECBLIST variable is a pointer pointing to the first address of
the list.
PTR_ECB_ADDR_LIST
+----------------+
A(ECB_ADDR_LIST)
+----------------+
ECB_ADDR_LIST
+--_--------+
+--------_-----------+
ECB1
A(ECB1) +---+ +--------+
+-----------
A(ECB2) +------_--------+
+-----------
ECB2
A(ECB3) +---+ +--------+
+-----------+
+--_--------+
ECB3
+--------+
DCL
ECB1
ECB2
ECB3
FIXED BIN(31),
/* actual
FIXED BIN(31),
/* actual
FIXED BIN(31);
/* actual
DCL
/* list of ecb addresses
1 ECB_ADDR_LIST,
2 ECB_ADDR(3) PTR;
DCL
/* ptr to each addr list
PTR_ECB_ADDR_LIST PTR;
ECB_ADDR(1) = ADDR(ECB1);
ECB_ADDR(2) = ADDR(ECB2);
ECB_ADDR(3) = ADDR(ECB3);
/* set up pointer
PTR_ECB_ADDR_LIST = ADDR(ECB_ADDR_LIST);
/* PTR_ECB_ADDR_LIST = ADDR(ECB_ADDR(1));
(alternative)
EXEC CICS WAITCICS
ECBLIST(PTR_ECB_ADDR_LIST)
NUMEVENTS(3)
PURGEABLE
ecb */
ecb */
ecb */
*/
*/
*/
*/
24/08/2003
163/256
EXEC
CICS
WAIT EXTERNAL ECBLIST(ptr-value)
NUMEVENTS(data-value)
NAME(name)
END EXEC
Options
ECBLIST(ptr-value)
NAME(name)
NUMEVENTS(data-value)
Conditions
INVREQ
1. An ECB is not valid, for example the ECB is not fullword aligned.
2. The ECB address is a null pointer, (X'00000000'). or (X'FF000000').
3. NUMEVENTS is not a positive number.
4. No valid ECBs have been found in the list, because either the ECBLIST
address is not valid or all the ECB addresses are not valid.
5. The ECBs specified are in read-only storage.
Default action: terminate the task abnormally.
Notes
The structure of ECBLIST is as illustrated earlier for the WAITCICS command.
The ENQ command
EXEC CICS
ENQ
RESOURCE(data-area)
[ LENGTH(data-value) ]
END-EXEC
Options
RESOURCE
LENGTH
24/08/2003
164/256
24/08/2003
165/256
24/08/2003
03 WS-RESP
PIC S9(08) COMP VALUE 0.
03 WS-QUEUE-RECORD-LEN
PIC S9(4) COMP VALUE 14.
01 WS-QUEUE-RECORD.
03 WS-QUEUE-DATA
PIC X(10) VALUE "SAMP5A".
03 WS-COUNT
PIC 9(4) VALUE 0.
03 WS-POST
PIC S9(8) COMP.
03 WS-POST-BIN REDEFINES WS-POST PIC X(4).
03 WS-CLEAR
PIC S9(8) COMP.
03 WS-CLEAR-BIN REDEFINES WS-CLEAR PIC X(4).
01 WS-ECBS-LEN
PIC S9(4) COMP VALUE 4.
01 WS-SAMP5-WS-PTR
USAGE IS POINTER.
01 WS-SAMP5-WS-PTR-LEN
PIC S9(4) COMP VALUE 4.
LINKAGE SECTION.
01 WS-ECBS.
03 ECB-ONE
PIC S9(8) COMP.
03 ECB-ONE-PTR
POINTER.
03 ECB-ONE-PTR-PTR
POINTER.
03 ECB-TWO
PIC S9(8) COMP.
03 ECB-TWO-PTR
POINTER.
03 ECB-TWO-PTR-PTR
POINTER.
03 NUMEVENTS
PIC S9(8) COMP VALUE 1.
PROCEDURE DIVISION.
PERFORM INIT-PARA.
PERFORM MAIN-PARA
PERFORM END-PARA.
MAIN-PARA.
PERFORM LOOP-PARA VARYING WS-COUNT FROM 0 BY 1
UNTIL WS-COUNT EQUAL 10.
LOOP-PARA.
EXEC CICS
WRITEQ TS QUEUE("SAMP5")
FROM(WS-QUEUE-RECORD)
LENGTH(WS-QUEUE-RECORD-LEN)
RESP(WS-RESP)
END-EXEC.
MOVE WS-POST TO ECB-ONE
EXEC CICS
WAITCICS ECBLIST(ECB-TWO-PTR-PTR)
NUMEVENTS(1)
END-EXEC
MOVE WS-CLEAR TO ECB-TWO.
END-PARA.
EXEC CICS
RETURN
END-EXEC.
INIT-PARA.
MOVE X'40008000' TO WS-POST-BIN
MOVE X'00000000' TO WS-CLEAR-BIN
EXEC CICS
RETRIEVE INTO(WS-SAMP5-WS-PTR)
LENGTH(WS-SAMP5-WS-PTR-LEN)
END-EXEC
SET ADDRESS OF WS-ECBS TO WS-SAMP5-WS-PTR.
166/256
24/08/2003
167/256
24/08/2003
168/256
recsize=80,blksize=800,recfm=fb,PDS
recsize=80,blksize=800,recfm=fb,PDS
recsize=80,blksize=800,recfm=fb,PDS
recsize=80,blksize=800,recfm=fb,PDS
recsize=80,blksize=800,recfm=fb,PDS
blksize=32760,recfm=vb,PDS
24/08/2003
169/256
//SYSPRINT DD SYSOUT=&OUTC
//SYSIN
DD DSN=&&SYSCIN,DISP=(OLD,DELETE)
//SYSLIN
DD DSN=&&LOADSET,DISP=(MOD,PASS),
//
UNIT=&WORK,SPACE=(80,(250,100))
//SYSUT1
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT2
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT3
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT4
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT5
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT6
DD UNIT=&WORK,SPACE=(460,(350,100))
//SYSUT7
DD UNIT=&WORK,SPACE=(460,(350,100))
//*
//COPYLINK EXEC PGM=IEBGENER,COND=(7,LT,COB)
//SYSUT1
DD DSN=&INDEX..&LIB(&STUB),DISP=SHR
//SYSUT2
DD DSN=&©LINK,DISP=(NEW,PASS),
//
DCB=(LRECL=80,BLKSIZE=400,RECFM=FB),
//
UNIT=&WORK,SPACE=(400,(20,20))
//SYSPRINT DD SYSOUT=&OUTC
//SYSIN
DD DUMMY
//*
//LKED
EXEC PGM=IEWL,REGION=®,
//
PARM='&LNKPARM',COND=(5,LT,COB)
//SYSLIB
DD DSN=&INDEX..SDFHLOAD,DISP=SHR
//
DD DSN=&COMPHLQ..SDFHLINK,DISP=SHR
//
DD DSN=CEE.SCEELKED,DISP=SHR
//
DD DSN=CEE.SCEERUN,DISP=SHR
//
DD DSN=TCPIP.SEZATCP,DISP=SHR
//SYSUT1
DD UNIT=&WORK,DCB=BLKSIZE=1024,
//
SPACE=(1024,(200,20))
//SYSPRINT DD SYSOUT=&OUTC
//SYSLIN
DD DSN=&©LINK,DISP=(OLD,DELETE)
//
DD DSN=&&LOADSET,DISP=(OLD,DELETE)
//
DD DDNAME=SYSIN
Copy this into your JCL PDS
//USER0101 JOB NOTIFY=&SYSUID
//
JCLLIB ORDER=(USER01.PROCLIB)
//COMPILE EXEC DFHEITVL
//TRN.SYSIN
DD DSN=USER01.COBOL.SOURCE(memname),DISP=SHR
//LKED.SYSIN DD *
NAME memname(R)
/*
//* THIS FOR USER LOADLIB FOR C0A2
//LKED.SYSLMOD DD DSN=<-loadlib->(memname),DISP=SHR
//
Copy this map preparation procedure into userid.PROCLIB
PROC DFHMAPT
//DFHMAPT PROC INDEX='CICSTS13.CICS', FOR SDFHMAC
//
DSCTLIB='userid.COBOL.COPY', TARGET FOR DSECT
//
MAPNAME=,
NAME OF MAPSET - REQUIRED
//
RMODE=24,
24/ANY
//
ASMBLR=ASMA90,
ASSEMBLER PROGRAM NAME
//
REG=2048K,
REGION FOR ASSEMBLY
//
OUTC=A,
PRINT SYSOUT CLASS
//
WORK=SYSDA
WORK FILE UNIT
24/08/2003
170/256
//ASMMAP
EXEC PGM=&ASMBLR,REGION=®,
// PARM='SYSPARM(MAP),DECK,NOOBJECT'
//SYSPRINT DD SYSOUT=&OUTC
//SYSLIB
DD DSN=&INDEX..SDFHMAC,DISP=SHR
//
DD DSN=SYS1.MACLIB,DISP=SHR
//SYSUT1
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSUT2
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSUT3
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSPUNCH DD DSN=&&MAP,DISP=(,PASS),UNIT=&WORK,
//
DCB=(RECFM=FB,LRECL=80,BLKSIZE=400),
//
SPACE=(400,(50,50))
//SYSIN
DD DSN=userid.MAPSET.SOURCE(&MAPNAME),DISP=SHR
//LINKMAP EXEC PGM=IEWL,PARM='LIST,LET,XREF,RMODE(&RMODE)'
//SYSPRINT DD SYSOUT=&OUTC
//SYSLMOD DD DSN=<- your CICS map set load library ->(&MAPNAME),DISP=SHR
//SYSUT1
DD UNIT=&WORK,SPACE=(1024,(20,20))
//SYSLIN
DD DSN=&&MAP,DISP=(OLD,DELETE)
//ASMDSECT EXEC PGM=&ASMBLR,REGION=®,
// PARM='SYSPARM(DSECT),DECK,NOOBJECT'
//SYSPRINT DD SYSOUT=&OUTC
//SYSLIB
DD DSN=&INDEX..SDFHMAC,DISP=SHR
//
DD DSN=SYS1.MACLIB,DISP=SHR
//SYSUT1
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSUT2
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSUT3
DD UNIT=&WORK,SPACE=(CYL,(5,5))
//SYSPUNCH DD DSN=&DSCTLIB(&MAPNAME),DISP=OLD
//SYSIN
DD DSN=user01.MAPSET.SOURCE(&MAPNAME),DISP=SHR
Copy this into userid.JCL
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//
JCLLIB ORDER=(userid.PROCLIB)
//STEP1 EXEC DFHMAPT,MAPNAME=member-name
//
24/08/2003
171/256
Program:-ORDRENT1
Transid:-ORD1
Mapset :-ORDSET1
Map
:-ORDMAP1
Calls :-GETINV
Called from:-INVMENU
XCTLS TO:-INVMENU
(PF3,PF12)
Files:INVOICE
CUSTMAS
PRODUCT
INVCTL
Program:-CUSTMNT1
Transid:-MNT1
Mapset :-MNTSET1
Map
:-MNTMAP1
:-MNTMAP2
Called from:-INVMENU
XCTLS TO:-INVMENU
(PF3,PF12)
Files:CUSTMAS
Program:-CUSTINQ1
Transid:-INQ1
Mapset :-INQSET1
Map
:-INQMAP1
Called from:-INVMENU
XCTLS TO:-INVMENU
(PF3,PF12)
Files:CUSTMAS
INVPATH (customer
number path to
invoice file)
The numbers are the order in which you must implement the parts
of the application!.
24/08/2003
172/256
Program:-ORDRENTn
Transid:-ORDn
Mapset :-ORDSETn
Map
:-ORDMAPn
Calls :-GETINV
Called from:-INVMENn
XCTLS TO:-INVMENUn
(PF3,PF12)
Files:INVOICEn
CUSTMASn
PRODUCTn
INVCTLn
Program:-CUSTMNTn
Transid:-MNTn
Mapset :-MNTSETn
Map
:-MNTMAPn
:-MNTMA2n
Called from:-INVMENn
XCTLS TO:-INVMENUn
(PF3,PF12)
Files:CUSTMASn
Program:-CUSTINQn
Transid:-INQn
Mapset :-INQSETn
Map
:-INQMAPn
Called from:-INVMENn
XCTLS TO:-INVMENUn
(PF3,PF12)
Files:CUSTMASn
INVPATHn (customer
number path to
invoice file)
1. Two students will each form a group and the n will vary from 1 to 9
for the groups.
2. Each groups resources will be in a group TRNG0n
3. The instructor will define the resources on request.
4. All programs MUST be tested using CEDF before allowing them to run.
This is to guard against programs going in a loop and disturbing
other users of the system.
5. The subprograms SYSERR,GETINV,INTEDIT and NUMEDIT will be defined in
group TRNGCOMN and can be shared by all.
6. Dont forget to change the COBOL and BMS source to reflect the naming
conventions above!.
24/08/2003
173/256
01
CUSTOMER-MASTER-RECORD.
05
05
05
05
05
05
05
Sample data
112233ANNE
FRESNO
123455COLUMBUS
COLUMBUS
123456RAUL
FRESNO
CM-CUSTOMER-NUMBER
CM-FIRST-NAME
CM-LAST-NAME
CM-ADDRESS
CM-CITY
CM-STATE
CM-ZIP-CODE
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X(6).
X(20).
X(30).
X(30).
X(20).
X(2).
X(10).
PRINCE
CA93711-0000
CHRISTOPHER
OH92939
MENENDEZ
CA93711-2765
1122 ELM ST
1122 NEW WORLD LN
888 CICS WAY
Since the application has the facility to add a customer record, you can get that
part of the application (CUSTMN1n, transid MN1n) to work and add these records.
Defining the data set
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DELETE USER01.CUSTMAS CLUSTER
DEFINE CLUSTER (NAME(USER01.CUSTMAS) INDEXED KEYS(6,0) RECORDSIZE(118,118) TRACKS(2,2)) DATA(CONTROLINTERVALSIZE(1024))
//
PRODUCT
01
PRODUCT-MASTER-RECORD.
05
05
05
05
PRM-PRODUCT-CODE
PRM-PRODUCT-DESCRIPTION
PRM-UNIT-PRICE
PRM-QUANTITY-ON-HAND
PIC
PIC
PIC
PIC
X(10).
X(20).
S9(7)V99
S9(7)
COMP-3.
COMP-3.
10
20
5
4
Sample Data
See PRODUCT file. Cut paste it into a data set userid.PRODUCT.DATA. A
load using REPRO is suggested. It is also a good idea to print the data
set using PRINT with HEX output. Note that the ORDRENT program wont work
without this data set and data.
Optionally you can use the program SAMP18 earlier in this document to
generate the data for this file automatically.
Defining the data set
//USER011 JOB NOTIFY=&SYSUID,CLASS=A,MSGLEVEL=(1,1)
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
//
24/08/2003
174/256
PIC 9(6).
PIC X(8).
PIC X(6).
PIC X(10).
OCCURS 10.
PIC X(10).
PIC S9(7)
PIC S9(7)V99
PIC S9(7)V99
PIC S9(7)V99
COMP-3.
COMP-3.
COMP-3.
COMP-3.
10
4
5
5
6
8
6
10
240
This data set has an alternate index built over the INV-CUSTOMER-NUMBER
field. When using an alternate index, you simply specify the name of the
path as a FILE resource to CICS.
Three Access Method Services commands are used as below:
1. DEFINE ALTERNATEINDEX :-defines the alternate index as a data set to
VSAM.
24/08/2003
175/256
//
24/08/2003
176/256
24/08/2003
177/256
IMPORTANT NOTE-1
1. The Application expects the current date and company name to be in
the common work area in the following format:01 COMMON-WORK-AREA.
05 CWA-DATE
PIC X(6).
05 CWA-COMPANY-NAME
PIC X(40).
Since the CWA is a system wide shared area, the storage allocated
for this application use may be different. Check with operations
and adjust your COMMON-WORK-AREA structure accordingly.
2. You will have to write a separate program (one program for the whole
Class Will do) to set the CWA to the current date and company name.
IMPORTANT NOTE-2
There is no program to maintain the PRODUCT master file. Write one from
scratch. It is enough if this program has facility to create a new
entry.
Modify INVMENU to invoke this program from the main menu.
This will be your test for the lab exercises.
24/08/2003
178/256
transaction-id PUTI
IDENTIFICATION DIVISION.
PROGRAM-ID. PUTINV.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY INVCTL.
01 WS-RESP
PIC S9(8) COMP.
LINKAGE SECTION.
PROCEDURE DIVISION.
0000-GET-INVOICE-NUMBER.
MOVE ZERO TO INVCTL-RECORD-KEY.
MOVE 1 TO INVCTL-NEXT-INVOICE-NUMBER.
EXEC CICS
WRITE FILE('INVCTL')
FROM(INVCTL-RECORD)
RIDFLD(INVCTL-RECORD-KEY)
RESP(WS-RESP)
END-EXEC
EXEC CICS
RETURN
24/08/2003
179/256
END-EXEC.
Use SAMP18 to populate the PRODUCT master with 100 records
SAMP18
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMP18.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VARS.
03 WS-RESP
PIC S9(08) COMP VALUE 0.
01 PRODUCT-MASTER-RECORD.
*
05 PRM-PRODUCT-CODE
PIC 9(10) VALUE 10.
05 PRM-PRODUCT-DESCRIPTION.
10 PROD-KEY
PIC 9(10).
10 DESCRIPTION
PIC X(10) VALUE "ABCDEFGH".
05 PRM-UNIT-PRICE
PIC S9(7)V99 COMP-3 VALUE 10.00.
05 PRM-QUANTITY-ON-HAND
PIC S9(7)
COMP-3 VALUE 10.
*
01 WS-COUNT
PIC 9(10) VALUE 1.
PROCEDURE DIVISION.
PERFORM MAIN-PARA VARYING WS-COUNT FROM 0 BY 1
UNTIL WS-COUNT EQUAL 100
PERFORM END-PARA.
MAIN-PARA.
MOVE WS-COUNT TO PROD-KEY
MOVE WS-COUNT TO PRM-PRODUCT-CODE
ADD 1 TO PRM-UNIT-PRICE
ADD 1 TO PRM-QUANTITY-ON-HAND
EXEC CICS
WRITE FILE('PRODUCT')
FROM(PRODUCT-MASTER-RECORD)
RIDFLD(PRM-PRODUCT-CODE)
RESP(WS-RESP)
END-EXEC.
END-PARA.
EXEC CICS
RETURN
END-EXEC.
Compile and Link Edit this program and define it to CICS as SYSERR.
SYSERR This is a XCTLD to program, does not need a Trans-id
IDENTIFICATION DIVISION.
PROGRAM-ID. SYSERR.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 ERROR-MESSAGE.
05 ERROR-LINE-1.
10 FILLER
PIC X(20) VALUE 'A serious error has '.
10 FILLER
PIC X(20) VALUE 'occurred. Please co'.
10 FILLER
PIC X(20) VALUE 'ntact technical supp'.
10 FILLER
PIC X(19) VALUE 'ort.
'.
05 ERROR-LINE-2
PIC X(79) VALUE SPACE.
05 ERROR-LINE-3.
24/08/2003
10 FILLER
PIC X(11) VALUE 'EIBRESP
10 EM-RESP
PIC Z(08)9.
10 FILLER
PIC X(59) VALUE SPACE.
05 ERROR-LINE-4.
10 FILLER
PIC X(11) VALUE 'EIBRESP2
10 EM-RESP2
PIC Z(08)9.
10 FILLER
PIC X(59) VALUE SPACE.
05 ERROR-LINE-5.
10 FILLER
PIC X(11) VALUE 'EIBTRNID
10 EM-TRNID
PIC X(04).
10 FILLER
PIC X(64) VALUE SPACE.
05 ERROR-LINE-6.
10 FILLER
PIC X(11) VALUE 'EIBRSRCE
10 EM-RSRCE
PIC X(08).
10 FILLER
PIC X(60) VALUE SPACE.
05 ERROR-LINE-7
PIC X(79) VALUE SPACE.
COPY ERRPARM.
LINKAGE SECTION.
01 DFHCOMMAREA
PIC X(20).
PROCEDURE DIVISION.
0000-DISPLAY-ERROR-MESSAGE.
MOVE DFHCOMMAREA TO ERROR-PARAMETERS.
MOVE ERR-RESP TO EM-RESP.
MOVE ERR-RESP2 TO EM-RESP2.
MOVE ERR-TRNID TO EM-TRNID.
MOVE ERR-RSRCE TO EM-RSRCE.
EXEC CICS
SEND TEXT FROM(ERROR-MESSAGE)
ERASE
ALARM
FREEKB
END-EXEC.
EXEC CICS
RETURN
END-EXEC.
= '.
= '.
= '.
= '.
180/256
24/08/2003
181/256
EXEC CICS
ASKTIME ABSTIME(UTIME)
END-EXEC
EXEC CICS
FORMATTIME MMDDYY(WS-DATE) DATESEP ABSTIME(UTIME)
END-EXEC
MOVE "ABC COMPANY" TO CWA-COMPANY-NAME
MOVE WS-DATE-TWO TO CWA-DATE.
EXEC CICS
RETURN
END-EXEC.
Use the following JCL to compile INTEDIT and NUMEDIT programs. Note that
these programs are not used anymore in the sample application, having
been replaced by BIF DEEDIT CICS API Call.
//USER011 JOB NOTIFY=&SYSUID
//
JCLLIB ORDER=(USER01.PROCLIB)
//COMPILE EXEC CICSCOMP
//TRN.SYSIN
DD DSN=USER01.COBOL.SOURCE(INTEDIT),DISP=SHR
//COB.SYSLIN DD DSN=USER01.COBOL.OBJECT(INTEDIT),DISP=SHR
//
This procedure must be in your private PROCLIB
//CICSCOB PROC SUFFIX=1$,
SUFFIX FOR TRANSLATOR MODULE
//
INDEX='CICSTS13.CICS'
QUALIFIER(S) FOR CICS LIBS
//TRN
EXEC PGM=DFHECP&SUFFIX,PARM='COBOL2',REGION=2M
//STEPLIB DD DSN=&INDEX..SDFHLOAD,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSPUNCH DD DSN=&&SYSCIN,DISP=(,PASS),UNIT=SYSDA,DCB=BLKSIZE=400,
//
SPACE=(400,(400,100))
//COB
EXEC PGM=IGYCRCTL,COND=(4,LT,TRN),PARM='LIST,MAP'
//STEPLIB DD DSN=IGY.V2R1M0.SIGYCOMP,DISP=SHR
//SYSIN
DD DSN=&&SYSCIN,DISP=(OLD,DELETE)
//SYSLIB
DD DSN=&INDEX..SDFHCOB,DISP=SHR
//
DD DSN=&INDEX..SDFHMAC,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSUT1
DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA
//SYSUT2
DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA
//SYSUT3
DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA
//SYSUT4
DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA
//SYSUT5
DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA
//SYSUT6
DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA
//SYSUT7
DD SPACE=(800,(500,500),,,ROUND),UNIT=SYSDA
INTEDIT
IDENTIFICATION DIVISION.
PROGRAM-ID. INTEDIT.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WORK-FIELDS.
05 INTEGER-PART
05 INTEGER-LENGTH
LINKAGE SECTION.
PIC 9(05).
PIC S9(03)
COMP-3.
24/08/2003
01
01
01
UNEDITED-NUMBER
PIC X(05).
EDITED-NUMBER
PIC 9(05).
VALID-NUMBER-SW
PIC X(01).
88 VALID-NUMBER
VALUE 'Y'.
PROCEDURE DIVISION USING UNEDITED-NUMBER
EDITED-NUMBER
VALID-NUMBER-SW.
0000-EDIT-NUMBER.
MOVE ZERO TO INTEGER-LENGTH.
INSPECT UNEDITED-NUMBER
REPLACING LEADING SPACE BY ZERO.
INSPECT UNEDITED-NUMBER
TALLYING INTEGER-LENGTH FOR CHARACTERS
BEFORE INITIAL SPACE.
IF UNEDITED-NUMBER(1:INTEGER-LENGTH) NUMERIC
MOVE UNEDITED-NUMBER(1:INTEGER-LENGTH)
TO EDITED-NUMBER
MOVE 'Y' TO VALID-NUMBER-SW
ELSE
MOVE 'N' TO VALID-NUMBER-SW
END-IF.
0000-EXIT.
EXIT PROGRAM.
NUMEDIT
IDENTIFICATION DIVISION.
PROGRAM-ID. NUMEDIT.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WORK-FIELDS.
05 INTEGER-PART
PIC 9(10).
05 INTEGER-PART-X
REDEFINES
INTEGER-PART.
10 INTEGER-CHAR
PIC X(01)
OCCURS 10.
05 DECIMAL-PART
PIC V9(10).
05 DECIMAL-PART-X
REDEFINES
DECIMAL-PART.
10 DECIMAL-CHAR
PIC X(01)
OCCURS 10.
05 DECIMAL-POS
PIC S9(03) COMP-3.
05 INTEGER-LENGTH
PIC S9(03) COMP-3.
05 INTEGER-SUB
PIC S9(03) COMP-3.
05 DECIMAL-SUB
PIC S9(03) COMP-3.
05 UNEDIT-SUB
PIC S9(03) COMP-3.
LINKAGE SECTION.
01 UNEDITED-NUMBER.
05 UNEDITED-CHAR
OCCURS 10
PIC X.
01 EDITED-NUMBER
PIC 9(07)V99.
01 VALID-NUMBER-SW
PIC X(01).
88 VALID-NUMBER
VALUE 'Y'.
PROCEDURE DIVISION USING UNEDITED-NUMBER
EDITED-NUMBER
VALID-NUMBER-SW.
0000-EDIT-NUMBER.
MOVE 'Y' TO VALID-NUMBER-SW.
MOVE ZERO TO INTEGER-PART
DECIMAL-PART
DECIMAL-POS.
INSPECT UNEDITED-NUMBER
182/256
24/08/2003
183/256
24/08/2003
184/256
back
Overview
Input /
Output
Specs
MENMAP1
Menu Map
Processing Specifications
1. The menu program is invoked when the user enters the trans-id MENU or
when another programs invokes it via XCTL with no communication area.
Either way it should respond by showing the menu map
2. On the menu map the user enters an action code. If the action code is
valid(1,2 or 3), the program should XCTL to the inquiry program, the
maintenance program, or the order entry program. If the action code
is invalid, the program should display an error message.
3. If the user presses PF3 or PF12, the program should display the
message session ended and terminate by issuing a RETURN command
without a transaction id.
Event
Start the program
PF3
PF12
Enter
Clear
PA1,PA2, or PA3
Any other key
Response
Display the menu map
Display a termination message and end
Display a termination message and end
1. If the action code is 1, XCTL to the inquiry
program
2. If the action code is 2, XCTL to the
maintenance program
3. If the action code is 3, XCTL to the order
entry program
4. Otherwise display an error message
Redisplay the menu map
Ignore the key
Display an appropriate error message
24/08/2003
185/256
1100
receive
menu
map
1000
process
menu
map
1400
send
menu
map
1200
edit
menu
data
1300
branch
to
program
2000
send
termination
message
1400
send
menu
map
24/08/2003
186/256
LENGTH=14,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='ACTION . . . .'
ACTION
DFHMDF POS=(5,16),
X
LENGTH=1,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_'
DFHMDF POS=(5,18),
X
LENGTH=32,
X
ATTRB=(NORM,ASKIP),
X
COLOR=NEUTRAL,
X
INITIAL='1. DISPLAY CUSTOMER INFORMATION'
DFHMDF POS=(6,18),
X
LENGTH=33,
X
ATTRB=(NORM,PROT),
X
COLOR=NEUTRAL,
X
INITIAL='2. MAINTAIN CUSTOMER INFORMATION'
DFHMDF POS=(7,18),
X
LENGTH=16,
X
ATTRB=(NORM,PROT),
X
COLOR=NEUTRAL,
X
INITIAL='3. ENTER ORDERS'
***********************************************************************
MESSAGE DFHMDF POS=(23,1),
X
LENGTH=79,
X
COLOR=YELLOW,
X
ATTRB=(BRT,PROT)
DFHMDF POS=(24,1),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='F3=EXIT
F12=CANCEL'
DUMMY
DFHMDF POS=(24,79),
X
LENGTH=1,
X
ATTRB=(DRK,PROT,FSET),
X
INITIAL=' '
***********************************************************************
DFHMSD TYPE=FINAL
END
24/08/2003
187/256
Select an action.
Master Menu
Action . . . . _ 1.
2.
3.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
F3=Exit
F12=Cancel
X
24/08/2003
188/256
24/08/2003
PIC X
PIC X.
PIC X(8)
PIC X(8)
PIC X(8)
REDEFINES
OCCURS 3
PIC X(8).
189/256
VALUE 'Y'.
VALUE 'Y'.
VALUE '1'.
VALUE '2'.
VALUE '3'.
VALUE 'CUSTINQ1'.
VALUE 'CUSTMNT1'.
VALUE 'ORDRENT1'.
PROGRAM-LIST
ACTION-ALPHA.
05 ACTION-NUM
PIC 9.
01 END-OF-SESSION-MESSAGE
PIC X(13) VALUE 'SESSION ENDED'.
01 RESPONSE-CODE
PIC S9(8) COMP.
01 COMMUNICATION-AREA
PIC X.
COPY MENSET1.
COPY DFHAID.
COPY ATTR.
LINKAGE SECTION.
01 DFHCOMMAREA
PIC X.
PROCEDURE DIVISION.
0000-PROCESS-MASTER-MENU.
EVALUATE TRUE
WHEN EIBCALEN = ZERO
MOVE LOW-VALUE TO MENMAP1O
MOVE -1 TO ACTIONL
SET SEND-ERASE TO TRUE
PERFORM 1400-SEND-MENU-MAP
WHEN EIBAID = DFHCLEAR
MOVE LOW-VALUE TO MENMAP1O
MOVE -1 TO ACTIONL
SET SEND-ERASE TO TRUE
PERFORM 1400-SEND-MENU-MAP
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
WHEN EIBAID = DFHPF3 OR DFHPF12
PERFORM 2000-SEND-TERMINATION-MESSAGE
EXEC CICS
RETURN
END-EXEC
WHEN EIBAID = DFHENTER
PERFORM 1000-PROCESS-MENU-MAP
WHEN OTHER
MOVE 'INVALID KEY PRESSED.' TO MESSAGEO
MOVE -1 TO ACTIONL
24/08/2003
190/256
24/08/2003
MAPSET('MENSET1')
FROM(MENMAP1O)
DATAONLY
CURSOR
END-EXEC.
2000-SEND-TERMINATION-MESSAGE.
EXEC CICS
SEND TEXT FROM(END-OF-SESSION-MESSAGE)
ERASE
FREEKB
END-EXEC.
191/256
24/08/2003
192/256
back
Overview
Input /
Output
Specs
CUSTMAS
MNTMAP1
MNTMAP2
Processing
1. Control
INVMENU
program
program
map.
specifications
is transferred to this program
with no communication area.
by entering the transaction
should respond by displaying
2. On the key map the user selects a processing action (add, change or
delete ) and enters a customer number. Both the action field and the
customer number field must be entered. If the user selects add, the
customer number entered must not exist in the file. For change or
delete, the customer number must exist in the file.
3. If the user enters a valid combination of action and customer number,
display the customer data maintenance map. For an addition or a
change request, all data fields must be entered. For a delete
request, all fields are set to protected so the user cannot enter
changes.
4. If the user presses PF3 from either the key map or the data map,
return to the menu program INVMENU by issuing an XCTL command. If the
user presses PF12 from the key map, return to the menu program.
However if the user presses PF12 from the data map, redisplay the key
map without processing any data that was entered.
5. For a change or deletion, maintain an image of the customer record in
a TS queue between program executions. If the record is changed in
any way between program executions, notify the user and abort the
change or delete process.
24/08/2003
193/256
Context
n/a
Response
Display the key map
New context
Get key
All
n/a
PF12
Get key
PF12
Enter
Add customer
Change customer
Delete customer
Get key
Add, Change or
Delete customer
Enter
Add customer
Unchanged
Enter
Change customer
Enter
Delete customer
Clear
All
PA1,
PA2, PA3
Any
other
key
All
All
n/a
Get key
Get key
Get key
Add customer
Get key
Change customer
Get key
Unchanged
Unchanged
24/08/2003
194/256
1100
Receive
Key
map
1200
Edit
Key
data
2000
Process
add
customer
1400
Send
Customer
map
3000
4000
1400
process
process
send
change
delete
customer
customer customer
map
1500
send
key
map
1300
read
customer
record
2100
receive
customer
map
2100
receive
customer
map
3100
read
customer
for update
2200
edit
customer
data
2200
edit
customer
data
2300
write
customer
record
3100
read
customer
for update
4100
delete
customer
record
1500
send
key
map
1500
send
key
map
3200
rewrite
customer
record
1400
send
customer
map
1400
send
customer
map
1500
send
key
map
1500
send
key
map
24/08/2003
195/256
24/08/2003
196/256
LENGTH=21,
X
ATTRB=(NORM,ASKIP),
X
COLOR=NEUTRAL,
X
INITIAL='1. ADD A NEW CUSTOMER'
DFHMDF POS=(8,28),
X
LENGTH=30,
X
ATTRB=(NORM,ASKIP),
X
COLOR=NEUTRAL,
X
INITIAL='2. CHANGE AN EXISTING CUSTOMER'
DFHMDF POS=(9,28),
X
LENGTH=21,
X
ATTRB=(NORM,ASKIP),
X
COLOR=NEUTRAL,
X
INITIAL='3. DELETE AN EXISTING CUSTOMER'
MSG1
DFHMDF POS=(23,1),
X
LENGTH=79,
X
ATTRB=(BRT,PROT),
X
COLOR=YELLOW
DFHMDF POS=(24,1),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='F3=EXIT
F12=CANCEL'
DUMMY1
DFHMDF POS=(24,79),
X
LENGTH=1,
X
ATTRB=(DRK,PROT,FSET),
X
INITIAL=' '
***********************************************************************
MNTMAP2 DFHMDI SIZE=(24,80),
X
LINE=1,
X
COLUMN=1
***********************************************************************
DFHMDF POS=(1,1),
X
LENGTH=7,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='MNTMAP2'
DFHMDF POS=(1,20),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='CUSTOMER MAINTENANCE'
***********************************************************************
INSTR2
DFHMDF POS=(3,1),
X
LENGTH=79,
X
ATTRB=(NORM,PROT),
X
COLOR=NEUTRAL
DFHMDF POS=(5,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='CUSTOMER NUMBER. . . . :'
CUSTNO2 DFHMDF POS=(5,26),
X
LENGTH=6,
X
ATTRB=(NORM,PROT,FSET),
X
COLOR=TURQUOISE
***********************************************************************
24/08/2003
197/256
DFHMDF POS=(7,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='LAST NAME. . . . . . . .'
LNAME
DFHMDF POS=(7,26),
X
LENGTH=30,
X
ATTRB=(NORM,UNPROT,FSET),
X
COLOR=TURQUOISE
DFHMDF POS=(7,57),
X
LENGTH=1,
X
ATTRB=ASKIP
***********************************************************************
DFHMDF POS=(8,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='FIRST NAME . . . . . . .'
FNAME
DFHMDF POS=(8,26),
X
LENGTH=20,
X
ATTRB=(NORM,UNPROT,FSET),
X
COLOR=TURQUOISE
DFHMDF POS=(8,47),
X
LENGTH=1,
X
ATTRB=ASKIP
***********************************************************************
DFHMDF POS=(9,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='ADDRESS. . . . . . . . .'
ADDR
DFHMDF POS=(9,26),
X
LENGTH=30,
X
ATTRB=(NORM,UNPROT,FSET),
X
COLOR=TURQUOISE
DFHMDF POS=(9,57),
X
LENGTH=1,
X
ATTRB=ASKIP
***********************************************************************
DFHMDF POS=(10,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='CITY . . . . . . . . . .'
CITY
DFHMDF POS=(10,26),
X
LENGTH=20,
X
ATTRB=(NORM,UNPROT,FSET),
X
COLOR=TURQUOISE
DFHMDF POS=(10,47),
X
LENGTH=1,
X
ATTRB=ASKIP
***********************************************************************
DFHMDF POS=(11,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='STATE. . . . . . . . . .'
24/08/2003
198/256
DFHMDF POS=(11,26),
X
LENGTH=2,
X
ATTRB=(NORM,UNPROT,FSET),
X
COLOR=TURQUOISE
DFHMDF POS=(11,29),
X
LENGTH=1,
X
ATTRB=ASKIP
***********************************************************************
DFHMDF POS=(12,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='ZIP CODE . . . . . . . .'
ZIPCODE DFHMDF POS=(12,26),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT,FSET),
X
COLOR=TURQUOISE
DFHMDF POS=(12,37),
X
LENGTH=1,
X
ATTRB=ASKIP
***********************************************************************
MSG2
DFHMDF POS=(23,1),
X
LENGTH=79,
X
ATTRB=(BRT,PROT),
X
COLOR=YELLOW
DFHMDF POS=(24,1),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='F3=EXIT
F12=CANCEL'
DUMMY2
DFHMDF POS=(24,79),
X
LENGTH=1,
X
ATTRB=(DRK,PROT,FSET),
X
INITIAL=' '
***********************************************************************
DFHMSD TYPE=FINAL
END
24/08/2003
199/256
Customer Maintenance
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
F3=Exit
F12=Cancel
MNTMAP2
Customer Maintenance
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Customer number. . . . : XXXXXX
Last name.
First name
Address. .
City . . .
State. . .
Zip Code .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XX
XXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
F3=Exit
F12=Cancel
X
24/08/2003
Time -
9:52:58
200/256
01
03 CUSTNO2A PIC X.
02
FILLER
PIC X(0002).
02
CUSTNO2I PIC X(0006).
02
LNAMEL
PIC S9(4) COMP.
02
LNAMEF
PIC X.
02
FILLER REDEFINES LNAMEF.
03 LNAMEA
PIC X.
02
FILLER
PIC X(0002).
02
LNAMEI
PIC X(0030).
02
FNAMEL
PIC S9(4) COMP.
02
FNAMEF
PIC X.
02
FILLER REDEFINES FNAMEF.
03 FNAMEA
PIC X.
02
FILLER
PIC X(0002).
02
FNAMEI
PIC X(0020).
02
ADDRL
PIC S9(4) COMP.
02
ADDRF
PIC X.
02
FILLER REDEFINES ADDRF.
03 ADDRA
PIC X.
02
FILLER
PIC X(0002).
02
ADDRI
PIC X(0030).
02
CITYL
PIC S9(4) COMP.
02
CITYF
PIC X.
02
FILLER REDEFINES CITYF.
03 CITYA
PIC X.
02
FILLER
PIC X(0002).
02
CITYI
PIC X(0020).
02
STATEL
PIC S9(4) COMP.
02
STATEF
PIC X.
02
FILLER REDEFINES STATEF.
03 STATEA
PIC X.
02
FILLER
PIC X(0002).
02
STATEI
PIC X(0002).
02
ZIPCODEL PIC S9(4) COMP.
02
ZIPCODEF PIC X.
02
FILLER REDEFINES ZIPCODEF.
03 ZIPCODEA PIC X.
02
FILLER
PIC X(0002).
02
ZIPCODEI PIC X(0010).
02
MSG2L
PIC S9(4) COMP.
02
MSG2F
PIC X.
02
FILLER REDEFINES MSG2F.
03 MSG2A
PIC X.
02
FILLER
PIC X(0002).
02
MSG2I
PIC X(0079).
02
DUMMY2L
PIC S9(4) COMP.
02
DUMMY2F
PIC X.
02
FILLER REDEFINES DUMMY2F.
03 DUMMY2A
PIC X.
02
FILLER
PIC X(0002).
02
DUMMY2I
PIC X(0001).
MNTMAP2O REDEFINES MNTMAP2I.
02
FILLER
PIC X(12).
02
FILLER
PIC X(3).
02
INSTR2C
PIC X.
02
INSTR2H
PIC X.
02
INSTR2O
PIC X(0079).
24/08/2003
201/256
FILLER
CUSTNO2C
CUSTNO2H
CUSTNO2O
FILLER
LNAMEC
LNAMEH
LNAMEO
FILLER
FNAMEC
FNAMEH
FNAMEO
FILLER
ADDRC
ADDRH
ADDRO
FILLER
CITYC
CITYH
CITYO
FILLER
STATEC
STATEH
STATEO
FILLER
ZIPCODEC
ZIPCODEH
ZIPCODEO
FILLER
MSG2C
MSG2H
MSG2O
FILLER
DUMMY2C
DUMMY2H
DUMMY2O
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X(3).
X.
X.
X(0006).
X(3).
X.
X.
X(0030).
X(3).
X.
X.
X(0020).
X(3).
X.
X.
X(0030).
X(3).
X.
X.
X(0020).
X(3).
X.
X.
X(0002).
X(3).
X.
X.
X(0010).
X(3).
X.
X.
X(0079).
X(3).
X.
X.
X(0001).
24/08/2003
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X(6).
X(20).
X(30).
X(30).
X(20).
X(2).
X(10).
ATTRIBUTE-DEFINITIONS.
05
05
05
05
05
05
ATTR-UNPROT
ATTR-UNPROT-MDT
ATTR-UNPROT-BRT
ATTR-UNPROT-BRT-MDT
ATTR-UNPROT-DARK
ATTR-UNPROT-DARK-MDT
PIC
PIC
PIC
PIC
PIC
PIC
X
X
X
X
X
X
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
' '.
X'C1'.
X'C8'.
X'C9'.
X'4C'.
X'4D'.
202/256
01
*
24/08/2003
05
05
05
05
05
05
05
05
05
05
05
05
05
05
05
05
05
05
ATTR-UNPROT-NUM
ATTR-UNPROT-NUM-MDT
ATTR-UNPROT-NUM-BRT
ATTR-UNPROT-NUM-BRT-MDT
ATTR-UNPROT-NUM-DARK
ATTR-UNPROT-NUM-DARK-MDT
ATTR-PROT
ATTR-PROT-MDT
ATTR-PROT-BRT
ATTR-PROT-BRT-MDT
ATTR-PROT-DARK
ATTR-PROT-DARK-MDT
ATTR-PROT-SKIP
ATTR-PROT-SKIP-MDT
ATTR-PROT-SKIP-BRT
ATTR-PROT-SKIP-BRT-MDT
ATTR-PROT-SKIP-DARK
ATTR-PROT-SKIP-DARK-MDT
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
X'50'.
X'D1'.
X'D8'.
X'D9'.
X'5C'.
X'5D'.
X'60'.
X'61'.
X'E8'.
X'E9'.
'%'.
X'6D'.
X'F0'.
X'F1'.
X'F8'.
X'F9'.
X'7C'.
X'7D'.
05
05
05
05
ATTR-NO-HIGHLIGHT
ATTR-BLINK
ATTR-REVERSE
ATTR-UNDERSCORE
PIC
PIC
PIC
PIC
X
X
X
X
VALUE
VALUE
VALUE
VALUE
X'00'.
'1'.
'2'.
'4'.
05
05
05
05
05
05
05
05
ATTR-DEFAULT-COLOR
ATTR-BLUE
ATTR-RED
ATTR-PINK
ATTR-GREEN
ATTR-TURQUOISE
ATTR-YELLOW
ATTR-NEUTRAL
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X
X
X
X
X
X
X
X
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
X'00'.
'1'.
'2'.
'3'.
'4'.
'5'.
'6'.
'7'.
ERROR-PARAMETERS.
05
05
05
05
ERR-RESP
ERR-RESP2
ERR-TRNID
ERR-RSRCE
PIC
PIC
PIC
PIC
S9(8)
S9(8)
X(4).
X(8).
COMP.
COMP.
203/256
24/08/2003
204/256
24/08/2003
DELETEQ TS QUEUE(TS-QUEUE-NAME)
END-EXEC
EXEC CICS
XCTL PROGRAM('INVMENU')
END-EXEC
WHEN EIBAID = DFHPF12
IF PROCESS-KEY-MAP
EXEC CICS
DELETEQ TS QUEUE(TS-QUEUE-NAME)
END-EXEC
EXEC CICS
XCTL PROGRAM('INVMENU')
END-EXEC
ELSE
MOVE LOW-VALUE TO MNTMAP1O
MOVE -1 TO CUSTNO1L
SET SEND-ERASE TO TRUE
PERFORM 1500-SEND-KEY-MAP
SET PROCESS-KEY-MAP TO TRUE
END-IF
WHEN EIBAID = DFHCLEAR
IF PROCESS-KEY-MAP
MOVE LOW-VALUE TO MNTMAP1O
MOVE -1 TO CUSTNO1L
SET SEND-ERASE TO TRUE
PERFORM 1500-SEND-KEY-MAP
ELSE
MOVE LOW-VALUE TO MNTMAP2O
MOVE -1 TO CUSTNO2L
SET SEND-ERASE TO TRUE
PERFORM 1400-SEND-CUSTOMER-MAP
END-IF
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
WHEN EIBAID = DFHENTER
IF PROCESS-KEY-MAP
PERFORM 1000-PROCESS-KEY-MAP
ELSE IF PROCESS-ADD-CUSTOMER
PERFORM 2000-PROCESS-ADD-CUSTOMER
ELSE IF PROCESS-CHANGE-CUSTOMER
PERFORM 3000-PROCESS-CHANGE-CUSTOMER
ELSE IF PROCESS-DELETE-CUSTOMER
PERFORM 4000-PROCESS-DELETE-CUSTOMER
END-IF
END-IF
END-IF
END-IF
WHEN OTHER
IF PROCESS-KEY-MAP
MOVE LOW-VALUE TO MNTMAP1O
MOVE -1 TO CUSTNO1L
MOVE 'THAT KEY IS UNASSIGNED.' TO MSG1O
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM 1500-SEND-KEY-MAP
ELSE
MOVE LOW-VALUE TO MNTMAP2O
MOVE -1 TO CUSTNO2L
205/256
24/08/2003
206/256
24/08/2003
207/256
EVALUATE ACTIONI
WHEN '1'
PERFORM 1300-READ-CUSTOMER-RECORD
IF RESPONSE-CODE = DFHRESP(NOTFND)
MOVE 'TYPE INFORMATION FOR NEW CUSTOMER. THE
'N PRESS ENTER.' TO INSTR2O
SET PROCESS-ADD-CUSTOMER TO TRUE
MOVE SPACE TO CUSTOMER-MASTER-RECORD
ELSE
MOVE 'THAT CUSTOMER ALREADY EXISTS.'
TO MSG1O
MOVE 'N' TO VALID-DATA-SW
END-IF
WHEN '2'
PERFORM 1300-READ-CUSTOMER-RECORD
IF RESPONSE-CODE = DFHRESP(NORMAL)
MOVE 'TYPE CHANGES. THEN PRESS ENTER.'
TO INSTR2O
SET PROCESS-CHANGE-CUSTOMER TO TRUE
ELSE
MOVE 'THAT CUSTOMER DOES NOT EXIST.' TO MSG1O
MOVE 'N' TO VALID-DATA-SW
END-IF
WHEN '3'
PERFORM 1300-READ-CUSTOMER-RECORD
IF RESPONSE-CODE = DFHRESP(NORMAL)
MOVE 'PRESS ENTER TO DELETE THIS CUSTOMER OR
'PRESS F12 TO CANCEL.' TO INSTR2O
SET PROCESS-DELETE-CUSTOMER TO TRUE
MOVE ATTR-PROT TO LNAMEA
FNAMEA
ADDRA
CITYA
STATEA
ZIPCODEA
ELSE
MOVE 'THAT CUSTOMER DOES NOT EXIST.' TO MSG1O
MOVE 'N' TO VALID-DATA-SW
END-IF
END-EVALUATE
END-IF.
1300-READ-CUSTOMER-RECORD.
EXEC CICS
READ DATASET('CUSTMAS')
INTO(CUSTOMER-MASTER-RECORD)
RIDFLD(CUSTNO1I)
RESP(RESPONSE-CODE)
END-EXEC.
IF
RESPONSE-CODE NOT = DFHRESP(NORMAL)
AND RESPONSE-CODE NOT = DFHRESP(NOTFND)
GO TO 9999-TERMINATE-PROGRAM
END-IF
IF RESPONSE-CODE = DFHRESP(NORMAL)
MOVE CUSTOMER-MASTER-RECORD TO TS-CUSTOMER-RECORD
EXEC CICS
WRITEQ TS QUEUE(TS-QUEUE-NAME)
FROM(TS-CUSTOMER-RECORD)
24/08/2003
ITEM(TS-ITEM-NUMBER)
REWRITE
END-EXEC
END-IF.
1400-SEND-CUSTOMER-MAP.
EVALUATE TRUE
WHEN SEND-ERASE
EXEC CICS
SEND MAP('MNTMAP2')
MAPSET('MNTSET1')
FROM(MNTMAP2O)
ERASE
CURSOR
END-EXEC
WHEN SEND-DATAONLY-ALARM
EXEC CICS
SEND MAP('MNTMAP2')
MAPSET('MNTSET1')
FROM(MNTMAP2O)
DATAONLY
CURSOR
END-EXEC
END-EVALUATE.
1500-SEND-KEY-MAP.
EVALUATE TRUE
WHEN SEND-ERASE
EXEC CICS
SEND MAP('MNTMAP1')
MAPSET('MNTSET1')
FROM(MNTMAP1O)
ERASE
CURSOR
END-EXEC
WHEN SEND-ERASE-ALARM
EXEC CICS
SEND MAP('MNTMAP1')
MAPSET('MNTSET1')
FROM(MNTMAP1O)
ERASE
CURSOR
END-EXEC
WHEN SEND-DATAONLY-ALARM
EXEC CICS
SEND MAP('MNTMAP1')
MAPSET('MNTSET1')
FROM(MNTMAP1O)
DATAONLY
CURSOR
END-EXEC
END-EVALUATE.
2000-PROCESS-ADD-CUSTOMER.
PERFORM 2100-RECEIVE-CUSTOMER-MAP.
PERFORM 2200-EDIT-CUSTOMER-DATA.
IF VALID-DATA
PERFORM 2300-WRITE-CUSTOMER-RECORD
IF RESPONSE-CODE = DFHRESP(NORMAL)
MOVE 'CUSTOMER RECORD ADDED.' TO MSG1O
208/256
24/08/2003
209/256
ELSE
ELSE
24/08/2003
210/256
MOVE -1 TO ADDRL
MOVE 'YOU MUST ENTER AN ADDRESS.' TO MSG2O
MOVE 'N' TO VALID-DATA-SW
END-IF
IF
FNAMEI = SPACE
OR FNAMEL = ZERO
MOVE ATTR-REVERSE TO FNAMEH
MOVE -1 TO FNAMEL
MOVE 'YOU MUST ENTER A FIRST NAME.' TO MSG2O
MOVE 'N' TO VALID-DATA-SW
END-IF
IF
LNAMEI = SPACE
OR LNAMEL = ZERO
MOVE ATTR-REVERSE TO LNAMEH
MOVE -1 TO LNAMEL
MOVE 'YOU MUST ENTER A LAST NAME.' TO MSG2O
MOVE 'N' TO VALID-DATA-SW
END-IF.
2300-WRITE-CUSTOMER-RECORD.
MOVE CUSTNO2I TO CM-CUSTOMER-NUMBER.
MOVE LNAMEI
TO CM-LAST-NAME.
MOVE FNAMEI
TO CM-FIRST-NAME.
MOVE ADDRI
TO CM-ADDRESS.
MOVE CITYI
TO CM-CITY.
MOVE STATEI
TO CM-STATE.
MOVE ZIPCODEI TO CM-ZIP-CODE.
EXEC CICS
WRITE DATASET('CUSTMAS')
FROM(CUSTOMER-MASTER-RECORD)
RIDFLD(CM-CUSTOMER-NUMBER)
RESP(RESPONSE-CODE)
END-EXEC.
IF
RESPONSE-CODE NOT = DFHRESP(NORMAL)
AND RESPONSE-CODE NOT = DFHRESP(DUPREC)
GO TO 9999-TERMINATE-PROGRAM
END-IF.
3000-PROCESS-CHANGE-CUSTOMER.
PERFORM 2100-RECEIVE-CUSTOMER-MAP.
PERFORM 2200-EDIT-CUSTOMER-DATA.
IF VALID-DATA
MOVE CUSTNO2I TO CM-CUSTOMER-NUMBER
PERFORM 3100-READ-CUSTOMER-FOR-UPDATE
IF RESPONSE-CODE = DFHRESP(NORMAL)
EXEC CICS
READQ TS QUEUE(TS-QUEUE-NAME)
INTO(TS-CUSTOMER-RECORD)
LENGTH(TS-RECORD-LENGTH)
ITEM(TS-ITEM-NUMBER)
END-EXEC
IF CUSTOMER-MASTER-RECORD = TS-CUSTOMER-RECORD
PERFORM 3200-REWRITE-CUSTOMER-RECORD
MOVE 'CUSTOMER RECORD UPDATED.' TO MSG1O
SET SEND-ERASE TO TRUE
ELSE
MOVE 'ANOTHER USER HAS UPDATED THE RECORD.
'GAIN.' TO MSG1O
SET SEND-ERASE-ALARM TO TRUE
TRY A
24/08/2003
211/256
END-IF
ELSE
ELSE
TRY AGAIN
24/08/2003
212/256
24/08/2003
213/256
back
Overview
Input /
Output
INVOICE
CUSTMAS
INVCTL
PRODUCT
ORDMAP1
Specs
Invoice file
Customer Master File
Keeps track of running invoice number
Product (inventory) file
Order entry map
Processing Specifications
1. Control is transferred to this program via XCTL from the main program
INVMENU with no communication area. The user can also invoke this
program directly by entering the transaction id ORD1. In either case
the program should respond by displaying the order entry map.
2. On the order entry map, the user enters a customer number, a p/o
number, and data for up to 10 line items. The order entry program
edits the data according to the rules listed in step 3. If the data
is valid, the program displays the map with all fields protected. The
user can post the order by pressing the enter key or make additional
changes by pressing PF4. If the user presses PF4 the program should
unprotect the entry fields and permit the user to make the changes.
If the user presses PF12, the program should cancel the order and
redisplay the entry screens with blank fields. The user ends the
program by pressing PF3.
3. Order entry data is validated as below
Customer number
must be in the customer file
Product code
must be in the product file
Quantity
must be a valid integer(call the INTEDIT user
subprogram)
Net price
must be a valid decimal number(call the NUMEDIT
user subprogram)
In addition the following cross validations are made
a) If the user enters a product code, he must also enter a quantity
for that line
b) The user cannot enter a quantity or net price on a line where he
did not enter a product code
c) The user must enter at least one line item
4. If the user does not enter a net price, use the list price from the
appropriate product record.
5. To obtain the invoice number, invoke the GETINV program with a LINK
command
6. Use the data stored in the CWA for the invoice date field
24/08/2003
214/256
7. When the user exits the program, display a total of the number of
orders entered before returning to the menu.
24/08/2003
215/256
Context
n/a
Response
Display the order map
All
PF12
Process entry
PF12
Process verify
Enter
Process entry
Enter
Process verify
PF4
Process entry
PF4
Process verify
Clear
All
PA1, PA2,
or PA3
Any other
key
All
All
New context
Process
entry
n/a
n/a
Process
entry
Process
verify
Process
Entry
Process
entry
Unchanged
Process
entry
Process
entry
Unchanged
unchanged
24/08/2003
216/256
1000
Process
Order
map
1100
receive
Order
map
1210
read
customer
record
1400
send
Order
map
1200
edit
Order
data
1220
edit
line
item
1230
read
product
record
1300
format
invoice
record
2000
Process
post
order
1400
send
Order
map
1410
set
attributes
GETINV
get
invoice
number
1420
reset
attributes
3000
send
total
line
2100
write
invoice
record
1400
send
Order
map
24/08/2003
217/256
24/08/2003
218/256
24/08/2003
219/256
ATTRB=ASKIP
DFHMDF POS=(11,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST1
DFHMDF POS=(11,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET1
DFHMDF POS=(11,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT1
DFHMDF POS=(11,68),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 2
*
***********************************************************************
PCODE2
DFHMDF POS=(12,1),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT),
X
COLOR=TURQUOISE,
X
INITIAL='__________'
DFHMDF POS=(12,13),
X
LENGTH=1,
X
ATTRB=ASKIP
QTY2
DFHMDF POS=(12,15),
X
LENGTH=5,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_____'
DFHMDF POS=(12,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC2
DFHMDF POS=(12,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST2
DFHMDF POS=(12,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET2
DFHMDF POS=(12,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT2
DFHMDF POS=(12,68),
X
LENGTH=12,
X
DESC1
24/08/2003
220/256
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 3
*
***********************************************************************
PCODE3
DFHMDF POS=(13,1),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT),
X
COLOR=TURQUOISE,
X
INITIAL='__________'
DFHMDF POS=(13,13),
X
LENGTH=1,
X
ATTRB=ASKIP
QTY3
DFHMDF POS=(13,15),
X
LENGTH=5,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_____'
DFHMDF POS=(13,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC3
DFHMDF POS=(13,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST3
DFHMDF POS=(13,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET3
DFHMDF POS=(13,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT3
DFHMDF POS=(13,68),
LENGTH=12,
ATTRB=(NORM,PROT),
COLOR=TURQUOISE,
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 4
*
***********************************************************************
PCODE4
DFHMDF POS=(14,1),
LENGTH=10,
ATTRB=(NORM,UNPROT),
COLOR=TURQUOISE,
INITIAL='__________'
DFHMDF POS=(14,13),
LENGTH=1,
ATTRB=ASKIP
QTY4
DFHMDF POS=(14,15),
LENGTH=5,
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
24/08/2003
221/256
INITIAL='_____'
DFHMDF POS=(14,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC4
DFHMDF POS=(14,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST4
DFHMDF POS=(14,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET4
DFHMDF POS=(14,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT4
DFHMDF POS=(14,68),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 5
*
***********************************************************************
PCODE5
DFHMDF POS=(15,1),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT),
X
COLOR=TURQUOISE,
X
INITIAL='__________'
DFHMDF POS=(15,13),
X
LENGTH=1,
X
ATTRB=ASKIP
QTY5
DFHMDF POS=(15,15),
X
LENGTH=5,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_____'
DFHMDF POS=(15,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC5
DFHMDF POS=(15,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST5
DFHMDF POS=(15,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET5
DFHMDF POS=(15,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
24/08/2003
222/256
INITIAL='__________'
DFHMDF POS=(15,68),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 6
*
***********************************************************************
PCODE6
DFHMDF POS=(16,1),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT),
X
COLOR=TURQUOISE,
X
INITIAL='__________'
DFHMDF POS=(16,13),
X
LENGTH=1,
X
ATTRB=ASKIP
QTY6
DFHMDF POS=(16,15),
X
LENGTH=5,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_____'
DFHMDF POS=(16,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC6
DFHMDF POS=(16,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST6
DFHMDF POS=(16,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET6
DFHMDF POS=(16,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT6
DFHMDF POS=(16,68),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 7
*
***********************************************************************
PCODE7
DFHMDF POS=(17,1),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT),
X
COLOR=TURQUOISE,
X
INITIAL='__________'
DFHMDF POS=(17,13),
X
LENGTH=1,
X
ATTRB=ASKIP
QTY7
DFHMDF POS=(17,15),
X
AMT5
24/08/2003
223/256
LENGTH=5,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_____'
DFHMDF POS=(17,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC7
DFHMDF POS=(17,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST7
DFHMDF POS=(17,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET7
DFHMDF POS=(17,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT7
DFHMDF POS=(17,68),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 8
*
***********************************************************************
PCODE8
DFHMDF POS=(18,1),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT),
X
COLOR=TURQUOISE,
X
INITIAL='__________'
DFHMDF POS=(18,13),
X
LENGTH=1,
X
ATTRB=ASKIP
QTY8
DFHMDF POS=(18,15),
X
LENGTH=5,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_____'
DFHMDF POS=(18,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC8
DFHMDF POS=(18,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST8
DFHMDF POS=(18,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET8
DFHMDF POS=(18,57),
X
LENGTH=10,
X
24/08/2003
224/256
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT8
DFHMDF POS=(18,68),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 9
*
***********************************************************************
PCODE9
DFHMDF POS=(19,1),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT),
X
COLOR=TURQUOISE,
X
INITIAL='__________'
DFHMDF POS=(19,13),
X
LENGTH=1,
X
ATTRB=ASKIP
QTY9
DFHMDF POS=(19,15),
X
LENGTH=5,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_____'
DFHMDF POS=(19,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC9
DFHMDF POS=(19,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST9
DFHMDF POS=(19,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET9
DFHMDF POS=(19,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT9
DFHMDF POS=(19,68),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
*
LINE PCODE 10
*
***********************************************************************
PCODE10 DFHMDF POS=(20,1),
X
LENGTH=10,
X
ATTRB=(NORM,UNPROT),
X
COLOR=TURQUOISE,
X
INITIAL='__________'
DFHMDF POS=(20,13),
X
24/08/2003
225/256
LENGTH=1,
X
ATTRB=ASKIP
QTY10
DFHMDF POS=(20,15),
X
LENGTH=5,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
INITIAL='_____'
DFHMDF POS=(20,21),
X
LENGTH=1,
X
ATTRB=ASKIP
DESC10
DFHMDF POS=(20,23),
X
LENGTH=20,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE
LIST10
DFHMDF POS=(20,44),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
NET10
DFHMDF POS=(20,57),
X
LENGTH=10,
X
ATTRB=(NORM,NUM),
X
COLOR=TURQUOISE,
X
PICOUT='ZZZZZZ9.99',
X
INITIAL='__________'
AMT10
DFHMDF POS=(20,68),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
DFHMDF POS=(22,44),
X
LENGTH=14,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='INVOICE TOTAL:'
TOTAL
DFHMDF POS=(22,66),
X
LENGTH=12,
X
ATTRB=(NORM,PROT),
X
COLOR=TURQUOISE,
X
PICOUT='Z,ZZZ,ZZ9.99'
***********************************************************************
MSG
DFHMDF POS=(23,1),
X
LENGTH=79,
X
ATTRB=(BRT,PROT),
X
COLOR=YELLOW
FKEY
DFHMDF POS=(24,1),
X
LENGTH=40,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE
DUMMY
DFHMDF POS=(24,79),
X
LENGTH=1,
X
ATTRB=(DRK,PROT,FSET),
X
INITIAL=' '
***********************************************************************
DFHMSD TYPE=FINAL
END
ORDMAP1
24/08/2003
226/256
Order Entry
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Customer number . . . ______
P.O. number . . . . . __________
Prod code
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
Qty
_____
_____
_____
_____
_____
_____
_____
_____
_____
_____
Customer: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX XX XXXXXXXXXX
Description
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
List
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Net
__________
__________
__________
__________
__________
__________
__________
__________
__________
__________
Amount
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Z,ZZZ,ZZ9.99
Invoice total:
Z,ZZZ,ZZ9.99
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
X
24/08/2003
227/256
*
*
05
ORD-D-ZIPCODE
PIC X(10).
05
ORD-LINE-ITEM
OCCURS 10 TIMES.
10
10
10
10
10
ORD-L-PCODE
ORD-A-PCODE
ORD-C-PCODE
ORD-H-PCODE
ORD-D-PCODE
PIC
PIC
PIC
PIC
PIC
10
10
10
10
10
ORD-L-QTY
ORD-A-QTY
ORD-C-QTY
ORD-H-QTY
ORD-D-QTY
10
ORD-D-QTY-ALPHA
10
10
10
10
10
ORD-L-DESC
ORD-A-DESC
ORD-C-DESC
ORD-H-DESC
ORD-D-DESC
PIC
PIC
PIC
PIC
PIC
10
10
10
10
10
ORD-L-LIST
ORD-A-LIST
ORD-C-LIST
ORD-H-LIST
ORD-D-LIST
10
10
10
10
10
ORD-L-NET
ORD-A-NET
ORD-C-NET
ORD-H-NET
ORD-D-NET
10
ORD-D-NET-ALPHA
10
10
10
10
10
ORD-L-AMOUNT
ORD-A-AMOUNT
ORD-C-AMOUNT
ORD-H-AMOUNT
ORD-D-AMOUNT
24/08/2003
S9(04)
X(01).
X(01).
X(01).
X(10).
S9(04)
X(01).
X(01).
X(01).
X(20).
COMP.
COMP.
05
05
05
05
05
ORD-L-TOTAL
ORD-A-TOTAL
ORD-C-TOTAL
ORD-H-TOTAL
ORD-D-TOTAL
05
05
ORD-L-MESSAGE
ORD-A-MESSAGE
PIC S9(04)
PIC X(01).
COMP.
228/256
24/08/2003
05
05
05
ORD-C-MESSAGE
ORD-H-MESSAGE
ORD-D-MESSAGE
PIC X(01).
PIC X(01).
PIC X(79).
05
05
05
05
05
ORD-L-FKEY
ORD-A-FKEY
ORD-C-FKEY
ORD-H-FKEY
ORD-D-FKEY
PIC
PIC
PIC
PIC
PIC
S9(04)
X(01).
X(01).
X(01).
X(40).
COMP.
05
05
05
05
05
ORD-L-DUMMY
ORD-A-DUMMY
ORD-C-DUMMY
ORD-H-DUMMY
ORD-D-DUMMY
PIC
PIC
PIC
PIC
PIC
S9(04)
X(01).
X(01).
X(01).
X(01).
COMP.
229/256
PIC 9(06).
PIC X(08).
PIC X(06).
PIC X(10).
OCCURS 10 TIMES.
PIC X(10).
PIC S9(07)
COMP-3.
PIC S9(07)V99 COMP-3.
PIC S9(07)V99 COMP-3.
PIC S9(07)V99 COMP-3.
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X(6).
X(20).
X(30).
X(30).
X(20).
X(2).
X(10).
PIC
PIC
PIC
PIC
X(10).
X(20).
S9(07)V99
S9(07)
PIC X(01).
PIC 9(06).
COMP-3.
COMP-3.
PIC
PIC
PIC
PIC
S9(8)
S9(8)
X(4).
X(8).
24/08/2003
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
' '.
X'C1'.
X'C8'.
X'C9'.
X'4C'.
X'4D'.
X'50'.
X'D1'.
X'D8'.
X'D9'.
X'5C'.
X'5D'.
X'60'.
X'61'.
X'E8'.
X'E9'.
'%'.
X'6D'.
X'F0'.
X'F1'.
X'F8'.
X'F9'.
X'7C'.
X'7D'.
PIC
PIC
PIC
PIC
X
X
X
X
VALUE
VALUE
VALUE
VALUE
X'00'.
'1'.
'2'.
'4'.
PIC
PIC
PIC
PIC
PIC
PIC
PIC
PIC
X
X
X
X
X
X
X
X
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
VALUE
X'00'.
'1'.
'2'.
'3'.
'4'.
'5'.
'6'.
'7'.
COMP.
COMP.
230/256
24/08/2003
231/256
24/08/2003
232/256
COPY CUSTMAS.
COPY PRODUCT.
COPY INVCTL.
COPY ORDMAP1.
COPY DFHAID.
COPY ATTR.
COPY ERRPARM.
LINKAGE SECTION.
01 DFHCOMMAREA
PIC X(352).
01 COMMON-WORK-AREA.
05 CWA-DATE
PIC X(8).
05 CWA-COMPANY-NAME
PIC X(40).
PROCEDURE DIVISION.
0000-ENTER-ORDERS.
MOVE DFHCOMMAREA TO COMMUNICATION-AREA.
EVALUATE TRUE
WHEN EIBCALEN = ZERO
MOVE LOW-VALUE TO ORDMAP1
MOVE LOW-VALUE TO COMMUNICATION-AREA
MOVE ZERO
TO CA-TOTAL-ORDERS
MOVE 'TYPE ORDER DETAILS. THEN PRESS ENTER.'
TO ORD-D-INSTR
MOVE 'F3=EXIT
F12=CANCEL' TO ORD-D-FKEY
MOVE -1 TO ORD-L-CUSTNO
SET SEND-ERASE TO TRUE
PERFORM 1400-SEND-ORDER-MAP
SET PROCESS-ENTRY TO TRUE
WHEN EIBAID = DFHCLEAR
MOVE LOW-VALUE TO ORDMAP1
MOVE LOW-VALUE TO CA-INVOICE-RECORD
CA-FIELDS-ENTERED
MOVE 'TYPE ORDER DETAILS. THEN PRESS ENTER.'
TO ORD-D-INSTR
MOVE 'F3=EXIT
F12=CANCEL' TO ORD-D-FKEY
MOVE -1 TO ORD-L-CUSTNO
SET SEND-ERASE TO TRUE
PERFORM 1400-SEND-ORDER-MAP
SET PROCESS-ENTRY TO TRUE
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
WHEN EIBAID = DFHPF3
PERFORM 3000-SEND-TOTAL-LINE
EXEC CICS
RETURN TRANSID('MENU')
END-EXEC
WHEN EIBAID = DFHPF12
IF PROCESS-VERIFY
MOVE LOW-VALUE TO ORDMAP1
MOVE LOW-VALUE TO CA-INVOICE-RECORD
CA-FIELDS-ENTERED
MOVE 'TYPE ORDER DETAILS. THEN PRESS ENTER.'
TO ORD-D-INSTR
MOVE 'F3=EXIT
F12=CANCEL' TO ORD-D-FKEY
MOVE -1 TO ORD-L-CUSTNO
SET SEND-ERASE TO TRUE
PERFORM 1400-SEND-ORDER-MAP
SET PROCESS-ENTRY TO TRUE
24/08/2003
233/256
ELSE IF PROCESS-ENTRY
EXEC CICS
XCTL PROGRAM('INVMENU')
END-EXEC
END-IF
END-IF
WHEN EIBAID = DFHENTER
IF PROCESS-ENTRY
PERFORM 1000-PROCESS-ORDER-MAP
ELSE IF PROCESS-VERIFY
PERFORM 2000-PROCESS-POST-ORDER
SET PROCESS-ENTRY TO TRUE
END-IF
END-IF
WHEN EIBAID = DFHPF4
IF PROCESS-VERIFY
MOVE LOW-VALUE TO ORDMAP1
MOVE 'TYPE CORRECTIONS. THEN PRESS ENTER.'
TO ORD-D-INSTR
MOVE 'F3=EXIT
F12=CANCEL' TO ORD-D-FKEY
MOVE -1 TO ORD-L-CUSTNO
SET RESET-ATTRIBUTES TO TRUE
SET SEND-DATAONLY TO TRUE
PERFORM 1400-SEND-ORDER-MAP
SET PROCESS-ENTRY TO TRUE
ELSE IF PROCESS-ENTRY
MOVE LOW-VALUE TO ORDMAP1
MOVE 'INVALID KEY PRESSED.' TO ORD-D-MESSAGE
MOVE -1 TO ORD-L-CUSTNO
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM 1400-SEND-ORDER-MAP
END-IF
END-IF
WHEN OTHER
MOVE LOW-VALUE TO ORDMAP1
MOVE 'INVALID KEY PRESSED.' TO ORD-D-MESSAGE
MOVE -1 TO ORD-L-CUSTNO
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM 1400-SEND-ORDER-MAP
END-EVALUATE.
EXEC CICS
RETURN TRANSID('ORD1')
COMMAREA(COMMUNICATION-AREA)
END-EXEC.
1000-PROCESS-ORDER-MAP.
PERFORM 1100-RECEIVE-ORDER-MAP.
PERFORM 1200-EDIT-ORDER-DATA
IF VALID-DATA
PERFORM 1300-FORMAT-INVOICE-RECORD
MOVE 'PRESS ENTER TO POST THIS ORDER. OR PRESS F4 TO ENT
'ER CORRECTIONS.' TO ORD-D-INSTR
MOVE 'F3=EXIT
F4=CHANGE
F12=CANCEL' TO ORD-D-FKEY
MOVE SPACE TO ORD-D-MESSAGE
SET SEND-DATAONLY TO TRUE
SET SET-ATTRIBUTES TO TRUE
PERFORM 1400-SEND-ORDER-MAP
SET PROCESS-VERIFY TO TRUE
24/08/2003
234/256
24/08/2003
235/256
ORD-D-ADDR
ORD-D-CITY
ORD-D-STATE
ORD-D-ZIPCODE
MOVE ATTR-REVERSE TO ORD-H-CUSTNO
MOVE -1 TO ORD-L-CUSTNO
MOVE 'THAT CUSTOMER DOES NOT EXIST'
TO ORD-D-MESSAGE
MOVE 'N' TO VALID-DATA-SW
END-IF
END-IF
IF VALID-DATA
MOVE -1 TO ORD-L-CUSTNO.
1210-READ-CUSTOMER-RECORD.
EXEC CICS
READ DATASET('CUSTMAS')
INTO(CUSTOMER-MASTER-RECORD)
RIDFLD(ORD-D-CUSTNO)
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(NORMAL)
MOVE 'Y' TO CUSTOMER-FOUND-SW
ELSE IF RESPONSE-CODE = DFHRESP(NOTFND)
MOVE 'N' TO CUSTOMER-FOUND-SW
ELSE
PERFORM 9999-TERMINATE-PROGRAM
END-IF
END-IF.
1220-EDIT-LINE-ITEM.
MOVE ATTR-NO-HIGHLIGHT TO ORD-H-PCODE(ITEM-SUB)
ORD-H-QTY(ITEM-SUB)
ORD-H-NET(ITEM-SUB).
MOVE 'N' TO PRODUCT-FOUND-SW.
IF
ORD-L-PCODE(ITEM-SUB) > ZERO
AND ORD-D-PCODE(ITEM-SUB) NOT = SPACE
MOVE 'Y' TO CA-PCODE-ENTERED-SW(ITEM-SUB)
ELSE
MOVE 'N' TO CA-PCODE-ENTERED-SW(ITEM-SUB).
IF
ORD-L-QTY(ITEM-SUB) > ZERO
AND ORD-D-QTY-ALPHA(ITEM-SUB) NOT = SPACE
MOVE 'Y' TO CA-QTY-ENTERED-SW(ITEM-SUB)
ELSE
MOVE 'N' TO CA-QTY-ENTERED-SW(ITEM-SUB).
IF
ORD-L-NET(ITEM-SUB) > ZERO
AND ORD-D-NET-ALPHA(ITEM-SUB) NOT = SPACE
MOVE 'Y' TO CA-NET-ENTERED-SW(ITEM-SUB)
ELSE
MOVE 'N' TO CA-NET-ENTERED-SW(ITEM-SUB).
IF
CA-NET-ENTERED(ITEM-SUB)
AND NOT CA-PCODE-ENTERED(ITEM-SUB)
MOVE ATTR-REVERSE TO ORD-H-PCODE(ITEM-SUB)
MOVE -1 TO ORD-L-PCODE(ITEM-SUB)
MOVE 'YOU CANNOT ENTER A NET PRICE WITHOUT A PRODUCT CODE
'.' TO ORD-D-MESSAGE
MOVE 'N' TO VALID-DATA-SW.
IF CA-NET-ENTERED(ITEM-SUB)
MOVE ORD-D-NET-ALPHA(ITEM-SUB) TO NET-NUMERIC-C
24/08/2003
236/256
EXEC CICS
BIF DEEDIT FIELD(NET-NUMERIC) LENGTH(10)
END-EXEC
IF NET-NUMERIC > 0 MOVE "Y" TO VALID-NET-SW
IF VALID-NET
MOVE NET-NUMERIC TO ORD-D-NET(ITEM-SUB)
ELSE
MOVE ATTR-REVERSE TO ORD-H-NET(ITEM-SUB)
MOVE -1 TO ORD-L-NET(ITEM-SUB)
MOVE 'NET PRICE MUST BE NUMERIC' TO ORD-D-MESSAGE
MOVE 'N' TO VALID-DATA-SW
MOVE 'N' TO VALID-QUANTITY-SW.
IF
CA-QTY-ENTERED(ITEM-SUB)
AND NOT CA-PCODE-ENTERED(ITEM-SUB)
MOVE ATTR-REVERSE TO ORD-H-PCODE(ITEM-SUB)
MOVE -1 TO ORD-L-PCODE(ITEM-SUB)
MOVE 'YOU CANNOT ENTER A QUANTITY WITHOUT A PRODUCT CODE'
TO ORD-D-MESSAGE
MOVE 'N' TO VALID-DATA-SW.
IF CA-QTY-ENTERED(ITEM-SUB)
MOVE ORD-D-QTY-ALPHA(ITEM-SUB) TO QTY-NUMERIC-C
EXEC CICS
BIF DEEDIT FIELD(QTY-NUMERIC) LENGTH(5)
END-EXEC
IF QTY-NUMERIC > 0 MOVE "Y" TO VALID-QUANTITY-SW
IF VALID-QUANTITY
IF QTY-NUMERIC > ZERO
MOVE QTY-NUMERIC TO ORD-D-QTY(ITEM-SUB)
ELSE
MOVE ATTR-REVERSE TO ORD-H-QTY(ITEM-SUB)
MOVE -1 TO ORD-L-QTY(ITEM-SUB)
MOVE 'QUANTITY MUST BE GREATER THAN ZERO'
TO ORD-D-MESSAGE
MOVE 'N' TO VALID-DATA-SW
MOVE 'N' TO VALID-QUANTITY-SW
ELSE
MOVE ATTR-REVERSE TO ORD-H-QTY(ITEM-SUB)
MOVE -1 TO ORD-L-QTY(ITEM-SUB)
MOVE 'QUANTITY MUST BE NUMERIC' TO ORD-D-MESSAGE
MOVE 'N' TO VALID-DATA-SW
MOVE 'N' TO VALID-QUANTITY-SW.
IF
CA-PCODE-ENTERED(ITEM-SUB)
AND NOT CA-QTY-ENTERED(ITEM-SUB)
MOVE ATTR-REVERSE TO ORD-H-QTY(ITEM-SUB)
MOVE -1 TO ORD-L-QTY(ITEM-SUB)
MOVE 'YOU MUST ENTER A QUANTITY' TO ORD-D-MESSAGE
MOVE 'N' TO VALID-DATA-SW.
IF NOT CA-PCODE-ENTERED(ITEM-SUB)
MOVE SPACE TO ORD-D-DESC(ITEM-SUB)
MOVE ZERO TO ORD-D-LIST(ITEM-SUB)
ORD-D-AMOUNT(ITEM-SUB)
ELSE
ADD 1 TO LINE-ITEM-COUNT
PERFORM 1230-READ-PRODUCT-RECORD
IF PRODUCT-FOUND
MOVE PRM-PRODUCT-DESCRIPTION
TO ORD-D-DESC(ITEM-SUB)
24/08/2003
237/256
24/08/2003
238/256
24/08/2003
239/256
24/08/2003
FROM(INVOICE-RECORD)
RIDFLD(INV-INVOICE-NUMBER)
END-EXEC.
3000-SEND-TOTAL-LINE.
MOVE CA-TOTAL-ORDERS TO TL-TOTAL-ORDERS.
EXEC CICS
SEND TEXT FROM(TOTAL-LINE)
ERASE
FREEKB
END-EXEC.
9999-TERMINATE-PROGRAM.
MOVE EIBRESP TO ERR-RESP.
MOVE EIBRESP2 TO ERR-RESP2.
MOVE EIBTRNID TO ERR-TRNID.
MOVE EIBRSRCE TO ERR-RSRCE.
EXEC CICS
XCTL PROGRAM('SYSERR')
COMMAREA(ERROR-PARAMETERS)
END-EXEC.
240/256
24/08/2003
241/256
24/08/2003
242/256
back
Overview
Input /
Output
Specs
INQMAP1
CUSTMAS
INVPATH
Processing
1. Control
INVMENU
program
program
Specifications
is transferred to this program via XCTL from the menu program
with no communication area. The user can also start the
by entering the transaction id INQ1. In either case, the
should respond by displaying the customer inquiry map
Display
Display
Display
Display
the
the
the
the
24/08/2003
243/256
Response
Display the inquiry map
Transfer control to the menu program
Read and display the customer and related invoice
records indicated by the customer number entered by
the user.
Read and display the first customer record and
related invoice records
Read and display the last customer record and related
invoice records
Read and display the previous customer record and
related invoice records
Read and display the next customer record and related
invoice records
Redisplay the current map
Ignore the key
Display an appropriate error message
24/08/2003
244/256
1000
Display
selected
customer
1100
Receive
inquiry
map
2000
3000
4000
5000
Display
display
display
display
First
last
prev
next
customer customer customer customer
1200
1300
Edit
Read
Customer Customer
number
record
1400
Display
Inquiry
results
1410
start
invoice
browse
1500
Send
Inquiry
map
1420
format
invoice
record
1430
read
next
invoice
2100
2200
start
read
customer
next
browse
customer
1400
display
inquiry
results
2100
3100
start
read
customer previous
browse
customer
1400
display
inquiry
results
2100
2200
3100
start
read
read
customer
next
prev
browse
customer customer
1400
display
inquiry
results
2100
2200
start
read
customer
next
browse
customer
1400
display
inquiry
results
24/08/2003
245/256
The Mapset
PRINT NOGEN
INQSET1 DFHMSD TYPE=&SYSPARM,
X
LANG=COBOL,
X
MODE=INOUT,
X
TERM=3270-2,
X
CTRL=FREEKB,
X
MAPATTS=(COLOR),
X
STORAGE=AUTO,
X
TIOAPFX=YES
***********************************************************************
INQMAP1 DFHMDI SIZE=(24,80),
X
LINE=1,
X
COLUMN=1
***********************************************************************
DFHMDF POS=(1,1),
X
LENGTH=8,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='INQMAP1'
DFHMDF POS=(1,20),
X
LENGTH=16,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='CUSTOMER INQUIRY'
***********************************************************************
DFHMDF POS=(3,1),
X
LENGTH=65,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='TO START A NEW BROWSE, TYPE A CUSTOMER NUMBER. X
THEN PRESS ENTER.'
DFHMDF POS=(5,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='CUSTOMER NUMBER. . . . .'
CUSTNO
DFHMDF POS=(5,26),
X
LENGTH=6,
X
ATTRB=(NORM,UNPROT,IC),
X
COLOR=TURQUOISE,
X
INITIAL='______'
DFHMDF POS=(5,33),
X
LENGTH=1,
X
ATTRB=ASKIP
***********************************************************************
DFHMDF POS=(7,1),
X
LENGTH=24,
X
ATTRB=(NORM,PROT),
X
COLOR=GREEN,
X
INITIAL='NAME AND ADDRESS . . . :'
LNAME
DFHMDF POS=(7,26),
X
LENGTH=30,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
FNAME
DFHMDF POS=(8,26),
X
LENGTH=20,
X
24/08/2003
246/256
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
ADDR
DFHMDF POS=(9,26),
X
LENGTH=30,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
CITY
DFHMDF POS=(10,26),
X
LENGTH=20,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
STATE
DFHMDF POS=(10,47),
X
LENGTH=2,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
ZIPCODE DFHMDF POS=(10,50),
X
LENGTH=10,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
***********************************************************************
DFHMDF POS=(12,1),
X
LENGTH=43,
X
COLOR=GREEN,
X
ATTRB=(NORM,PROT),
X
INITIAL='INVOICE PO NUMBER
DATE
TOTAL'
INV1
DFHMDF POS=(13,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV2
DFHMDF POS=(14,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV3
DFHMDF POS=(15,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV4
DFHMDF POS=(16,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV5
DFHMDF POS=(17,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV6
DFHMDF POS=(18,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV7
DFHMDF POS=(19,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV8
DFHMDF POS=(20,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV9
DFHMDF POS=(21,2),
X
24/08/2003
247/256
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
INV10
DFHMDF POS=(22,2),
X
LENGTH=42,
X
COLOR=TURQUOISE,
X
ATTRB=(NORM,PROT)
***********************************************************************
MESSAGE DFHMDF POS=(23,1),
X
LENGTH=79,
X
ATTRB=(BRT,PROT),
X
COLOR=YELLOW
DFHMDF POS=(24,1),
X
LENGTH=34,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='F3=EXIT F5=FIRST F6=LAST F7=PREV'
DFHMDF POS=(24,38),
X
LENGTH=19,
X
ATTRB=(NORM,PROT),
X
COLOR=BLUE,
X
INITIAL='F8=NEXT F12=CANCEL'
DUMMY
DFHMDF POS=(24,79),
X
LENGTH=1,
X
ATTRB=(DRK,PROT,FSET),
X
INITIAL=' '
***********************************************************************
DFHMSD TYPE=FINAL
END
INQMAP1
24/08/2003
248/256
Customer Inquiry
24/08/2003
*
*
*
*
CUSTOMER-INQUIRY-MAP.
05
FILLER
PIC X(12).
05
05
05
CIM-L-CUSTNO
CIM-A-CUSTNO
CIM-D-CUSTNO
PIC S9(4)
PIC X.
PIC X(6).
COMP.
05
05
05
CIM-L-LNAME
CIM-A-LNAME
CIM-D-LNAME
PIC S9(4)
PIC X.
PIC X(30).
COMP.
05
05
05
CIM-L-FLAME
CIM-A-FNAME
CIM-D-FNAME
PIC S9(4)
PIC X.
PIC X(20).
COMP.
05
05
05
CIM-L-ADDR
CIM-A-ADDR
CIM-D-ADDR
PIC S9(4)
PIC X.
PIC X(30).
COMP.
05
05
05
CIM-L-CITY
CIM-A-CITY
CIM-D-CITY
PIC S9(4)
PIC X.
PIC X(20).
COMP.
05
05
05
CIM-L-STATE
CIM-A-STATE
CIM-D-STATE
PIC S9(4)
PIC X.
PIC XX.
COMP.
05
05
05
CIM-L-ZIPCODE
CIM-A-ZIPCODE
CIM-D-ZIPCODE
PIC S9(4)
PIC X.
PIC X(10).
COMP.
05
CIM-INVOICE-LINE
OCCURS 10.
10
10
10
PIC S9(4)
PIC X.
PIC X(42).
COMP.
CIM-L-INVOICE-LINE
CIM-A-INVOICE-LINE
CIM-D-INVOICE-LINE
05
05
05
CIM-L-MESSAGE
CIM-A-MESSAGE
CIM-D-MESSAGE
PIC S9(4)
PIC X.
PIC X(79).
COMP.
05
05
05
CIM-L-DUMMY
CIM-A-DUMMY
CIM-D-DUMMY
PIC S9(4)
PIC X.
PIC X.
COMP.
249/256
24/08/2003
250/256
24/08/2003
PERFORM 1500-SEND-INQUIRY-MAP
WHEN EIBAID = DFHPA1 OR DFHPA2 OR DFHPA3
CONTINUE
WHEN EIBAID = DFHPF3 OR DFHPF12
EXEC CICS
XCTL PROGRAM('INVMENU')
END-EXEC
WHEN EIBAID = DFHENTER
PERFORM 1000-DISPLAY-SELECTED-CUSTOMER
WHEN EIBAID = DFHPF5
PERFORM 2000-DISPLAY-FIRST-CUSTOMER
WHEN EIBAID = DFHPF6
PERFORM 3000-DISPLAY-LAST-CUSTOMER
WHEN EIBAID = DFHPF7
PERFORM 4000-DISPLAY-PREV-CUSTOMER
WHEN EIBAID = DFHPF8
PERFORM 5000-DISPLAY-NEXT-CUSTOMER
WHEN OTHER
MOVE LOW-VALUE TO CUSTOMER-INQUIRY-MAP
MOVE 'INVALID KEY PRESSED.' TO CIM-D-MESSAGE
SET SEND-DATAONLY-ALARM TO TRUE
PERFORM 1500-SEND-INQUIRY-MAP
END-EVALUATE.
EXEC CICS
RETURN TRANSID('INQ1')
COMMAREA(COMMUNICATION-AREA)
END-EXEC.
1000-DISPLAY-SELECTED-CUSTOMER.
PERFORM 1100-RECEIVE-INQUIRY-MAP.
PERFORM 1200-EDIT-CUSTOMER-NUMBER.
IF VALID-DATA
PERFORM 1300-READ-CUSTOMER-RECORD
IF CUSTOMER-FOUND
SET DISPLAY-NEW-CUSTOMER TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS
MOVE CM-CUSTOMER-NUMBER TO CA-CUSTOMER-NUMBER
ELSE
SET DISPLAY-SPACES TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS
ELSE
SET DISPLAY-LOW-VALUES TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS.
1100-RECEIVE-INQUIRY-MAP.
EXEC CICS
RECEIVE MAP('INQMAP1')
MAPSET('INQSET1')
INTO(CUSTOMER-INQUIRY-MAP)
END-EXEC.
INSPECT CUSTOMER-INQUIRY-MAP
REPLACING ALL '_' BY SPACE.
1200-EDIT-CUSTOMER-NUMBER.
IF
CIM-L-CUSTNO = ZERO
OR CIM-D-CUSTNO = SPACE
MOVE 'N' TO VALID-DATA-SW
MOVE 'YOU MUST ENTER A CUSTOMER NUMBER.'
TO CIM-D-MESSAGE.
1300-READ-CUSTOMER-RECORD.
251/256
24/08/2003
252/256
EXEC CICS
READ DATASET('CUSTMAS')
INTO(CUSTOMER-MASTER-RECORD)
RIDFLD(CIM-D-CUSTNO)
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(NOTFND)
MOVE 'N' TO CUSTOMER-FOUND-SW
MOVE 'THAT CUSTOMER DOES NOT EXIST.' TO CIM-D-MESSAGE
ELSE IF RESPONSE-CODE NOT = DFHRESP(NORMAL)
GO TO 9999-TERMINATE-PROGRAM.
1400-DISPLAY-INQUIRY-RESULTS.
IF DISPLAY-NEW-CUSTOMER
MOVE CM-CUSTOMER-NUMBER TO CIM-D-CUSTNO
MOVE CM-LAST-NAME
TO CIM-D-LNAME
MOVE CM-FIRST-NAME
TO CIM-D-FNAME
MOVE CM-ADDRESS
TO CIM-D-ADDR
MOVE CM-CITY
TO CIM-D-CITY
MOVE CM-STATE
TO CIM-D-STATE
MOVE CM-ZIP-CODE
TO CIM-D-ZIPCODE
PERFORM 1410-START-INVOICE-BROWSE
PERFORM 1420-FORMAT-INVOICE-LINE
VARYING INVOICE-SUB FROM 1 BY 1
UNTIL INVOICE-SUB > 10
SET SEND-DATAONLY TO TRUE
ELSE IF DISPLAY-SPACES
MOVE LOW-VALUE TO CIM-D-CUSTNO
MOVE SPACE
TO CIM-D-LNAME
CIM-D-FNAME
CIM-D-ADDR
CIM-D-CITY
CIM-D-STATE
CIM-D-ZIPCODE
PERFORM VARYING INVOICE-SUB FROM 1 BY 1
UNTIL INVOICE-SUB > 10
MOVE SPACE TO CIM-D-INVOICE-LINE(INVOICE-SUB)
END-PERFORM
SET SEND-DATAONLY-ALARM TO TRUE
ELSE IF DISPLAY-LOW-VALUES
SET SEND-DATAONLY-ALARM TO TRUE.
PERFORM 1500-SEND-INQUIRY-MAP.
1410-START-INVOICE-BROWSE.
EXEC CICS
STARTBR DATASET('INVPATH')
RIDFLD(CM-CUSTOMER-NUMBER)
EQUAL
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(NOTFND)
MOVE 'N' TO MORE-INVOICES-SW
ELSE IF RESPONSE-CODE NOT = DFHRESP(NORMAL)
GO TO 9999-TERMINATE-PROGRAM.
1420-FORMAT-INVOICE-LINE.
IF MORE-INVOICES
PERFORM 1430-READ-NEXT-INVOICE
MOVE INV-INVOICE-NUMBER TO IL-INVOICE-NUMBER
MOVE INV-PO-NUMBER
TO IL-PO-NUMBER
24/08/2003
253/256
MOVE INV-INVOICE-DATE
TO IL-INVOICE-DATE
MOVE INV-INVOICE-TOTAL TO IL-INVOICE-TOTAL
MOVE INVOICE-LINE TO CIM-D-INVOICE-LINE(INVOICE-SUB)
ELSE
24/08/2003
IF RESPONSE-CODE = DFHRESP(NORMAL)
MOVE 'Y' TO CUSTOMER-FOUND-SW
MOVE SPACE TO CIM-D-MESSAGE
ELSE IF RESPONSE-CODE = DFHRESP(NOTFND)
MOVE 'N' TO CUSTOMER-FOUND-SW
MOVE 'THERE ARE NO CUSTOMERS IN THE FILE.'
TO CIM-D-MESSAGE
ELSE
GO TO 9999-TERMINATE-PROGRAM.
2200-READ-NEXT-CUSTOMER.
EXEC CICS
READNEXT DATASET('CUSTMAS')
INTO(CUSTOMER-MASTER-RECORD)
RIDFLD(CM-CUSTOMER-NUMBER)
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(NORMAL)
MOVE 'Y' TO CUSTOMER-FOUND-SW
ELSE IF RESPONSE-CODE = DFHRESP(ENDFILE)
MOVE 'N' TO CUSTOMER-FOUND-SW
MOVE 'THERE ARE NO MORE RECORDS IN THE FILE.'
TO CIM-D-MESSAGE
ELSE
GO TO 9999-TERMINATE-PROGRAM.
3000-DISPLAY-LAST-CUSTOMER.
MOVE HIGH-VALUE TO CM-CUSTOMER-NUMBER.
MOVE LOW-VALUE TO CUSTOMER-INQUIRY-MAP.
PERFORM 2100-START-CUSTOMER-BROWSE.
IF CUSTOMER-FOUND
PERFORM 3100-READ-PREV-CUSTOMER.
IF CUSTOMER-FOUND
SET DISPLAY-NEW-CUSTOMER TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS
MOVE CM-CUSTOMER-NUMBER TO CA-CUSTOMER-NUMBER
ELSE
SET DISPLAY-SPACES TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS.
3100-READ-PREV-CUSTOMER.
EXEC CICS
READPREV DATASET('CUSTMAS')
INTO(CUSTOMER-MASTER-RECORD)
RIDFLD(CM-CUSTOMER-NUMBER)
RESP(RESPONSE-CODE)
END-EXEC.
IF RESPONSE-CODE = DFHRESP(NORMAL)
MOVE 'Y' TO CUSTOMER-FOUND-SW
ELSE IF RESPONSE-CODE = DFHRESP(ENDFILE)
MOVE 'N' TO CUSTOMER-FOUND-SW
MOVE 'THERE ARE NO MORE RECORDS IN THE FILE.'
TO CIM-D-MESSAGE
ELSE
GO TO 9999-TERMINATE-PROGRAM.
4000-DISPLAY-PREV-CUSTOMER.
MOVE CA-CUSTOMER-NUMBER TO CM-CUSTOMER-NUMBER.
MOVE LOW-VALUE
TO CUSTOMER-INQUIRY-MAP.
PERFORM 2100-START-CUSTOMER-BROWSE.
IF CUSTOMER-FOUND
254/256
24/08/2003
PERFORM 2200-READ-NEXT-CUSTOMER
PERFORM 3100-READ-PREV-CUSTOMER
PERFORM 3100-READ-PREV-CUSTOMER.
IF CUSTOMER-FOUND
SET DISPLAY-NEW-CUSTOMER TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS
MOVE CM-CUSTOMER-NUMBER TO CA-CUSTOMER-NUMBER
ELSE
SET DISPLAY-LOW-VALUES TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS.
5000-DISPLAY-NEXT-CUSTOMER.
MOVE CA-CUSTOMER-NUMBER TO CM-CUSTOMER-NUMBER.
MOVE LOW-VALUE
TO CUSTOMER-INQUIRY-MAP.
PERFORM 2100-START-CUSTOMER-BROWSE.
IF CUSTOMER-FOUND
PERFORM 2200-READ-NEXT-CUSTOMER
PERFORM 2200-READ-NEXT-CUSTOMER.
IF CUSTOMER-FOUND
SET DISPLAY-NEW-CUSTOMER TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS
MOVE CM-CUSTOMER-NUMBER TO CA-CUSTOMER-NUMBER
ELSE
SET DISPLAY-LOW-VALUES TO TRUE
PERFORM 1400-DISPLAY-INQUIRY-RESULTS.
9999-TERMINATE-PROGRAM.
MOVE EIBRESP TO ERR-RESP.
MOVE EIBRESP2 TO ERR-RESP2.
MOVE EIBTRNID TO ERR-TRNID.
MOVE EIBRSRCE TO ERR-RSRCE.
EXEC CICS
XCTL PROGRAM('SYSERR')
COMMAREA(ERROR-PARAMETERS)
END-EXEC.
255/256
24/08/2003
256/256