View previous topic :: View next topic
|
Author |
Message |
mmt_bit
New User
Joined: 15 Jan 2009 Posts: 14 Location: Bangalore
|
|
|
|
Hi,
I have a VSAM file with record length 80 and first 22 bytes as the primary key. I am using this file to read data and display it on the cics screen.
But now I have a requirement to build an alternate index and read data based on this new index (with duplicates).
The following are few queries:
1. Should I need to define this new PATH file in CICS region with a new CICS logical name.
2. Should I use the following to perform read operation:
New alternative index/key, New Path file name, Record layout of the BASE file, Length of the base file record.
EXEC CICS STARTBR
FILE(new PATH file)
RIDFLD(alternate key)
GTEQ
RESP(WSV-RESP)
END-EXEC
EXEC CICS READPREV
FILE(new PATH file)
INTO((record layout of base file))
LENGTH((record length of base file))
RIDFLD(alternate key)
RESP(WSV-RESP)
END-EXEC
EXEC CICS READNEXT
FILE(new PATH file)
INTO((record layout of base file))
RIDFLD(alternate key)
LENGTH((record length of base file))
RESP(WSV-RESP)
END-EXEC
Please advise.
Regards,
Manmohan |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
1. Yes; the PATH needs to have a CICS file definition so you can access it.
2. Sounds good to me -- nothing really unusual about reading by alternate index. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Is your alternate key unique or non-unique?
Regards, |
|
Back to top |
|
|
mmt_bit
New User
Joined: 15 Jan 2009 Posts: 14 Location: Bangalore
|
|
|
|
Hi Bill,
Alternate key is non-unique.
Regards,
Manmohan |
|
Back to top |
|
|
mmt_bit
New User
Joined: 15 Jan 2009 Posts: 14 Location: Bangalore
|
|
|
|
Also please let me know whether the PATH file should be defined in CICS or the ALTERNATE index file. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
From the CICS System Definition Guide (with my added emphasis):
Quote: |
Sometimes you may need to identify and access your records by a secondary or alternate key. With VSAM, you can build one or more alternate indexes over a single base data set, so that you do not need to keep multiple copies of the same information organized in different ways for different applications. Using this method, you create an alternate index path (or paths), that links the alternate index (or indexes) with the base. You can then use the alternate key to access the records by specifying the path as the data set to be accessed, that is by allocating the path data set to a CICS file.
When you create a path you give it a name of up to 44 characters, in the same way as a base data set. A CICS application program does not need to know whether it is accessing your data athrough a path or a base; except that it may be necessary to allow for duplicate keys if the alternate index was specified to have non-unique keys. |
|
|
Back to top |
|
|
mmt_bit
New User
Joined: 15 Jan 2009 Posts: 14 Location: Bangalore
|
|
|
|
Thanks a ton for your timely and prudent assistance.
Regards,
Manmohan |
|
Back to top |
|
|
mmt_bit
New User
Joined: 15 Jan 2009 Posts: 14 Location: Bangalore
|
|
|
|
Consider the BASE file having the following data:
PKey AKeys
<--> <----------------------------------->
0001 000A
0002 000A
0003 000A
0004 000A
0005 000A
0006 000A
0007 000B
0008 000B
Here 0001 is Primary Key and 000A is alternate Key.
The PATH file will have the following data:
AKey PKeys
<--> <----------------------------------->
000A 0001 0002 0003 0004 0005 0006
000B 0007 0008
In the above(PATH) file '000A' is the Alternate Key and 0001 and 0002 are corresponding primary keys
My CICS screen has only space to show 3 records.
So when I read from the Path file with Alternate key(000A),
I can display records having Primary Key 0001, 0002 and 0003.
How can I display next 3 records?
How CICS will understand that it should start from next record(0004) and display 0004, 0005 and 0006?
Assisting with a syntax code will be helpful. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
ask Your support what is the standard method for displaying data in multiple screens
many organization have a standard paging program
( same user interaction standards across the applications ) |
|
Back to top |
|
|
mmt_bit
New User
Joined: 15 Jan 2009 Posts: 14 Location: Bangalore
|
|
|
|
Sorry for not writing the query properly.
I am using PF7 and PF8 keys to read previous and read next records. Like the PAGE UP and PAGE DOWN.
Once the user presses PF8 key, How can I tell CICS to read from last record (0004 in the above example).
With the current syntax of the readprev and readnext I can only pass the ALTERNATE KEY.
EXEC CICS READNEXT
FILE(new PATH file)
INTO((record layout of base file))
RIDFLD(alternate key)
LENGTH((record length of base file))
RESP(WSV-RESP)
END-EXEC
Where as in this case I also need to pass last Primary Key (from where it should start reading). |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Program logic is required. Pass the primary key you need to start with in the DFHCOMMAREA so you can use it to set the starting position for the next screen. Your program will have to do READNEXT until it finds that key and then proceed from there.
Unless, of course, your site has a standard way of doing this already and you're trying to reinvent the wheel there ... |
|
Back to top |
|
|
|