On 9 Nov 2003 at 16:39, Arnould Nazarian wrote:

> 4. Multiple input files
> (Tested with QPC 2.03 + SMSQ/E 2.99 and smsq_gold 2.98)
> HOWEVER the following test filter doesn't work _with files_:
> 
> 10 REPeat
> 20  BGET#0,a:BGET#1,b
> 30  BPUT#2,a:BPUT#2,b
> 40 END REPeat
> 
> and then "EX test_bas,input_file1,input_file2,output_file"
> doesn't do anything. If working _from files_: the length of input_file2 
> is set to 0 and output_file is created but also with a length of 0.

For the ex (ew, et) command, if the job to be executed is not a special job,
then the first file is an input channel, all the others are output (!) channels, opened
with the overwrite key.

So it is normal that this doesn't work.


> However (again) if working _from channels_ then it seems OK (?!), eg:
> 
> OPEN_IN#3,input_file1
> OPEN_IN#4,input_file2
> EX test_bas,#3,#4,output_file
> CLOSE#3
> CLOSE#4
> does work !

Yes, that's normal.

> I wonder if this is a bug or even if it is not allowed.

Not allowed
> Indeed in the 
> litterature (mainly Jochen at beginning of 1999) those filters only use 
> one input channel and one output channel and that's it.
I don't have the manual for the EW, EX  and ET commands, but looking at the code 
that's what happens.


> OTOH the SMSQ/E manual states that the channels defined in the filter 
> are linked in sequence to the files or channels list given as parameters 
> when the filter is EXeced.
> 
> Remarks
> 
> With one of my filters I would like 2 input files and up to 11 output files.
> 
> I can live with that behavior (bug?) but then my filters must have the 
> file names hard coded (current solution) or I must OPEN (and then CLOSE) 
> input channels or a file input routine must be added (not tested yet!).

Well, at one stage or another, the filename have to be given, hard coded in the EW 
command...

I could suggest the following procedure:

DEFine PROCedure do_ew (file$,arr$,command$)
LOCal lp%,count%,chans%(1),cmdchan%,res$,temp$
  temp$='ram1_something_temporaray'
  count%=DIMN(arr$,1)                               : REMark nbr of elemnts in array
  DIM chans%(count%)
  res$="ew "&file$                             : rem you MUST use EW!!!!!
  FOR lp%=0 TO count%-1
    res$=res$&",#chans%("&lp%&")"
    chans%(lp%)=FOP_IN(arr$(lp%))               : rem make command line & open 
channels
  END FOR lp%
  res$=res$&",#chans%("&count%&")"
  chans%(count%)=FOP_OVER(arr$(count%))   : rem the output channel
  IF command$<>"":res$=res$&";"&command$   : rem add possible command string
  cmdchan%=FOP_OVER(temp$)
  PRINT#cmdchan%,res$                       : rem print out the entire command
  CLOSE#cmdchan%
  DO temp$                                          : rem exec command line
  FOR lp%=0 TO count%:CLOSE#chans%(lp%)             : REMark use EW in command, 
else this will close channels too early
END DEFine do_ew

which you could then use with a procedure such as:

DEFine PROCedure p
  LOCal array$(2,40)
  array$(0)='ram1_file0':array$(1)='ram1_file1':array$(2)='ram1_file2'
  do_ew "dev1_basic_filtertest_bas",array$,""
END DEFine p
:
you could amend that procedure for each case

I hope this helps

Wolfgang


Reply via email to