Routine To Create a HASHFILE
Moderators: chulett, rschirm, roy
Routine To Create a HASHFILE
Hi,
I need to call a Routine in the Before-Job Subroutine to create the hashfile,if it does not exists in the specified path.If exists then dont need to do any thing.
Planning to pass hashfilename as a parameters to the routine.
Only one column need to be in the hashfile with data type Char(100).
need your help on this.
Thanks in Advance
I need to call a Routine in the Before-Job Subroutine to create the hashfile,if it does not exists in the specified path.If exists then dont need to do any thing.
Planning to pass hashfilename as a parameters to the routine.
Only one column need to be in the hashfile with data type Char(100).
need your help on this.
Thanks in Advance
kdpuram
Re: Routine To Create a HASHFILE
please try detele file and create option which is already availableragugct wrote:Hi,
I need to call a Routine in the Before-Job Subroutine to create the hashfile,if it does not exists in the specified path.If exists then dont need to do any thing.
Planning to pass hashfilename as a parameters to the routine.
Only one column need to be in the hashfile with data type Char(100).
need your help on this.
Thanks in Advance
Re: Routine To Create a HASHFILE
please try detele file and create option which is already availableragugct wrote:Hi,
I need to call a Routine in the Before-Job Subroutine to create the hashfile,if it does not exists in the specified path.If exists then dont need to do any thing.
Planning to pass hashfilename as a parameters to the routine.
Only one column need to be in the hashfile with data type Char(100).
need your help on this.
Thanks in Advance
Do search your hashed file in VOC using
if it returns 1 then the Hasehd file is existing else create one using the
may be (using Create table command also) ![Confused :?](./images/smilies/icon_confused.gif)
Code: Select all
SELECT COUNT(*) FROM VOC WHERE TYPE='F' and NAME='Hashedfilename'
Code: Select all
CREATE.FILE filename DYNAMIC
![Confused :?](./images/smilies/icon_confused.gif)
Success consists of getting up just one more time than you fall.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard. :Dragugct wrote:Hi,
I need to call a Routine in the Before-Job Subroutine to create the hashfile,if it does not exists in the specified path.If exists then dont need to do any thing.
Planning to pass hashfilename as a parameters to the routine.
Only one column need to be in the hashfile with data type Char(100).
need your help on this.
Thanks in Advance
Your initial premise ("I need to create a Routine") is false. The Hashed File stage, as others have pointed out, contains all the functionality you require.
I would also counsel against the use of job parameters for file/table names, as it interferes with good metadata management.
To what purpose would you put a hashed file containing a single Char(100) column - which must therefore be the "Key" column? It would not be particularly efficient for lookup - we tend to use trimmed VarChar keys for hashed file lookups. If it's just for storage, why not use a Sequential file, which is much faster to write to?
By the way, it's "hashed" file, not "hash" file or "hashfile".
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.
To create a hash in a specific directory, execute the command:
mkdbfile path/HashFileName 30 1 4 20 50 80 1628
or create a routine:
mkdbfile path/HashFileName 30 1 4 20 50 80 1628
or create a routine:
Code: Select all
Call DSExecute("UNIX","ls ":PathHsh:"HashName", Output, SystemReturnCode)
If SystemReturnCode <> 0 Then
commandUV = "mkdbfile ":PathHsh:"HashName 30 1 4 20 50 80 1628"
Call DSExecute("UNIX", "cd ../../DSEngine/bin;":commandUV, Output, SystemReturnCode)
Ans = 'HashFile create with success'
End
Else
Ans = 'HashFile existent'
End
I don't understand why one would "need" to do this.
Any job that populates the hashed file will automatically create it if it doesn't exist. If the first usage of this hashed file is as a lookup, there is a simple way in the GUI to make sure it gets created if it doesn't already exist - feed it from a transformer (with the proper metadata) with the constraint set to @FALSE.
If you need this for some other reason, let us know. Best to not create a routine to do something that the GUI can already do for you, IMHO. For example, a routine to create a 64bit hashed file would be something that falls into that class.
![Confused :?](./images/smilies/icon_confused.gif)
Any job that populates the hashed file will automatically create it if it doesn't exist. If the first usage of this hashed file is as a lookup, there is a simple way in the GUI to make sure it gets created if it doesn't already exist - feed it from a transformer (with the proper metadata) with the constraint set to @FALSE.
If you need this for some other reason, let us know. Best to not create a routine to do something that the GUI can already do for you, IMHO. For example, a routine to create a 64bit hashed file would be something that falls into that class.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Drop a Transformer next to the Reference Hashed file and link them together. Add a stage variable so the compiler won't complain. Set the constraint to @FALSE so no rows go down the link, as the mere fact it is there will open the hashed file. Make sure your metadata is correct in the link, but the derivations don't matter as they won't be used. I generally set them all to @NULL to drive home the point.
This will run before the main flow and create the hashed file if needed. You can also use it to clear or drop/recreate between runs if you need to do that.
![Wink :wink:](./images/smilies/icon_wink.gif)
This will run before the main flow and create the hashed file if needed. You can also use it to clear or drop/recreate between runs if you need to do that.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers