Joined: 22 Mar 2010 Posts: 27 Location: Montgomery, AL
Greetings.
I have a program that uses READQ and WRITEQto perform intermediate calculations before writing to a VSAM file. Is there a better way, other than using the comm-area, to do this?
Since January when writing the records to the VSAM file, it is picking up extraneous information that does not belong to that record. When this program is being used, two users are keying data at the same time.
I am thinking that the code, in the program, needs to be modernized/cleaned up. I am looking for suggestions on replacing the READQ and WRITEQ part.
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
You CAN use the same TSQ, although you really should have separate TSQ's.
To guarantee integrity, you must use ENQ and DEQ API's, which enforces serial access, using a RESOURCE name known by every program which accesses the TSQ. Otherwise, TSQ data integrity will be in question, similar to what you're dealing with now.
You may want to review your TSQ naming convention and build the TSQ name unique to the user and the transaction-id.
TSQ names can now be up to 16-Bytes long, so you have the opportunity for uniqueness.
One last recommendation; Delete the TSQ when you're done or issue a DELETEQ (specifying NOHANDLE) when you're about to write the first TSQ Item (TSQ creation).
Commarea usage can replace the TSQ's. If you're short on extra commarea space, take a look at CONTAINERS, introduced with CICS/TS 3.1.