
912 N.E.2d 1288 (2009)
David MORRIS, James Riden, Ronald Talley, Arthur Gillispie, Kenneth Childers, Trustees of the Harrisburg Police Pension Fund, Plaintiffs-Appellees,
v.
Richard HARPER, City Treasurer, Defendant-Appellant.
No. 5-08-0352.
Appellate Court of Illinois, Fifth District.
September 8, 2009.
*1289 Don E. Prosser, Gilbert, Huffman, Prosser, Hewson & Barke, Ltd., Carbondale, IL, for Appellant.
Dennis J. Orsey, Dennis J. Orsey, P.C., Granite City, IL, for Appellees.
Justice SPOMER delivered the opinion of the court:
The defendant, Richard Harper, treasurer for the City of Harrisburg, Illinois (treasurer), appeals the June 9, 2008, order for mandamus entered by the circuit court of Saline County and requested by the plaintiffs, David Morris, James Riden, Ronald Talley, Arthur Gillispie, and Kenneth Childers, trustees of the Harrisburg Police Pension Fund (trustees). The order for mandamus required the treasurer to pay police pension benefits to certain beneficiaries based on the amounts determined by the trustees at the time of each beneficiary's retirement and to pay the beneficiaries the difference between the pension benefit that was actually paid and the pension benefit that should have been paid. For the following reasons, we affirm the order of the circuit court.

FACTS
On November 15, 2007, the trustees filed a complaint for mandamus against the treasurer, alleging that the treasurer had refused to pay four retirees the required retirement benefits as the trustees directed. On April 22, 2008, the trustees filed a memorandum of law containing the facts the parties agreed to through their pleadings. Both the trustees and the treasurer agreed on the amounts the trustees approved as the original monthly pensions of the four retirees in question. They also agreed that the treasurer believed that the original monthly pensions should have been lower, based on an audit by the Illinois Department of Financial and Professional Regulation, Division of Insurance (Department), dated February 26, 2004.
On May 28, 2008, the treasurer filed his memorandum of law and attached the Department's audit. The audit concluded that the original pension determinations mistakenly included in the beneficiaries' salaries a $6,000 retirement incentive and, in one case, a clothing allowance, resulting in greater payments to those beneficiaries than their actual salaries justified. The treasurer also attached his letter, dated January 18, 2007, to the trustees, in which he pointed out the mistake, recommended that the trustees change the benefits to comply with the audit, and requested direction. In the memorandum's additional proposed statement of facts, the treasurer stated that when he received no response *1290 to his letter, he adjusted the pension payments to reflect the conclusion of the Department's audit.
On June 9, 2008, based on the memoranda of law and filed documents, the trial court granted the order for mandamus and directed the treasurer to pay the beneficiaries the monthly benefit based on the trustees' original determination, not on the amounts stated in the audit. The court found that the treasurer did not have unilateral authority to change the pension benefits. On June 23, 2008, the trustees filed additional documents to be added to the record, including minutes of the Harrisburg Police Pension Board showing that the trustees advised the treasurer to pay the benefits according to the original calculations, not according to the audit. On July 2, 2008, the treasurer filed a timely notice of appeal.

ANALYSIS
"[A] writ of mandamus commands a public officer to perform an official, nondiscretionary duty that the petitioner is entitled to have performed and that the officer has failed to perform." Chicago Bar Ass'n v. Illinois State Board of Elections, 161 Ill.2d 502, 507, 204 Ill. Dec. 301, 641 N.E.2d 525 (1994). It is undisputed that the treasurer is a public officer. Accordingly, the order for mandamus against the treasurer was appropriate if (1) paying the pension amounts as authorized by the trustees is his official, nondiscretionary duty, (2) the trustees are entitled to have the pension paid as they determined it, and (3) the treasurer failed to perform as required. We shall address each of these questions in turn.
First, mandamus is used to compel an action that is "purely ministerial * * * where no exercise of discretion is involved." People ex rel. Baker v. Cowlin, 154 Ill.2d 193, 196, 180 Ill.Dec. 738, 607 N.E.2d 1251 (1992) (mandamus was appropriate to compel the circuit court to impose prison time on defendants convicted of delivering more than five grams of cocaine because the sentencing provisions were mandatory, not left to the court's discretion). In contrast, mandamus is not appropriate to compel an action over which the public body has discretion. See, e.g., Newsome v. Prison Review Board, 333 Ill.App.3d 917, 920, 921, 267 Ill.Dec. 188, 776 N.E.2d 325 (2002) ("Because the decision not to interview the three inmate witnesses was a matter resting in the discretion of the adjustment committee, the complaint for mandamus was properly dismissed").
In the present case, we note that the trustees, not the treasurer, have the authority to administer the pension fund and to order pension payments. Section 3-128 of the Illinois Pension Code states, "A board of 5 members shall constitute a board of trustees to administer the pension fund and to designate the beneficiaries thereof." 40 ILCS 5/3-128 (West 2006). The powers and duties of the trustees are "to control and manage, exclusively, * * * the pension fund." 40 ILCS 5/3-132(1) (West 2006). The trustees also have the duty "[t]o order the payment of pensions and other benefits." 40 ILCS 5/3-133 (West 2006). The treasurer, in contrast, is only authorized to hold or pay out money following the direction of the trustees: "All money received or collected shall be credited by the treasurer of the municipality to the account of the pension fund and held by the treasurer of the municipality subject to the order and control of the board." (Emphasis added.) 40 ILCS 5/3-132 (West 2006). Because the trustees have the authority to control and manage the pension fund and order payments and because the treasurer holds the money "subject to the order and control of the board," it is the *1291 treasurer's nondiscretionary duty to pay the pension amounts the trustees authorized.
Second, the trustees are entitled to have the treasurer pay as they direct, because, as shown above, the Illinois Pension Code gives the trustees authority to order payments (40 ILCS 5/3-133 (West 2006)) and gives the treasurer the nondiscretionary duty to pay as directed by the trustees (40 ILCS 5/3-132 (West 2006)). In this case, the trustees authorized the benefits based on the salaries as determined at the time of each beneficiary's retirement. Because the trustees have the authority to manage the fund and order payments and have ordered payments based on the original salaries, they are entitled to have the treasurer pay that amount. Finally, it is undisputed that the treasurer has not paid the retirees the amount directed by the trustees.
Therefore, because an order for mandamus is appropriate to "command[ ] a public officer to perform an official, nondiscretionary duty that the petitioner is entitled to have performed and that the officer has failed to perform" (Chicago Bar Ass'n, 161 Ill.2d at 507, 204 Ill.Dec. 301, 641 N.E.2d 525) and because all of these elements have been met in this case, the trial court's order for mandamus was appropriate, and we affirm the order that granted a writ of mandamus.
The treasurer defends his actions by pointing to section 3-144.2 of the Illinois Pension Code (40 ILCS 5/3-144.2 (West 2006)). Section 3-144.2 states, "The amount of any overpayment, due to fraud, misrepresentation[,] or error, of any pension or benefit granted under this Article may be deducted from future payments to the recipient of such pension or benefit." 40 ILCS 5/3-144.2 (West 2006). The doctrine of in pari materia requires that different sections of the same statute be read harmoniously and viewed as a whole. Accordingly, section 3-144.2 of the Illinois Pension Code must be read in conjunction with the other sections granting authority to the trustees. See, e.g., Ryan v. Board of Trustees of the General Assembly Retirement System, 388 Ill.App.3d 161, 163-64, 327 Ill.Dec. 750, 902 N.E.2d 1136 (2009), appeal allowed, 232 Ill.2d 596, 331 Ill.Dec. 376, 910 N.E.2d 1132 (2009). Therefore, to the extent this section of the Illinois Pension Code authorizes the correction of overpayments, it gives that authority to the trustees, not to the treasurer. Section 3-144.2 in no way justifies the actions of the treasurer, nor does it defeat the trustees' action for mandamus. We note as well that the treasurer did not bring a counterclaim or original action of mandamus against the trustees seeking affirmative relief. See Tembrina v. Simos, 208 Ill.App.3d 652, 656, 153 Ill.Dec. 578, 567 N.E.2d 536 (1991) (to receive affirmative relief, a party must file a cross-complaint); see also William J. Templeman Co. v. Liberty Mutual Insurance Co., 316 Ill.App.3d 379, 388, 249 Ill.Dec. 65, 735 N.E.2d 669 (2000) (a court does not have jurisdiction to decide an issue that has not been properly pled).

CONCLUSION
For the foregoing reasons, we affirm the order of the circuit court of Saline County that granted a writ of mandamus.
Affirmed.
GOLDENHERSH and DONOVAN, JJ., concur.
