Reading Hash file from within a DS routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kasgang
Premium Member
Premium Member
Posts: 9
Joined: Wed Oct 18, 2006 8:18 am

Reading Hash file from within a DS routine

Post by kasgang »

Hi

I have stored some prcalculated values within a Hash file. Now I want to use the values from the Hash file from within a routine.
Is there any way I can do it? Thanks to all in advance
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The commands you need to do this are in the BASIC Programmer's Guide and are OPEN, READ and CLOSE.

Example code:

Code: Select all

   OPEN '','MyHashedFileName' TO WorkFilePtr ELSE CALL DSLogFatal('Unable to open MyHashedFileName, status is "':STATUS():'".','')
   READ MyRecord FROM WorkFilePtr, "HashedFileKey"
   THEN
      {parse the MyRecord data and process as you wish}
   END
   ELSE
      CALL DSLogWarn('Record "HashedFileKey" not present in file.','')
   END
   CLOSE WorkFilePtr
kasgang
Premium Member
Premium Member
Posts: 9
Joined: Wed Oct 18, 2006 8:18 am

Post by kasgang »

Thanks a ton ...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can also use the Trans() function - also in the DataStage BASIC manual. This may be easier if there is only a single record that needs to be accessed by the routine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply