How to loop after I open a hash file with openpath

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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

etldw

You need to explain how you are trying to do this because readnext id does work if you do it properly. Are you doing this in a routine? Your code should look something like this:

openpath "/.../FILE' to fileptr else stop
select fileptr
loop while readnext id
some code here.
repeat

or maybe:

openpath "/.../FILE' to fileptr else stop
openpath "/.../FILE2' to fileptr2 else stop
select fileptr
loop while readnext id
read rec1 from fileptr, id then
read rec2 from fileptr2, id then
if rec rec2 then
print id:' not the same'
end
end else
print id:' not in file2'
end
end
repeat


Kim Duke
DwNav - ETL Navigator
www.Duke-Consulting.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You may prefer to assemble a log entry and use DSLogInfo() to put it into the log, rather than the PRINT statement. Otherwise you have to go rummaging around on the server, in the &PH& directory, to find the output of the PRINT statements.
The PRINT statements in Kim's post do serve to illustrate the point, however.

Ray Wurlod
Education and Consulting Services
ABN 57 092 448 518
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Ray

I in no way am suggesting he read from &PH& or use real print statements. I am assuming he will put whatever logic into this process to intelligently return a result which says that the two files are different. If this is in a routine then maybe a flag which says the files are not the same and maybe where they differ.

Thanks Kim.

Kim Duke
DwNav - ETL Navigator
www.Duke-Consulting.com
Post Reply