I agree with @LinusH assessment.
We use this block of code when running in batch:
/* Create metadata macro variables */
%let IOMServer = %nrquote(SASApp);
%let metaPort = %nrquote(8561);
%let metaServer = %nrquote(yourhost.domain.com);
/* Set metadata options */
options metaport = &metaPort
metaserver = "&metaServer";
options metaserver=&metaserver..domain.com metauser="username@saspw" metapass="encodedpassword";