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.
-
Hi Pallav, Did you see my answer? Is this helpful? Did you try it? – Rajan Kumar Jan 21 '15 at 01:33
-
Yes, But it doesn't works. – Pallav Jan 21 '15 at 05:52
-
Please send the error message and log/trace file in this email : u2askus@rocketsoftware.com – Rajan Kumar Jan 21 '15 at 13:18
4 Answers
Perhaps something like this in the unibasic
OPEN "filename" to FIL ELSE STOP 201,"cannot open filename"
EXECUTE "SELECT filename"
LOOP WHILE READNEXT ID
READ REC FROM FIL,ID ELSE REC = ""
* you now have the entire row in REC
REPEAT

- 1,531
- 11
- 25
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 :

- 718
- 1
- 4
- 9
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.

- 194
- 11
-
I have created a file of type 19 and inserted some value and tried to retrieve all the value using basic subroutine can you suggest me with sample example. Thanks – Pallav Jan 23 '15 at 13:16
-
Hi Pallav, Please send us your subroutine code and .NET Code (C#\VB.NET). We will try to solve this problem. Did you download U2 Toolkit for .NET v2.1.0 Provider? – Rajan Kumar Jan 23 '15 at 15:39
-
Thanks Mike and Rajan for you suggestion i will try hopefully it will work. @RajanKumar I'm not using any VB.NET code – Pallav Jan 27 '15 at 10:15
OPEN '',FILENAME TO F.FILE ELSE STOP
SELECT F.FILE
LOOP
READNEXT K.FILE ELSE EXIT
READ R.FILE FROM F.FILE, K.FILE ELSE NULL
PRINT R.FILE
REPEAT
PRINT "All over Red Rover"
Filename should be in quotes, i.e "MYFILE" or 'MYFILE'
The loop will repeat till all records have been read and will then exit.

- 335
- 3
- 11