A new ban preventing train drivers from working while under the influence of alcohol will come into force within a month.