DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
igorbmartins
Participant



Joined: 17 Mar 2008
Posts: 161

Points: 2183

Post Posted: Mon Sep 26, 2016 10:24 am Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Parallel
OS: Unix
Hello, anyone knows how to read hashed file in basic? I know how to read text file, but not hashed. Let me be more specific. I need to create a job control to read some columns from a hashed file and create a sequential file.

Example to read sequential files .
OpenSeq FULLFILE To FileLog
Else
Call DSLogFatal("--> fail to open the file ": FULLFILE,"LOG")
End

Loop
ReadSeq LineLog From FileLog
On Error
Call DSLogFatal("--> fail to open the file: ": FULLFILE,"LOG")
End
Then
DSLogInfo("--> Linelog: ": LineLog,"LOG")
End
Else Exit
Repeat
CloseSeq FileLog

I found a post with this command but I didn’t understand.
Open "SDKSequences" to SDK else stop
HashedKey = "Whatever"
read HashedRec from SDK, HashedKey then
* comment do something here
end else
* do something else here
end
Field1 = HashedRec<1>
* change HashedRec
write HashedRec on SDK, HashedKey
close SDK

Thanks.
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54070
Location: Sydney, Australia
Points: 293276

Post Posted: Mon Sep 26, 2016 4:46 pm Reply with quote    Back to top    

A hashed file must be opened: with an OPEN statement if there exists a VOC entry for the hashed file with an OPENPATH statement if there is no VOC entry for the hashed file Every record in a has ...

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne
Rate this response:  
Not yet rated
asorrell
Site Admin

Group memberships:
Premium Members, DSXchange Team, Inner Circle, Server to Parallel Transition Group

Joined: 04 Apr 2003
Posts: 1637
Location: Colleyville, Texas
Points: 22256

Post Posted: Mon Sep 26, 2016 7:32 pm Reply with quote    Back to top    

Just in case you need a manual for BASIC:

IBM InfoSphere DataStage BASIC Reference Guide
Version 11 Release 3

http://publibfp.boulder.ibm.com/epubs/pdf/c1942790.pdf

_________________
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2017
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42273
Location: Denver, CO
Points: 217068

Post Posted: Mon Sep 26, 2016 9:25 pm Reply with quote    Back to top    

Or, on the off chance it doesn't really need to be done in BASIC - create a little Server job to do that. Wink

_________________
-craig

Watch out where the huskies go and don't you eat that yellow snow
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54070
Location: Sydney, Australia
Points: 293276

Post Posted: Mon Sep 26, 2016 10:25 pm Reply with quote    Back to top    

The OP states a requirement to do this within "a job control".

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54070
Location: Sydney, Australia
Points: 293276

Post Posted: Mon Sep 26, 2016 10:27 pm Reply with quote    Back to top    

Another approach would be to query the hashed file using DataStage SQL (or RetrieVe) and direct the output into the required text file via either the DIVERT.OUT, the COMO, or the LPTR mechanism.

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42273
Location: Denver, CO
Points: 217068

Post Posted: Mon Sep 26, 2016 10:32 pm Reply with quote    Back to top    

ray.wurlod wrote: The OP states a requirement to do this within "a job control". Of course but we all know how ephemeral these "needs" can be at times, hence my phrasing. And "job control" i ...

_________________
-craig

Watch out where the huskies go and don't you eat that yellow snow
Rate this response:  
Not yet rated
ArndW

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup

Joined: 16 Nov 2004
Posts: 16257
Location: Germany
Points: 92175

Post Posted: Tue Sep 27, 2016 2:41 am Reply with quote    Back to top    

Here's a simple example: Code: OPEN '','VOC' TO VOCFilePtr ELSE STOP 'Unable to open VOC' SELECT VOCFilePtr TO 1 READNEXT Key FROM 1 ELSE Key = '' LOOP UNTIL Key=''   &nbs ...

_________________

Image
Rate this response:  
Not yet rated
igorbmartins
Participant



Joined: 17 Mar 2008
Posts: 161

Points: 2183

Post Posted: Tue Sep 27, 2016 5:20 am Reply with quote    Back to top    

Thank you everybody. I will check all alternatives and I will post here the results.
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42273
Location: Denver, CO
Points: 217068

Post Posted: Tue Sep 27, 2016 6:54 am Reply with quote    Back to top    

Keep in mind the facts that Ray noted, Arnd's code needs a VOC entry to work. Meaning the hashed file needs to either live in a project or you've created one for it manually. If you've pathed the hash ...

_________________
-craig

Watch out where the huskies go and don't you eat that yellow snow
Rate this response:  
Not yet rated
ray.wurlod

Premium Poster
Participant

Group memberships:
Premium Members, Inner Circle, Australia Usergroup, Server to Parallel Transition Group

Joined: 23 Oct 2002
Posts: 54070
Location: Sydney, Australia
Points: 293276

Post Posted: Tue Sep 27, 2016 5:42 pm Reply with quote    Back to top    

So your overall strategy has to include opening the hashed file, opening the sequential file, establishing a Select List on the hashed file, using a loop to process the records from the hashed file, f ...

_________________
RXP Services Ltd
Melbourne | Canberra | Sydney | Hong Kong | Hobart | Brisbane
currently hiring: Canberra, Sydney and Melbourne
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours