Hi Sathya,

Clearly, in basic, if you know the unique-key of a record, you don't need to 
select it to access its data. 

Do it like this :

OPEN FILE.NAME TO F.FILE.NAME ELSE ... error
...
KEYVALUE = ....
READ V.RECORD FROM F.FILE.NAME, KEYVALUE THEN
        * OK RECORD EXIST ; V.RECORD IS LOADED WITH DATA
END ELSE
        * KO RECORD DOESN'T EXIST ! V.RECORD IS NOT MODIFIED
        V.RECORD = ''
END

Do what you need with V.RECORD

----------------------------------------------

Now if the value you have is not the unique-key ; you need to execute a select.
Do like this :
OPEN FILE.NAME TO F.FILE.NAME ELSE ... error
...
DATAVALUE =. ..
EXECUTE 'SELECT FILE.NAME WITH FIELD.NAME = "':DATAVALUE:'"' RTNLIST LIST1
LOOP WHILE READNEXT KEYVALUE DO 
        READ V.RECORD FROM F.FILE.NAME,KEYVALUE THEN
                * OK RECORD EXIST
        END ELSE
                * KO RECORD DOEN'T EXIST
                CONTINUE ;* GOTO NEXT READNEXT
        END
        Do what you need with V.RECORD
REPEAT

----------------------------
By extension, You can create index à "secondary-key" declaration like this :
At TCL,do like this (with users logged out)
>CREATE.INDEX FILE.NAME FIELD.NAME NO.NULLS
>BUILD.INDEX FILE.NAME FIELD.NAME
If exist, Universe "SELECT" use automatically the "index" system

---------
I hope this help.
Manu
> -----Message d'origine-----
> De : [email protected] [mailto:u2-users-
> [email protected]] De la part de Sathya
> Envoyé : mercredi 15 mai 2013 13:19
> À : [email protected]
> Objet : Re: [U2] select query..
> 
> Manu Fernandes <efv <at> infodata.lu> writes:
> 
> 
> >
> > Hi
> >
> > Do you have wildcard characters like [] into KEYVALUE ?
> > If not, why do you SELECT ; it's the key of file.name ; you can read
> directly !
> >
> > Elsewhere, For performance, set a index on the  <at> id
> >
> > Why do you want to use save-list/get-list ?
> > You can work on LIST1 directly !
> >
> > manu
> 
> 
> Hi Fernandes,
> 
> Thanks for your comments. But as Im new to this technology Im not sure how
> to proceed with your suggestions.
> 
> Can u please be more specific on this approach?
> 
> There is no [] symbols in the KEYVALUE. How do I check whether @ID is
> indexed?
> 
> I will modify it with using LIST1 directly.
> 
> Thanks & Regards,
> Sathya V.
> 
> 
> 
> 
> Hi Experts..
> 
> I have one issue here with fetching data from the file.
> 
> EXECLINE = "SELECT FILE.NAME WITH  <at> ID = \":KEYVALUE:"\"
> DISPLAY EXECLINE
> EXECUTE EXECLINE RTNLIST LIST1
> EXECUTE 'SAVE-LIST SOME.LIST' PASSLIST LIST1
> 
> LIST.NAME = "GET-LIST SOME.LIST"
> sellist = ''
> EXECUTE LIST.NAME RTNLIST sellist CAPTURING junk
> 
> Here Im running a loop for a set of "KEYVALUE"s and for each run the
> SSELECT
> statement is taking around 30 seconds. When I want to run 1000 loops,
> ideally
> the run time will be much.
> 
> Is there any easier way to do this with less time consumption.
> 
> Thanks & Regards,
> Sathya V.
> 
> _______________________________________________
> ://listserver.u2ug.org/mailman/listinfo/u2-users
> >
> > _______________________________________________
> > U2-Users mailing list
> > U2-Users <at> listserver.u2ug.org
> > http://listserver.u2ug.org/mailman/listinfo/u2-users
> >
> >
> 
> 
> 
> 
> _______________________________________________
> U2-Users mailing list
> [email protected]
> http://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to