With a 30v input and the output shorted with 5A current, power dissipation in the regulator will be 150 Watts.
With the LM138 TO-3 case (K suffix package) your thermal resistance will be 1°C per Watt of power dissipation.
The maximum temperature limit for the TO-3 package is 150°C.
So, if you had the regulator frozen into a block of ice that would stay frozen under all conditions, thus maintaining the regulator's case (package) at 0°C, the regulator power dissipation would be at it's maximum limit when dissipating 150 Watts.
If you used the T suffix LM338 (TO-220 package) the thermal resistance is 4°C per Watt, and the maximum temperature is 125°C. This means that if you could maintain the package at 0°C, the dissipation limit would be 31.25 Watts, or at 30v input with the output shorted, slightly over 1A.