-1

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.

Pallav
  • 1
  • 3

4 Answers4

1

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
Symeon Breen
  • 1,531
  • 11
  • 25
0

There is an article and sample code on GitHub on how to execute U2 UniVerse Subroutine.

Execute Rocket MV U2 Subroutine Asynchronously using C# (async\await) and U2 Toolkit for .NET. Convert Subroutine Multi-Value Output to Json/Objects/DataTable

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 :

https://github.com/RocketSoftware/multivalue-lab/tree/master/U2/Demos/U2-Toolkit/AsyncAwait/Execute_Subroutine_Async

Read ‘Subroutine-Async.docx’ file.

Sample Code for this article on GitHub

Go to this link :

https://github.com/RocketSoftware/multivalue-lab/tree/master/U2/Demos/U2-Toolkit/AsyncAwait/Execute_Subroutine_Async

Rajan Kumar
  • 718
  • 1
  • 4
  • 9
0

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.

Mike
  • 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
0
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.

ScaryMinds
  • 335
  • 3
  • 11