Using the “multi” option of proc=

The multi option of proc= is used when doing parallel processing of several data files. If one expects that one or more of the input files used may reach its end of file and need to be rewound to the first record, one should not use the multi option. An example of perfectlyparallel processing would be a case where three data files each having the exact same number of records are being processed simultaneously.

When a proc is started using the multi option, the first record of each open input file is read. If one does not have a choose_file, next sequence somewhere in the proc, no other records will be read.This is in contrast to using “proc=procname on datafile” where a record from the primary file is read in automatically at the start of the proc and each time the end of the proc is reached. Records from other open input files are read using choose_file and next.


The syntax for the multi option of proc= is:

proc=procname multi


When one is reading from more than one input file, and the input files do not have the same number of records in each file, the proc needs to check to see if an end-of-file has been hit in the data file before it attempts to execute a command that requires a case in hand. To see if you have reached the end of file in a particular data file use one of the following:

if datafile^eof_data then ... (with DB's)if datafile!eof_data then ... (without DB's)or: if not datafile^eof_data then ... (with DB's)if not datafile!eof_data then ... (without DB's)


Once you have reached the end of any of the data files, the choose_file “datafile” next sequence has no effect when using proc=multi. If the proc attempts to act on an input file whose end has been reached, an error will be generated.

Example Spec:

~comment&pmul1.doc'' First make some data files. These get refreshed each time the job'' is run.>filetodb pmula.asc #111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111>eof>dbtofile pmula.asc pmula.asc>filetodb pmulb.asc #222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222>eof>dbtofile pmulb.asc pmulb.asc>filetodb pmulc.asc #333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333>eof>dbtofile pmulc.asc pmulc.asc~input pmula.asc id=1.4 ascii=80~output pmula caselength=80 write_now'' ~translate pmula.asc in=1.4 ascii~input pmulb.asc id=1.4 ascii=80~output pmulb caselength=80 write_now'' ~translate pmulb.asc in=1.4 ascii~input pmulc.asc id=1.4 ascii=80~output pmulc caselength=80 write_now'' ~translate pmulc.asc in=1.4 ascii~input pmula number_input_buffers=3 allow_update~input pmulb new_buffer allow_update~input pmulc new_buffer allow_update~defproc=  {proc1:blank pmula![1.5$]blank pmulb![10.5$]blank pmulc![15.5$]}~excproc=proc1 multi'' Get out of multi-file mode.~input~def'' Use this to see what the final data files look like.proc=  {chkdata:say [1.40$]}~input pmula~exc proc=chkdata~input pmulb~exc proc=chkdata~input pmulc~exc proc=chkdata~end