Reading a file by a superdescriptor

Hi,
Is there any way of using only a part of the super descriptor in a read stmt.
The ADABAS file has a superdescriptor

01 SP-KEY (A12)
02 A1 (B2)
02 A2 (B2)
02 A3 (A8)

I am not able to use
Read FILE1 BY A2

I’m getting an error “field not a descriptor”

Can I use something like

Read FILE1 by SP-KEY(A2)

Can some one help me on this

Set the latter part of the FROM value to spaces (or low values) and the latter part of the TO value to Zs (or high values).

DEFINE DATA LOCAL  
1 EMP    VIEW EMPLOYEES  
  2 DEPT-PERSON  
*  
1 #FROM (A26)      1 REDEFINE #FROM  
  2 #DEPT (A6)  
1 #TO (A26)        INIT FULL LENGTH {H'FF'}     /* should be < > 
                   1 REDEFINE #TO  
  2 #DEPT (A6)  
END-DEFINE  
*  
ASSIGN #FROM.#DEPT = #TO.#DEPT  
                   = 'TECH03'  
READ EMP BY DEPT-PERSON FROM #FROM  
                          TO #TO  
  DISPLAY DEPT-PERSON (EM=XXXXXX^X(20))  
END-READ  
END

Here’e the output:



        DEPT-PERSON
---------------------------

TECH03 BLAISE
TECH03 BOUCLY
TECH03 CANALE

ps I couldn’t get the INIT clause to display properly in the CODE window, hence the braces {}.

[quote=“Ralph Zbrog”]
Set the latter part of the FROM value to spaces (or low values) and the latter part of the TO value to Zs (or high values).

DEFINE DATA LOCAL  
1 EMP    VIEW EMPLOYEES  
  2 DEPT-PERSON  
*  
1 #FROM (A26)      1 REDEFINE #FROM  
  2 #DEPT (A6)  
1 #TO (A26)        INIT FULL LENGTH {H'FF'}     /* should be < > 
                   1 REDEFINE #TO  
  2 #DEPT (A6)  
END-DEFINE  
*  
ASSIGN #FROM.#DEPT = #TO.#DEPT  
                   = 'TECH03'  
READ EMP BY DEPT-PERSON FROM #FROM  
                          TO #TO  
  DISPLAY DEPT-PERSON (EM=XXXXXX^X(20))  
END-READ  
END

Thanks for the code,But my problem is #dept can have many values…
it does not contain a single value … In such a case I’ll have to change the value of #dept everytime which will be a bit tedious.If you can suggest another way out it would be much helpful.Thanks once again

Can you make A2 into a descriptor (or add a new super)? A superdescriptor is a single compound index, not multiple indexes, so you can’t really search by only a sub-component of a superdescriptor.

I cant do that. Probably I’ll have to ask the admins for it.
Thanks Kelly.

You can specify different values for the FROM and TO department fields.

ASSIGN #FROM.#DEPT = 'TECH03'
ASSIGN #TO.#DEPT   = 'TECH04'