 During the War of 1812, he served as a brigadier general of militia.Mattocks was elected to the Seventeenth Congress (March 4, 1821 – March 3, 1823).He was elected to the Nineteenth Congress (March 4, 1825 – March 3, 1827); and served as chairman of the U.S. House Committee on Expenditures in the Department of War (Nineteenth Congress).