Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 14: CICS Performance, Security and Advanced Topics


Storage Management

CICS manages its own storage in areas called Dynamic Storage Areas (DSAs). Understanding DSAs helps you fix storage shortages and storage violations.

Dynamic Storage Areas

  • CICS storage is divided into DSAs above and below the 16 MB line, for CICS code and for user programs.
  • Main DSAs: CDSA and ECDSA for CICS code, UDSA and EUDSA for user programs, SDSA and ESDSA for shared storage, RDSA and ERDSA for read-only storage.
  • Storage above the 16 MB line (the E* DSAs) is used by default because it is much larger.
  • The SIT parameters DSALIM and EDSALIM set the maximum size of storage below and above the line.

GETMAIN and FREEMAIN

  • Programs get extra working storage with EXEC CICS GETMAIN and must return it with EXEC CICS FREEMAIN.
  • Storage from GETMAIN is task-lifetime storage by default. It is freed automatically when the task ends.
  • Always check the response code after GETMAIN. If CICS is short on storage, GETMAIN fails instead of abending.
  • Shared storage lives beyond one task. Free it explicitly, or it stays allocated until CICS restarts.

Short on storage (SOS)

  • SOS happens when a DSA fills up. CICS suspends new tasks until storage is freed.
  • Find the cause with statistics: look for tasks holding large GETMAIN areas or a storage leak.
  • A storage leak is a program that GETMAINs storage in a loop or never FREEMAINs shared storage.
  • Storage protection (SIT STGPROT=YES) stops programs from accidentally overwriting CICS storage.

Example: GETMAIN and FREEMAIN

  • Get a work area, use it, then free it. Always check the response after GETMAIN.
  • WORKING-STORAGE SECTION. 01 WS-AREA-LENGTH PIC S9(8) COMP VALUE 500. 01 WS-WORK-PTR USAGE POINTER. 01 WS-RESPONSE PIC S9(8) COMP. PROCEDURE DIVISION. EXEC CICS GETMAIN SET(WS-WORK-PTR) FLENGTH(WS-AREA-LENGTH) INITIMG(LOW-VALUE) RESP(WS-RESPONSE) END-EXEC. IF WS-RESPONSE NOT = DFHRESP(NORMAL) EXEC CICS SEND TEXT FROM('NO STORAGE AVAILABLE') END-EXEC EXEC CICS RETURN END-EXEC END-IF. * --- use the storage through WS-WORK-PTR --- EXEC CICS FREEMAIN DATAPOINTER(WS-WORK-PTR) END-EXEC.
  • SET gives you the address of the new storage. INITIMG sets every byte to a starting value.
  • FREEMAIN with DATAPOINTER returns task-lifetime storage. Never use the pointer after freeing it.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant