
582 P.2d 332 (1978)
Jack CAIN, Petitioner and Respondent,
v.
The DEPARTMENT OF HEALTH AND ENVIRONMENTAL SCIENCES et al., Respondents and Appellants.
No. 14040.
Supreme Court of Montana.
Submitted June 14, 1978.
Decided July 24, 1978.
Rehearing Denied August 24, 1978.
*333 Eleanor A. Parker, argued, Helena, Douglas B. Olson, Sp. Asst. Atty. Gen., Helena, for respondents and appellants.
Brown, Pepper & Kommers, Bozeman, Gene I. Brown, argued, Bozeman, James Beck, Highway Legal Dept., Helena, for petitioner and respondent.
HASWELL, Chief Justice.
The Department of Health and Environmental Sciences (DOH) appeals from a judgment entered in the District Court of Gallatin County which mandated issuance of a license from DOH for petitioner's junkyard business. The Department of Highways and the other respondents did not appeal from the judgment.
In April 1976, petitioner was charged in the Gallatin County Justice Court with operating a motor vehicle wrecking facility without having it properly shielded from public view. He was convicted, by a jury, of the charge on August 10, 1977. The Justice of the Peace ordered petitioner to shield his facility within six months.
In 1977, petitioner applied for a license for his facility from DOH. The application was denied because petitioner's facility was not properly shielded. On February 17, 1977, petitioner instituted this action for a writ of mandate to obtain a license for his facility from DOH. Following a hearing, the District Court entered findings of fact, conclusions of law and judgment. On August 29, 1977, the District Court amended the findings in form but not in substance.
The District Court found that petitioner was entitled to a writ of mandate; that he had no legal obligation to fence or screen his facility; that the Department of Highways had a legal obligation to fence or screen the facility; that DOH rule MAC 16-2.14(2)  S14261, which requires motor vehicle wrecking facilities to be shielded from public view to obtain a license, is void as being in conflict with sections 32-4513, R.C.M. 1947, et seq.; that the criminal prosecution against petitioner was void; and that petitioner was entitled to a license and recovery of his attorney fees.
The court entered its judgment on August 8, 1977. Following denial of a motion for new trial, DOH appeals.
In its appeal, DOH has raised three issues for our consideration which can be summarized in one: Did the District Court err in issuing a writ of mandate?
*334 Petitioner here is subject to two licensing statutes because his motor vehicle wrecking facility is located within 1,000 feet of a primary highway. The two statutes are: Junkyards Along Roads Act, Title 32, Chapter 45, R.C.M. 1947; and, Motor Vehicle Wrecking Facilities Act, Title 69, Chapter 68, R.C.M. 1947. The licensing authority for each of these acts is DOH.
The Junkyards Along Roads Act specifically requires a facility to be shielded from public view as a condition of licensing. Section 32-4517, R.C.M. 1947. The act does, however, grant an exception to this shielding requirement for facilities in existence prior to July 1, 1967. Section 32-4518. This section provides that the shielding of such facilities shall be carried out by the Department of Highways, if feasible. If not feasible, the Department is to move the facility.
Prior to 1977, the Motor Vehicle Wrecking Facilities Act did not have any specific statutory provision for shielding such facilities. It did have a provision authorizing DOH to establish rules for the administration and enforcement of the act. Section 69-6808, R.C.M. 1947. Pursuant to this section DOH adopted its shielding rule, MAC 16-2.14(2)  S14261. In 1977, this rule was made a part of the act. Section 69-6808(6).
Petitioner brought this action so that he could get the necessary license for his facility. DOH argues that the court erred in granting the writ. They claim that as long as petitioner's facility is not shielded, they cannot give him a license. To give him a license, according to DOH, would contravene the purpose of both statutes. Accordingly they contend then that the judgment of the District Court must be reversed. We disagree.
This Court has held that the granting of a writ of mandate is a matter of discretion to be determined by the District Court and will be sustained on appeal unless there is a showing that the District Court abused its discretion. State ex rel. Browman v. Wood (1975), 168 Mont. 341, 543 P.2d 184. In this case, DOH has not shown us that the court abused its discretion in granting the writ.
A writ of mandate will issue only where the person seeking to invoke it is entitled to have the defendant perform a clear legal duty and there is no speedy or adequate remedy in the ordinary course of law. State ex rel. Swart v. Casne (1977), Mont., 564 P.2d 983, 34 St.Rep. 347. Ordinarily mandamus will not lie to compel the performance of a discretionary function. State ex rel. Butte Youth Service Center v. Murray (1976), 170 Mont. 171, 551 P.2d 1017, 33 St.Rep. 610. However, if there has been such an abuse of discretion as to amount to no exercise of discretion at all, mandamus will lie to compel the proper exercise of powers granted. Barnes v. Town of Belgrade (1974), 164 Mont. 467, 524 P.2d 1112.
The grant or denial of a license to operate a junkyard facility or motor vehicle wrecking facility involves the use of discretion on the part of DOH. DOH has a clear legal duty to grant petitioner a license if his facility is in compliance with the law. Admittedly, petitioner's facility does not have the required shielding. However, that is due to no fault of his own. As the District Court found, the Department of Highways, not petitioner, has the legal duty to shield his facility. Thus, for DOH to deny petitioner a license because his facility is not shielded when another agency of this state is obligated to shield the facility, amounts to no exercise of discretion at all on the part of DOH. Petitioner was entitled to a writ of mandate as it was his only adequate remedy.
Nonetheless, the District Court committed a technical error in the judgment which was entered. In its findings of fact, the court found that the Department of Highways had the legal obligation to shield petitioner's facility because petitioner's facility was in existence before July 1, 1967. The court found that the shielding of this facility was feasible. However, in the judgment, the court did not order the Department of Highways to shield petitioner's facility. Such an order should have been a part of the judgment.
*335 An appellate court has the authority to modify a judgment in mandamus proceedings. 55 C.J.S. Mandamus, § 374; People ex rel. Cahokia U.S.D. v. East St. Louis S.D. (1972), 6 Ill. App.3d 511, 285 N.E.2d 487; Bussie v. Long (La. App. 1973), 286 So.2d 689.
Therefore, the judgment of the District Court is modified to the extent that the Department of Highways is ordered to shield petitioner's facility to bring it into compliance with the acts in question here. As so modified, we affirm.
DALY and HARRISON, JJ., concur.
SHEEHY, J., deeming himself disqualified did not participate in this cause.
SHEA, Justice, dissenting.
I would reverse the District Court decision and hold that a writ of mandamus was not available against the Department of Health and Environmental Sciences. The clear duty of the department was not to issue a license unless the property was properly shielded. It escapes me how petitioner can be entitled to a license to operate a wrecking yard if he does not in fact have his property shielded. This is an anomalous result, to say the least.
This is not to say that petitioner does not have any other remedy, which is the conclusion of the majority. Indeed, petitioner had a remedy, both against the Department of Health and Environmental Sciences and the Department of Highways.
It does not appear that the petitioner appealed from his conviction in Justice Court for his failure to have his wrecking yard shielded. Had he desired, he could have obtained an injunction against the Department of Health, enjoining the department from commencing or continuing criminal proceedings against him. Injunctions are available in certain instances to enjoin the enforcement criminal statutes or municipal ordinances. In 42 Am.Jur.2d, Injunctions, § 187, at 957-958, it is stated:
"It is recognized, however, that an injunction will lie to restrain the threatened enforcement of an invalid law where the lawful use and enjoyment of private property will be injuriously affected by its enforcement, or where the right of a person to conduct a lawful business or calling will be injuriously affected thereby, unless, of course, the remedy at law is manifestly as complete and adequate as an injunction. * * *"
Also see 42 Am.Jur.2d, Injunctions, § 188-190. Clearly, where the Highway Department had the duty under another statute, to shield petitioner's wrecking yard, or remove it to another location if shielding was not feasible, petitioner could have enjoined the Department of Health from enforcing the criminal law against him.
Petitioner could still have commenced an action against the Department of Health after his conviction in Justice Court, and could have asked the Court to enjoin the enforcement of the penalty imposed upon him (the shielding of his property within six months) and to further enjoin the Department of Health from commencing criminal proceedings against him for failure to have his wrecking yard shielded. He would not, however, be entitled to a license.
Moreover, petitioner also had a mandamus remedy directly against the Highway Department. Under section 32-4518, R.C.M. 1947, the Department of Highways had a legal duty to shield from public wrecking yard facilities which were in existence before July 1, 1967. Petitioner's wrecking yard was in operation before July 1967. Section 32-4518 also provided that the Department of Highways was to shield the property only if feasible. Mandamus could have compelled the Highway Department to either shield the property or to make a determination that shielding was not feasible. In either event, petitioner would have been relieved of the obligation to personally shield his wrecking yard.
The result would be that petitioner would still be excused from having a license. If the Highway Department refused to fence his wrecking yard facilities because it was not feasible, or to remove his wrecking yard to another location, petitioner would still be *336 permitted to operate without a license. If the Highway Department fenced his wrecking yard, the Department of Health would then be authorized, indeed required, to grant a license to petitioner. It defies logic, however, to compel the Department of Health to grant petitioner a wrecking yard license when he does not have his property shielded.
The majority opinion is also in error in holding that the District Court made a distinct finding that it was feasible for the Department of Highways to shield petitioner's wrecking yard. Such is not the case at all. In oral arguments counsel for petitioner Cain agreed that the District Court did not make a finding one way or the other as to the feasibility of shielding petitioner's wrecking yard. The Court's findings bear this out. The Court entered two set of findings (the second amending the findings in form but not in substance). The only finding relating to feasibility of shielding in the first set of findings was as follows:
"That Norman Dalry, an agent of the Montana Department of Highways testified through his deposition entered as an exhibit in this matter, that it was the determination of his department that it was feasible to screen Petitioner's junkyard." (Finding of Fact No. 12)
This finding of course, is not a finding of the Court as to feasibility.
The above finding with relation to deposition testimony however, turned out to be error and the Court corrected the finding in his amended findings by stating:
"That Finding of Fact Number 12, filed on August 4, 1977, be amended nunc pro tunc, as of the date of said making and filing, to read as follows:
"That Norman Dalry, an agent of the Montana Department of Highways, submitted a report on Jack Cain's junk vehicle facility to the Department of Health and Environmental Sciences indicating that screening of that facility was feasible."
Again, this is not a finding by the Court that screening was feasible. On the basis of the Court's findings before this Court, it has no authority to order that the Department of Highways must shield petitioner's wrecking yard.
The judgment cannot stand. I would reverse the judgment against the Department of Health and Environmental Sciences because such Department cannot be compelled to grant a license to petitioner until his property is shielded. As to the Department of Highways, even if this court has the authority to amend or modify a judgment in mandamus as the majority has concluded, I do not see how we can order the Highway Department to shield the property involved when the District Court made no finding that shielding was feasible.
The holding today has converted a writ of mandamus into a general all purpose writ. Now imaginative or unimaginative counsel can use it as a method of obtaining attorneys fees and compelling government to act under the most tenuous circumstances. It has always been my understanding that when a District Court enters judgment in violation of the law he has abused his discretion. Clearly, there is an abuse of discretion in this case.
