I just want to know that how to retrieve all the record from universe database table using universe basic subroutine.I am new in universe.
Retrieve all records from universe database using universe basic subroutine
2.1k views Asked by Pallav AtThere are 4 answers
There is an article and sample code on GitHub on how to execute U2 UniVerse Subroutine.
These sample code are based on C# (async\await), but you can use for synchronous programming as well with little code tweak.
For article:
Go to this link :
Read ‘Subroutine-Async.docx’ file.
Sample Code for this article on GitHub
Go to this link :
Can you provide more information on what you are trying to do?
Having a subroutine call return the entire contents of a UniVerse file could return a large amount of data. I would expect you would be better off only returning a subset of the items so the calling routine can process a bit at a time.
New content based on comment:
Ok, since you mentioned a type 19 file, I assume you want to read one file from the directory/folder the file points to.
In your subroutine, you can use OPEN on the type 19 file, and use the READ command to read the file. ( Note that you can also use READU, READL, MATREAD, MATREADU, or MATREADL to get the entire file in the directory/folder, depending on if/how you want to lock the item and if you want the data in a dynamic or dimensioned array. If you only need a specific attribute you can then use READV, READVL or READVU commands.
Or, since this is a type 19 file, you can use sequential reads. Open the file with OPENSEQ and read with the READSEQ or READBLK command.
Filename should be in quotes, i.e "MYFILE" or 'MYFILE'
The loop will repeat till all records have been read and will then exit.