Hi
Does everybody have an example of a DS routine that create and insert data into a hash table?
thanks, Cecilia
Insert into Hash table from a Routine
Moderators: chulett, rschirm, roy
Re: Insert into Hash table from a Routine
viewtopic.php?t=86342&highlight=write+cache+defer
take a look at the above code. Ray has posted some code for creating HASH FILE from DS BASIC.
GOOD Luck !!
take a look at the above code. Ray has posted some code for creating HASH FILE from DS BASIC.
GOOD Luck !!
Re: Insert into Hash table from a Routine
Thanks. I looked at that code yesterday, but I'm not sure if I have to use WRITE statement in order to insert data as in any table, or I have to take some considerations for hash tables.
I can handle it as any table?
I looked at UtiliyHashLookup routine for getting some ideas
Regards, Cecilia
I can handle it as any table?
I looked at UtiliyHashLookup routine for getting some ideas
Regards, Cecilia
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can create the hashed file as indicated, or you can use a CREATE TABLE command called via DSExecute. For example:
... and, of course, check (via ReturnCode) that it succeeded!
You can use the WRITE statement, which is a destructive overwrite of the record whose key value you provide in the WRITE statement.
You can also use a regular INSERT command, called via DSExecute subroutine. This may be more comfortable, though the string manipulation you need (similar to that for the earlier example) may be initially off-putting. Remember, too, that "UniVerse" commands tend to be case sensitive.
Code: Select all
Stmt = "CREATE TABLE MyTable ("
Stmt := " key INTEGER NOT NULL DEFAULT NEXT AVAILABLE,"
Stmt := " col1 VARCHAR, "
Stmt := " PRIMARY KEY (key));"
Call DSExecute("UV", Stmt, Output, ReturnCode)
You can use the WRITE statement, which is a destructive overwrite of the record whose key value you provide in the WRITE statement.
You can also use a regular INSERT command, called via DSExecute subroutine. This may be more comfortable, though the string manipulation you need (similar to that for the earlier example) may be initially off-putting. Remember, too, that "UniVerse" commands tend to be case sensitive.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Thanks Ray
I still have a question. The creation worked fine when I logged as DataStage administrator, but in other case DataStage/SQL: "FOCUS\cmachado" is not an SQL user is the return message.
How could I sign the user to DSExecute or what permission (less than administrator, of course) I have to give to cmachado in other to be able of create the table?
Thanks again, Cecilia
I still have a question. The creation worked fine when I logged as DataStage administrator, but in other case DataStage/SQL: "FOCUS\cmachado" is not an SQL user is the return message.
How could I sign the user to DSExecute or what permission (less than administrator, of course) I have to give to cmachado in other to be able of create the table?
Thanks again, Cecilia
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
As the Administrator (a user with DBA privilege), either from the client window in Administrator client or via a telnet session to the project:
You may be able to get by without granting the table privileges. Try just the grant of CONNECT privilege first; that may be sufficient.
What I'm thinking here is that the default privileges on a UV table are all privileges to all users, unless specific privileges are granted.
Code: Select all
GRANT CONNECT TO cmachado;
GRANT SELECT,INSERT,UPDATE,DELETE ON tablename TO cmachado;
GRANT CONNECT TO FOCUS\cmachado;
GRANT SELECT,INSERT,UPDATE,DELETE ON tablename TO FOCUS\cmachado;
What I'm thinking here is that the default privileges on a UV table are all privileges to all users, unless specific privileges are granted.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.