Get Max Key From Hashfile
Moderators: chulett, rschirm, roy
Get Max Key From Hashfile
Hi Guys,
I have a design, which pulls Max SUK from Hashfile, and passes to Transformation stage to generate Next Key. Now I want to get rid of these extra stages and processing time, and replace with ROUTINE which can read Max SUK from Hashfile created out Project Area.
If any can help me with Routine code, I would really appreciate.
Thanks
Martin
I have a design, which pulls Max SUK from Hashfile, and passes to Transformation stage to generate Next Key. Now I want to get rid of these extra stages and processing time, and replace with ROUTINE which can read Max SUK from Hashfile created out Project Area.
If any can help me with Routine code, I would really appreciate.
Thanks
Martin
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Trans("hashedfilename", "keyvalue", 1, "X")
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.
Hi Ray,
I tried your code
I got error
DataStage Job 85 Phantom 31381
Program "JOB.1638071665.DT.1386332505.TRANS1": Line 51, Unable to open "/Ascential/Datastage/DEV/Ha_RequestDim" file.
DataStage Phantom Finished
Any Idea
Thanks
Martin
I tried your code
Code: Select all
TRANS("/Ascential/Datastage/DEV/Ha_RequestDim', "REQ_ID", 1, "X")
DataStage Job 85 Phantom 31381
Program "JOB.1638071665.DT.1386332505.TRANS1": Line 51, Unable to open "/Ascential/Datastage/DEV/Ha_RequestDim" file.
DataStage Phantom Finished
Any Idea
Thanks
Martin
Your hashed file is externally pathed. Consider writing a quick function that utilizes the OPENPATH statement to open the hashed file, then a READ statement to read the appropriate row from the hashed file.
Consider also changing the hashed file to a sequential file. I'm sure you are more comfortable reading a line from a text file using a grep statement.
Consider also changing the hashed file to a sequential file. I'm sure you are more comfortable reading a line from a text file using a grep statement.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It must be the name of the hashed file in a Trans() function, not its pathname. You need to create a VOC pointer using SETFILE before the Trans() function will work. You would have determined this had you read the entry for Trans() in the manual.
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.
As per Kcbalnd I am writing to Seq File and capturing Max Key value using Transformation Routine......Its working the way it has to work.
I also tried Ray method and bit confused using .
1. I defined SETFILE <Full Path> in before-Job Subroutine with ExecTCL.
2. Then I used TRANS function in Transformation Derivation
first step gave me error, I know I am doing mistake, Ray i would really appreciate if can help me to understand This Function.
Thanks
Martin[/code]
I also tried Ray method and bit confused using .
Code: Select all
TRANS ( [DICT] filename, record.ID, field#, control.code)
2. Then I used TRANS function in Transformation Derivation
first step gave me error, I know I am doing mistake, Ray i would really appreciate if can help me to understand This Function.
Thanks
Martin[/code]
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
SETFILE pathname VOCname OVERWRITING
TRANS(VOCname, keyvalue, field#, code) opens the hashed file referred to by VOCname, reads the record specified by keyvalue and returns the field whose number is given as field#. The code argument is a single letter that specifies what to do if the record can't be found.
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.