Re: Using string values as var names in 4GL
Posted in 1997
Ian Boyes wrote: > > Hi > > I would like to use a string to store the names of record fields in > 4gl and then use the field later to reference the field. Is there any > way in 4GL of doing that > > eg > > define Lstring char(30) > > let Lstring = "VariableName" > > display RecordName.Lstring > > Thanks for any help > Ian Boyes No, there isn't a way of doing that because 4GL is compiled to either C or p-code. And you can't get at any pointers. The best you can do is to create a pseudo-record which consists of a big string. You define positions within that string to represent the record members. Numbers and dates have to be converted to some text representation with the USING operator. You could also use an array of strings. Having said that, why do you want to do this? It sounds suspiciously close to self-modifying code. Is there another way? Perhaps by copying data? I you really need this perhaps you need ESQL/C but that's a lot slower to write than using 4GL. You can combine 4GL and ESQL/C modules. Peter -- Peter Lancashire Mail: Peter.Lancashire.PL1@bayer.co.uk Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 All opinions are my own and not those of Bayer plc.