Loccode: A code which determines which print server will finally send a job to the printer. Every printer belongs to one and only one loccode. Each loccode is assigned to one and only one print server. Each loccode can be a member of one or more sgroups.
Sgroup: Determines which Samba pseudo-server is associated with which loccode and, therefore, which printers. Each sgroup can contain multiple loccodes. This somewhat complex arrangement allows for flexibility when splitting up printer groups or joining them together.
The best way to understand this is by an example (see Figure 3). Take two offices in Texas: one in Dallas and one in Houston. Among these two offices we have three printers: happy, dopey and grumpy. happy and dopey are in Houston; grumpy is in Dallas. We have two print servers, legolas and gollum in Houston and Dallas respectively, providing services for four PCs and a UNIX server in Dallas.
We set up two loccodes, one for each office, naming them HOUSTON and DALLAS. We put happy and dopey into the first loccode and grumpy into the second. We assigned loccode HOUSTON to the print server legolas and loccode DALLAS to the print server gollum.
For the UNIX machine, our job is now done. The closest print server to send the jobs to is gollum, in this case. If the job is for a printer not on gollum, it will be forwarded by LPR to the correct server (see the jobs to happy in the figure).
For the PCs, we set up two sgroups HOUSTON and DALLAS and an additional one which matches the whole of Texas: TEXAS. We associate the pseudo-server names: print-houston, print-dallas and print-texas with these sgroups respectively. We then associate print-houston and print-texas with the print server legolas (using WINS) and associate print-dallas with the print server gollum.
We set loccode HOUSTON (along with its printers, happy and dopey) to be a member of sgroups HOUSTON and TEXAS. In the same way, we set loccode DALLAS (along with its printer, grumpy) to be a member of sgroups DALLAS and TEXAS.
Because Samba will behave differently according to how the PC refers to it, when the PCs browse print-houston, they will be talking to legolas and will see the printers, happy and dopey. When they browse print-dallas, they will be talking to gollum and will see the printer grumpy. If they browse print-texas, they will be talking to legolas and will see all three printers.
Samba accepts the print jobs from the PCs and sends them straight to the LPR system. The LPR system, in turn, will either send them straight to the printer in the case of PC1, PC2 or PC4. In the case of PC3, the LPR system on legolas will forward the jobs to gollum for printing in the same way that the UNIX jobs are forwarded.