---
title: "COBOL: Nested PERFORM VARYING"
description: "In Cobol, to perform loops you will use PERFORM VARYING . The perform within the perform you can say Nested Perform. You need Perform Varying to get data from two dimensional array . Here are my the b..."
url: https://srinimf.com/2011/11/30/cobolnestedperform/
date: 2011-11-30
modified: 2026-10-05
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2011/11/pexels-photo-4792264.jpeg?fit=1880%2C1255&ssl=1
categories: ["COBOL"]
tags: ["cobol", "perform", "Two dimension Array"]
type: post
lang: en
---

# COBOL: Nested PERFORM VARYING

In Cobol, to perform loops you will use **[PERFORM VARYING](https://srinimf.com/2016/01/23/cobol-loop-with-perform-varying-logic/)**. The perform within the perform you can say Nested Perform. You need Perform Varying to get data from two [dimensional array](https://srinimf.com/2018/09/03/cobol-multi-dimensional-array/). Here are my the best examples for Perform varying.

Type your email…

Subscribe

Ex:

```
PERFORM 200-MAJOR-RTN VARYING CTR1 FROM 1 BY 1 UNTIL CTR1 > 10     
PERFORM 300-CALC-RTN VARYING CTR2 FROM 1 BY 1 UNTIL CTR2 > 20
```

You can find[ very intersting things in this book-Buy Today](http://astore.amazon.com/mainframesrin-20/detail/0471722618/192-4374602-5989931). First inner loop will execute and later Outer loop will execute.

Alternative way is, in simple Perform:

```
PERFORM CTR1 FROM 1 BY 1 UNTIL CTR1 > 10
AFTER CTR2 FROM 1 BY 1 UNTIL CTR2 > 20
....
....
END-PERFORM
```

- ![](https://i0.wp.com/srinimf.com/wp-content/uploads/2011/11/pexels-photo-4353404.jpeg?resize=867%2C1300&ssl=1)Photo by Natalia Kycha on [Pexels.com](https://www.pexels.com/photo/happy-young-woman-sitting-on-floor-in-studio-with-closed-eyes-4353404/)

Related Posts

- [COBOL PERFORM Varying with UNITIL Logic](https://srinimf.com/2016/01/23/cobol-loop-with-perform-varying-logic/)DateJanuary 23, 2016
- [COBOL: How to Use PERFORM Varying Correctly](https://srinimf.com/2015/07/24/mainframe-cobol-occurs-indexed-byusage-is-index-2-of-2/)DateJuly 24, 2015
- [6 Top COBOL PERFORM Statements](https://srinimf.com/2016/12/16/the-best-6-cobol-perform-statements-with-complete-syntax/)DateDecember 16, 2016

### 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%2F2011%2F11%2F30%2Fcobolnestedperform%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2011%2F11%2Fpexels-photo-4792264.jpeg%3Ffit%3D1200%252C801%26ssl%3D1&description=COBOL%3A%20Nested%20PERFORM%20VARYING)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2011/11/30/cobolnestedperform/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2011/11/30/cobolnestedperform/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2011/11/30/cobolnestedperform/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2011/11/30/cobolnestedperform/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20COBOL%3A%20Nested%20PERFORM%20VARYING&body=https%3A%2F%2Fsrinimf.com%2F2011%2F11%2F30%2Fcobolnestedperform%2F&share=email)
-

### Like this:

Like Loading…
