View previous topic :: View next topic
|
Author |
Message |
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Hi Guys,
I have just come accross a question while taking up a test for VSAM basics. Could you please explain me how an A.I defined as "Non-Unique" works and what is the answer in this case. I have attached the question.
Am a newbie to VSAM.. Please adjust if the question is too simple.
Code: |
Primary Key is defined to be the Part Number and sorted
Part_Number Assembly Description
2001 Bicycle Wheel
2003 Table Top
2002 Bicycle Seat
2001 Table Leg
2004 Table Brackets |
Thanks. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Post the question and not an attachment as many people can not open attachments. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
please review You understanding of the question posed
You ask about alternate index, but the data You posted has a primary key
from the VSAM point of view and from BOM ( bill of material processing ) point of view
there are conflicts
1) (VSAM) the primary key must be unique
2) (BOM)
... its silly to have the same part number for a bicycle wheel and a table leg
review the data, or correct the typing errors
to give sensible answers we need sensible questions and data |
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Hi E.S
Apologise for the Typo error..
Here's the question again.. For the data shown on the topic..
Code: |
Primary Key is defined to be the Part Number and sorted
Part Number Assembly Description
2001 Bicycle Wheel
2003 Table Top
2002 Bicycle Seat
2000 Table Leg
2004 Table Brackets
With an Alternate index defined as “Non-Unique”, which of the following would be the structure of A.I?
Option 1
Alternate Key Table Bicycle Bicycle Table Table
Primary Key 2000 2001 2002 2003 2004
Option 2
Assembly Description Part Number
Bicycle Seat 2002
Bicycle Wheel 2001
Table Brackets 2004
Table Leg 2000
Table Top 2003
Option 3
Assembly Part number
Bicycle 2001 2002
Table 2000 2003 20004
Option 4
Assembly Part number
Bicycle 2001
Bicycle 2002
Table 2000
Table 2003
Table 2004
|
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
an alternate index does not have a structure
its simply a way of presenting data in a different order
to get a better grasp of how things might look themselves
You might ...
define a cluster
load it with Your data
print the base cluster
define an alternate index
build the laternate index
define the path
print the path to see how the data looks like
here is a pointer to a thread with all the jcl needed
it should be fairly easy to modify it for the sample You posted
www.ibmmainframes.com/viewtopic.php?t=29269&postdays=0&postorder=asc&start=17 |
|
Back to top |
|
|
THINKSRINIII Warnings : 1 New User
Joined: 09 Jan 2009 Posts: 88 Location: India
|
|
|
|
Hi E.S,
Many thanks for that. But, if you were to select an option from the list? what would you do. My instinct seeing the question also was that A.I will not be having a aspecific structure.
Cheers |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Option 3 is the closest to the way non-unique alternate indexes work; the alternate index field is followed by the primary keys that have that particular alternate index value within the record. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
here are the results for the test I ran for You
jcl
Code: |
000001 //ENRICOA JOB (H001),'ZKSDS1',NOTIFY=ENRICO,
000002 // CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
000003 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
000004 //* DSN=ENRICO.MF.JCLLIB(ZKSDS1)
000005 //* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
000006 //*
000007 //AMS EXEC PGM=IDCAMS
000008 //SYSPRINT DD SYSOUT=*
000009 //KSDSDATA DD *
000010 2000 TABLE LEG
000011 2001 BICYCLE WHEEL
000012 2002 BICYCLE SEAT
000013 2003 TABLE TOP
000014 2004 TABLE BRACKETS
000015 //*
000016 //SYSIN DD *
000017 DELETE (ENRICO.MF.KSDS.PATH) PATH PURGE
000018 SET LASTCC=0
000019 DELETE (ENRICO.MF.KSDS.AIX) AIX PURGE
000020 DELETE (ENRICO.MF.KSDS.CL) CLUSTER PURGE
000021 SET LASTCC=0
000022 SET MAXCC=0
000023
000024 DEFINE CLUSTER( -
000025 NAME(ENRICO.MF.KSDS.CL) -
000026 INDEXED KEYS(10 0) -
000027 SHR(2 3) CYL(1 1) VOL(MFVSAM) ) -
000028 DATA( -
000029 RECSZ(80 80) CISZ(4096) FREESPACE(0 0) )
000030
000031 IF MAXCC = 0 THEN -
000032 REPRO INFILE(KSDSDATA) OUTDATASET(ENRICO.MF.KSDS.CL)
000033
000034 IF MAXCC = 0 THEN -
000035 PRINT INDATASET(ENRICO.MF.KSDS.CL) DUMP
000036
000037 IF MAXCC = 0 THEN -
000038 DO
000039 DEFINE AIX( -
000040 NAME(ENRICO.MF.KSDS.AIX) -
000041 RELATE(ENRICO.MF.KSDS.CL) -
000042 KEYS(10 10) -
000043 SHR(2 3) CYL(1 1) VOL(MFVSAM) ) -
000044 DATA( -
000045 RECSZ(10 2048) CISZ(4096) FREESPACE(0 0) )
000046 END
000047
000048 IF MAXCC = 0 THEN -
000049 DO
000050 BLDINDEX INDATASET(ENRICO.MF.KSDS.CL) -
000051 OUTDATASET(ENRICO.MF.KSDS.AIX)
000052 END
000053
000054 IF MAXCC = 0 THEN -
000055 PRINT INDATASET(ENRICO.MF.KSDS.AIX) DUMP
000056
000057 IF MAXCC = 0 THEN -
000058 DO
000059 DEFINE PATH( -
000060 NAME(ENRICO.MF.KSDS.PATH) -
000061 PATHENTRY(ENRICO.MF.KSDS.AIX) )
000062 END
000063
000064 IF MAXCC = 0 THEN -
000065 PRINT INDATASET(ENRICO.MF.KSDS.PATH) DUMP
000066 /*
|
sysout
Code: |
-LISTING OF DATA SET -ENRICO.MF.KSDS.CL
0KEY OF RECORD - F2F0F0F0404040404040
000000 F2F0F0F0 40404040 4040E3C1 C2D3C540 40404040 D3C5C740 40404040 40404040 *2000 TABLE LEG *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 404040400 * *
000040 40404040 40404040 40404040 40404040 * *
0KEY OF RECORD - F2F0F0F1404040404040
000000 F2F0F0F1 40404040 4040C2C9 C3E8C3D3 C5404040 E6C8C5C5 D3404040 40404040 *2001 BICYCLE WHEEL *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0KEY OF RECORD - F2F0F0F2404040404040
000000 F2F0F0F2 40404040 4040C2C9 C3E8C3D3 C5404040 E2C5C1E3 40404040 40404040 *2002 BICYCLE SEAT *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0KEY OF RECORD - F2F0F0F3404040404040
000000 F2F0F0F3 40404040 4040E3C1 C2D3C540 40404040 E3D6D740 40404040 40404040 *2003 TABLE TOP *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0KEY OF RECORD - F2F0F0F4404040404040
000000 F2F0F0F4 40404040 4040E3C1 C2D3C540 40404040 C2D9C1C3 D2C5E3E2 40404040 *2004 TABLE BRACKETS *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0IDC0005I NUMBER OF RECORDS PROCESSED WAS 5
-LISTING OF DATA SET -ENRICO.MF.KSDS.AIX
0KEY OF RECORD - C2C9C3E8C3D3C5404040
000000 010A0002 0AC2C9C3 E8C3D3C5 404040F2 F0F0F140 40404040 40F2F0F0 F2404040 *.....BICYCLE 2001 2002 *
000020 404040 * *
0KEY OF RECORD - E3C1C2D3C54040404040
000000 010A0003 0AE3C1C2 D3C54040 404040F2 F0F0F040 40404040 40F2F0F0 F3404040 *.....TABLE 2000 2003 *
000020 404040F2 F0F0F440 40404040 40 * 2004 *
0IDC0005I NUMBER OF RECORDS PROCESSED WAS 2
-LISTING OF DATA SET -ENRICO.MF.KSDS.PATH
0KEY OF RECORD - C2C9C3E8C3D3C5404040
000000 F2F0F0F1 40404040 4040C2C9 C3E8C3D3 C5404040 E6C8C5C5 D3404040 40404040 *2001 BICYCLE WHEEL *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0KEY OF RECORD - C2C9C3E8C3D3C5404040
000000 F2F0F0F2 40404040 4040C2C9 C3E8C3D3 C5404040 E2C5C1E3 40404040 40404040 *2002 BICYCLE SEAT *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0KEY OF RECORD - E3C1C2D3C54040404040
000000 F2F0F0F0 40404040 4040E3C1 C2D3C540 40404040 D3C5C740 40404040 40404040 *2000 TABLE LEG *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0KEY OF RECORD - E3C1C2D3C54040404040
000000 F2F0F0F3 40404040 4040E3C1 C2D3C540 40404040 E3D6D740 40404040 40404040 *2003 TABLE TOP *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0KEY OF RECORD - E3C1C2D3C54040404040
000000 F2F0F0F4 40404040 4040E3C1 C2D3C540 40404040 C2D9C1C3 D2C5E3E2 40404040 *2004 TABLE BRACKETS *
000020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
000040 40404040 40404040 40404040 40404040 * *
0IDC0005I NUMBER OF RECORDS PROCESSED WAS 5
|
so the right answer to a badly posed question
( incompetent interviewer)
would be ...
3 - for the content of the AIX component
4 - for the order of retrieval using the PATH
as per my test |
|
Back to top |
|
|
|