---
title: "IF-ELSE-ENDIF JCL top example you need"
description: "The if else endif example in JCL to control execution of steps. You can use if statement along with COND parameter in JCL. Both COND and if-else-endif statements you can use to control execution of JCL steps."
url: https://srinimf.com/2013/01/15/jcl-how-to-use-cond-with-if-else-endif/
date: 2013-01-15
modified: 2019-07-22
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2013/01/jcl-steps.png?fit=753%2C453&ssl=1
categories: ["JCL"]
tags: ["IF Then in JCL", "jcl condition codes", "JCL tips and Tricks"]
type: post
lang: en
---

# IF-ELSE-ENDIF JCL top example you need

COND parameter is very important to control job steps in JCL.  The COND controls flow of  steps. You can control the steps execution in the JCL, in the in stream procedure, and in the cataloged procedure.

You can [control execution of any step](https://srinimf.com/2015/09/22/jcl-how-to-run-only-one-step-in-a-job/) you want in JCL. This is advanced to COND by mixing of both if-else-endif.

**Example:**

```
//Myjob   JOB  (Acct),'me', CLASS=A,MSGCLASS=0, 
//                    MSGLEVEL=(1,1),NOTIFY=USERID
//Step1    EXEC    PROC1
//Cond1   IF  RC=0 THEN
//ESTEP1  EXEC   PROC2
//Cond2    ELSE
//ESTEP2  EXEC   PROC3
//               ENDIF
//*
```

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2013%2F01%2F15%2Fjcl-how-to-use-cond-with-if-else-endif%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2013%2F01%2Fjcl-steps.png%3Ffit%3D753%252C453%26ssl%3D1&description=IF-ELSE-ENDIF%20JCL%20top%20example%20you%20need)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2013/01/15/jcl-how-to-use-cond-with-if-else-endif/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2013/01/15/jcl-how-to-use-cond-with-if-else-endif/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2013/01/15/jcl-how-to-use-cond-with-if-else-endif/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2013/01/15/jcl-how-to-use-cond-with-if-else-endif/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20IF-ELSE-ENDIF%20JCL%20top%20example%20you%20need&body=https%3A%2F%2Fsrinimf.com%2F2013%2F01%2F15%2Fjcl-how-to-use-cond-with-if-else-endif%2F&share=email)
-

### Like this:

Like Loading…