So I tried this with entmod and no errors are thrown, however, locked layers cannot be modified by any means AFAIK. You will have to unlock the layer within your code prior to modifying it.
((lambda ( / ss count i ent et)
(if (setq ss (cadr (ssgetfirst)))
(progn
(setq count (sslength ss))
(setq i 0)
(while (< i count)
(setq ent (ssname ss i))
(setq et (entget ent))
(entmod
(subst
'(62 . 7)
(assoc 62 et)
et
)
)
(entupd ent)
(setq i (1+ i))
)
)
)
(princ)
))