---
title: "COBOL PERFORM Varying with UNITIL Logic"
description: "COBOL Perform Varying Until logic useful to search a Table or an Array."
url: https://srinimf.com/2016/01/23/cobol-loop-with-perform-varying-logic/
date: 2016-01-23
modified: 2026-10-09
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2016/01/cobol-perform-varying-until.jpg?fit=1200%2C700&ssl=1
categories: ["COBOL"]
tags: ["Best Example for COBOL PERFORM VARYING", "Cobol Perform Varying"]
type: post
lang: en
---

# COBOL PERFORM Varying with UNITIL Logic

Here’s logic how to use PERFORM UNTIL. We use PERFORM statement for handling loops in COBOL. Here, this example shows PERFORM with UNTIL.

## [PERFORM Varying](https://srinimf.com/2011/11/30/cobolnestedperform/) Until Syntax

```
PERFORM paragraph-name
VARYING a-variable-value 
FROM start-value BY increment-value
UNTIL some-condition-is-met
```

## PERFORM Varying UNTIL Example

```
PERFORM PARA-A
VARYING  TEST-1 
FROM 1 BY 1
UNTIL    TEST-1 > 1000
OR       FILE-SWITCH = 'EOF'
```

## **Bonus Post**

[![COBOL: How to use PERFORM-TEST-AFTER Logic](https://i0.wp.com/srinimf.com/wp-content/uploads/2016/08/cobol-test-after.jpg?resize=800%2C600&ssl=1)](https://srinimf.com/2016/08/24/how-to-use-perform-test-after-logic-in-cobol/)

### [COBOL: How to use PERFORM-TEST-AFTER Logic](https://srinimf.com/2016/08/24/how-to-use-perform-test-after-logic-in-cobol/)

You can use this COBOL logic written using PERFORM TEST AFTER. This is one best way of handling loops in COBOL programs. After reading input files you need to validate each record. So this logic helps you as a guide.

[![Srini&apos;s avatar](https://secure.gravatar.com/avatar/f10b4bafeeb96dce9806c5a3c6cde6ea1e2c014ef273120a4bf2c6d5f975f01c?s=48&r=g)](https://srinimf.com/author/moonrobot/)
by [Srini](https://srinimf.com/author/moonrobot/)
August 24, 2016October 10, 2026

**Related Posts**

- [COBOL 2000 Exit PERFORM](https://srinimf.com/2015/04/08/cobol-2000-change-in-perform/)DateApril 8, 2015
- [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
- [COBOL: How to use PERFORM-TEST-AFTER Logic](https://srinimf.com/2016/08/24/how-to-use-perform-test-after-logic-in-cobol/)DateAugust 24, 2016

## LATEST POSTS

[![30 SQL Practice Queries with Solutions — Run Them Live](https://i0.wp.com/srinimf.com/wp-content/uploads/2026/10/pexels-photo-5530473.jpeg?fit=867%2C1300&ssl=1)](https://srinimf.com/2026/10/01/30-sql-practice-queries-with-solutions-run-them-live/)

## [30 SQL Practice Queries with Solutions — Run Them Live](https://srinimf.com/2026/10/01/30-sql-practice-queries-with-solutions-run-them-live/)

Practice 30 SQL queries with solutions, from SELECT and JOINs to subqueries and window functions. Run SQL queries live in an interactive SQL Playground.

by [Srini](https://srinimf.com/author/moonrobot/)
October 1, 2026October 11, 2026

[![Supercharge Your Database Skills: Try Our New Interactive SQL Plugin!](https://i0.wp.com/srinimf.com/wp-content/uploads/2026/09/pexels-photo-1181469.jpeg?fit=1200%2C801&ssl=1)](https://srinimf.com/2026/09/30/supercharge-your-database-skills-try-our-new-interactive-sql-plugin/)

## [Supercharge Your Database Skills: Try Our New Interactive SQL Plugin!](https://srinimf.com/2026/09/30/supercharge-your-database-skills-try-our-new-interactive-sql-plugin/)

Struggling with database queries? Explore our new interactive SQL plugin to write, test, and master SQL directly in your browser. Try the live demo now!

by [Srini](https://srinimf.com/author/moonrobot/)
September 30, 2026October 10, 2026

[![How to Count Spark Stages by Sight and Optimize Shuffles](https://i0.wp.com/srinimf.com/wp-content/uploads/2026/09/pexels-photo-14314638.jpeg?fit=1200%2C800&ssl=1)](https://srinimf.com/2026/09/27/how-to-count-spark-stages-by-sight-and-optimize-shuffles/)

## [How to Count Spark Stages by Sight and Optimize Shuffles](https://srinimf.com/2026/09/27/how-to-count-spark-stages-by-sight-and-optimize-shuffles/)

Want to predict execution stages before running a job? Learn how to count Spark stages by sight with code breakdowns, shuffle rules, and optimization traps.

by [Srini](https://srinimf.com/author/moonrobot/)
September 27, 2026October 11, 2026

[![Databricks Cluster Min & Max: How to Find and Right-Size](https://i0.wp.com/srinimf.com/wp-content/uploads/2026/09/pexels-photo-10194141.jpeg?fit=1200%2C800&ssl=1)](https://srinimf.com/2026/09/19/databricks-cluster-min-max-how-to-find-and-right-size/)

## [Databricks Cluster Min & Max: How to Find and Right-Size](https://srinimf.com/2026/09/19/databricks-cluster-min-max-how-to-find-and-right-size/)

Learn how to find and audit Min and Max worker limits in Databricks, track real cluster usage via system tables, and prevent runaway compute costs.

by [Srini](https://srinimf.com/author/moonrobot/)
September 19, 2026October 10, 2026

Load more posts

Something went wrong. Please refresh the page and/or try again.

### 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%2F2016%2F01%2F23%2Fcobol-loop-with-perform-varying-logic%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2016%2F01%2Fcobol-perform-varying-until.jpg%3Ffit%3D1200%252C700%26ssl%3D1&description=COBOL%20PERFORM%20Varying%20with%20UNITIL%20Logic)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2016/01/23/cobol-loop-with-perform-varying-logic/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2016/01/23/cobol-loop-with-perform-varying-logic/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2016/01/23/cobol-loop-with-perform-varying-logic/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2016/01/23/cobol-loop-with-perform-varying-logic/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20COBOL%20PERFORM%20Varying%20with%20UNITIL%20Logic&body=https%3A%2F%2Fsrinimf.com%2F2016%2F01%2F23%2Fcobol-loop-with-perform-varying-logic%2F&share=email)
-

### Like this:

Like Loading…
