Consider the following generalization of the classical job-shop scheduling problem in which a set of machines is associated with each operation of a job. The operation can be processed on any of the machines in this set. For each assignment mu of operations to machines let P(mu) be the corresponding job-shop problem and f(mu) be the minimum makespan of P(mu). How to find an assignment which minimizes f(mu)? For problems with two jobs a polynomial algorithm is derived.