Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reading VSAM file with Alternate Index/Key in CICS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
View previous topic :: :: View next topic  
Author Message
mmt_bit

New User


Joined: 15 Jan 2009
Posts: 14
Location: Bangalore

PostPosted: Thu Apr 02, 2009 11:16 am    Post subject: Reading VSAM file with Alternate Index/Key in CICS
Reply with quote

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
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7930
Location: Bellevue, IA

PostPosted: Thu Apr 02, 2009 4:43 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Apr 02, 2009 5:24 pm    Post subject: Reply to: Reading VSAM file with Alternate Index/Key in CICS
Reply with quote

Is your alternate key unique or non-unique?

Regards,
Back to top
View user's profile Send private message
mmt_bit

New User


Joined: 15 Jan 2009
Posts: 14
Location: Bangalore

PostPosted: Thu Apr 02, 2009 6:10 pm    Post subject: Reply to: Reading VSAM file with Alternate Index/Key in CICS
Reply with quote

Hi Bill,

Alternate key is non-unique.

Regards,
Manmohan
Back to top
View user's profile Send private message
mmt_bit

New User


Joined: 15 Jan 2009
Posts: 14
Location: Bangalore

PostPosted: Thu Apr 02, 2009 7:24 pm    Post subject: Reply to: Reading VSAM file with Alternate Index/Key in CICS
Reply with quote

Also please let me know whether the PATH file should be defined in CICS or the ALTERNATE index file.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7930
Location: Bellevue, IA

PostPosted: Thu Apr 02, 2009 7:37 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mmt_bit

New User


Joined: 15 Jan 2009
Posts: 14
Location: Bangalore

PostPosted: Thu Apr 02, 2009 7:53 pm    Post subject: Reply to: Reading VSAM file with Alternate Index/Key in CICS
Reply with quote

Thanks a ton for your timely and prudent assistance.

Regards,
Manmohan
Back to top
View user's profile Send private message
mmt_bit

New User


Joined: 15 Jan 2009
Posts: 14
Location: Bangalore

PostPosted: Fri Apr 03, 2009 2:30 pm    Post subject: Reply to: Reading VSAM file with Alternate Index/Key in CICS
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Apr 03, 2009 2:33 pm    Post subject: Reply to: Reading VSAM file with Alternate Index/Key in CICS
Reply with quote

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
View user's profile Send private message
mmt_bit

New User


Joined: 15 Jan 2009
Posts: 14
Location: Bangalore

PostPosted: Fri Apr 03, 2009 2:43 pm    Post subject: Reply to: Reading VSAM file with Alternate Index/Key in CICS
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7930
Location: Bellevue, IA

PostPosted: Fri Apr 03, 2009 4:49 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts Underlying DB2 VSAM LDS - SMF recording vasanthz All Other Mainframe Topics 6 Thu Jan 05, 2017 4:20 am
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts INDEPENDENT CICS TS 4.1 MRO REGION UP... Kyle Carroll CICS 0 Wed Dec 14, 2016 6:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us