common macro for record mapping