In the last example, you are close, but you need some more commas, because the tilde takes four arguments less , and pad char is the fourth argument, but you pass it as the second. Just pass it as fourth:
CL-USER> (format nil "~12,,,'0@<~d~>" 27)
"270000000000"
, , , . , . , , . , , - 0. , . 000027 ( ) 27, , 000027 (, , ), . 270000, , , 0