---
title: "Why GETMAIN You Need in CICS Programs"
description: "The real use of CICS GETMAIN command given with sample code."
url: https://srinimf.com/2012/03/24/cics-getmain/
date: 2012-03-24
modified: 2026-10-08
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2012/03/pexels-photo-531844.jpeg?fit=1880%2C1253&ssl=1
categories: ["CICS Tips"]
tags: ["CICS", "GETMAIN"]
type: post
lang: en
---

# Why GETMAIN You Need in CICS Programs

This is very important in view of CICS. Since many have a doubt that we already have a lot of storage, so why need to get dynamic memory.

## GETMAIN in CICS.

Cool. I will give an example why we need this. The purpose of Getmain is to get extra virtual storage to faster processing.

**See the example code:**

```
Working storage section.
77   INIT    pic x value low-value.
Linkage section.
01  DWS-work-area.
    02 fild1  pic x(100).
    02 fild2 pic x(200).
EXEC CICS GETMAIN
SET(Address of DWS-Area)
FLENGTH(300)
INITIMG(INIT)
END-EXEC
```

After executing this command, it allocates 300 bytes of virtual storage and initialized with low-values.

### Points to remember:

- FLENGTH is recommended option
- The expected errors are LENGERR and NOSTG
- This is one of the performance improvement criteria
- CICS always gets storage from DSA([Dynamic storage area](https://srinimf.com/2017/04/02/how-getmain-in-cics-solves-storage-issues-better-way/))

### 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%2F2012%2F03%2F24%2Fcics-getmain%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2012%2F03%2Fpexels-photo-531844.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=Why%20GETMAIN%20You%20Need%20in%20CICS%20Programs)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2012/03/24/cics-getmain/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2012/03/24/cics-getmain/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2012/03/24/cics-getmain/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2012/03/24/cics-getmain/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20Why%20GETMAIN%20You%20Need%20in%20CICS%20Programs&body=https%3A%2F%2Fsrinimf.com%2F2012%2F03%2F24%2Fcics-getmain%2F&share=email)
-

### Like this:

Like Loading…
