Page 1 of 1

Problem in running a routine

Posted: Fri Jun 29, 2007 7:30 am
by priyadarshikunal
When I am trying to run this routine
it never ends i am unable to find why?
Can any one help me to find out what is the problem?

Code: Select all

i=1
loop until i>10 DO
  if i>10 then exit 
  StageName=FIELD(Stages,",",i)
  if StageName eq "" then exit
  Links= DSGetStageInfo(JobHandle, StageName, DSJ.LINKLIST)

     j=1
     Loop until j>10 DO
      if j>10 then exit

      LinkName=FIELD(Links,",",j)
      if LinkName eq "" then exit

      RowCount= DSGetLinkInfo (JobHandle, StageName, LinkName,DSJ.LINKROWCOUNT)

      ReportText =  JobName:",":JobStarted:",":JobEnded:",":JobStatus:",":StageName:",":LinkName:",":RowCount:"\n"
      GlobalReport = GlobalReport:Char(10):ReportText
        
  Repeat
Repeat 

     

Thanks in advance

Posted: Fri Jun 29, 2007 7:36 am
by chulett
First, explain what you understand the routine to be doing, what arguments it requires and how/where exactly you are 'running' it.

Posted: Fri Jun 29, 2007 7:39 am
by DSguru2B
You are running two loops (i and j). You initialize them but never increment them. The condition (i>10) and (j>10) is never true and hence an infinite loop.

Posted: Fri Jun 29, 2007 7:53 am
by priyadarshikunal
DSguru2B wrote:You are running two loops (i and j). You initialize them but never increment them. The condition (i>10) and (j>10) is never true and hence an infinite loop.
Thanks DSguru2B Its working fine now;
can you tell me how to append that file while running next job?

Posted: Fri Jun 29, 2007 8:36 am
by chulett
DSguru2B wrote:You are running two loops (i and j). <snip>
Fine and dandy. Still don't think it is appropriate to just post a chunk of code and say "It doesn't work, please fix it for me" without something in the way of documentation or an explanation. Even if the answer is obvious, the OP needs to have some skin in the game. IMHO, of course.

Posted: Fri Jun 29, 2007 8:45 am
by DSguru2B
Refer to the BASIC manuals on how to open a file in BASIC which will bring the pointer to the end of file. Hence when you write again, it will get appended. You should really re-think your approach as , if you call this routine after each job and say you have 50 jobs, this one file can get really huge.

Posted: Fri Jun 29, 2007 8:51 am
by priyadarshikunal
chulett wrote:
DSguru2B wrote:You are running two loops (i and j). <snip>
Fine and dandy. Still don't think it is appropriate to just post a chunk of code and say "It doesn't work, please fix it for me" without something in the way of documentation or an explanation. Even if the answer is obvious, the OP needs to have some skin in the game. IMHO, of course.
I am sorry for not sending the proper documentation;

Actually the two arguments were
Arg1="directory path;filename"
Arg2="JobName"

that was a silly mistake but i was looking on it for its other aspects
that made me more confused

sorry once again chulett

Posted: Fri Jun 29, 2007 8:57 am
by priyadarshikunal
and one more thing i am calling it in job sequence after a job to get statistics of that job

Posted: Fri Jun 29, 2007 9:00 am
by chulett
If you mean append to an existing file in your routine, SEEK is what you seek. It's not a "how to open the file" kind of thing, but something you do just after opening it before you start writing.

Posted: Fri Jun 29, 2007 9:09 am
by DSguru2B
Craig is right, as always :wink: .
Read about SEEK in the BASIC guide for a better understanding of what it does and how to use it.

Posted: Fri Jun 29, 2007 9:24 am
by priyadarshikunal
DSguru2B wrote:Refer to the BASIC manuals on how to open a file in BASIC which will bring the pointer to the end of file. Hence when you write again, it will get appended. You should really re-think your approach as , if you call this routine after each job and say you have 50 jobs, this one file can get really huge.

actually i wanted it to have details of the jobs to achive a single task

like we have 2 to 3 jobs for one task i wanted it to extend it so that to make some condition check easy

i am also thinking to expand it for a sequence so that to get statistics of jobs (2-3 jobs inside a sub-sequence)


thanks and regards