IRC 269A clearly states that a personal service corporations (PSC) formed or availed of to avoid or evade income tax by reducing the income of, or securing the benefit of any expense, deduction, credit, exclusion, or other allowance for, any employee-owner which would not otherwise be available, then the Secretary may allocate all income, deductions, credits, exclusions, and other allowances between such personal service corporation and its employee-owners, if such allocation is necessary to prevent avoidance or evasion of Federal income tax or clearly to reflect the income of the personal service corporation or any of its employee-owners. So yes it is a violation of the tax code as I understand it to elect to be an S-Corp simply in an effort to recognize losses on a PSC that is no longer operational. You either loose those losses or you figure out a way for the PSC to make $$ to offset losses. However there is no language in IRC 1362 prohibiting a viable ongoing PSC from filing IRS Form 2553 Election by a Small Business Corporation .
IRC 1362 address the election; revocation and; termination of Sub-chapter S status. In general a small business corporation may elect, in accordance with the provisions of this section, to be an S corporation if all shareholders consent to the election and the election is timely made and the entity is not listed as an ineligible corporation (bank, insurance company, 'possession corporation', or a domestic international sales corporation).