Thursday, June 16, 2016

RENT compiler option in cobol - Understanding reentrant programming

For understanding RENT compiler option, we need to know  what is a  re-entrant program.
A re-entrant is a program that doesn’t change itself. “How can a program change itself?” Does the word "Multi threading " looks familiar?  Reentrant and mutithreading are related but somewhat different topics.
We can divide our program(logically) into  three parts:
1. Program code – the instructions that are executed when a program runs.
2. Constants – constants used in a program. These are set when the program is written, and never change.
3.Working  Storage area – or variables. This area changes when different user fires the same program.

"A reentrant Cobol program gives each user their own copy of working storage. " 
For every user,MVS supplies the GETMAIN and STORAGE macros to support this and they can be
used by subsystems such as CICS or IMS or whatever to support reentrant programs.

For each user the copy of the working storage is dynamically acquired and initialized from the original copy. When a user interacts with the program , he only modifies his copy of the variables.

When the program is interrupted to give another user a turn to use the program, information about the data area associated with that user is saved.

So, what will happen if we write a CICS program as non-renetrant?
When one transaction waits, a second transaction can come and modify the working storage variables, and thus providing unstable or undesirable results.

Thus, Re-entrant programs allow a single copy of a program or routine to be used concurrently by two or more processes.


For cobol, we use the compiler option RENT to generate reentrant object program.

8 comments:

  1. Thanks for clarification.

    ReplyDelete
  2. I am a student with literally zero ideas of computer science. I have an assignment due on the COBOL and I don’t know how to do it. I was searching for some answers and it led me to your article. Trust me, It is good to take buying assignment services online. I hope i will learn a lots of things about this topic.

    ReplyDelete
  3. Thank you for sharing I love coming to your blog whenever i need new information. also get pvc pipes and electrical conduit pipe fittings if you want.

    ReplyDelete
  4. I was searching about Diesel generators when I suddenly landed on your article. I really love what you have done above Thanks for sharing!

    ReplyDelete
  5. I was looking for information on Tiled Roof restoration near me near me when I came across your article. What you've done above is fantastic. Thank you for sharing your knowledge!

    ReplyDelete
  6. Great blog post thanks for sharing

    ReplyDelete
  7. I am a student and have absolutely no knowledge of computer science. I don't know how to complete a viva assignment that is due today. I came on your assignment when looking for some answers. I assure you that purchasing viva assignment services online is a wonderful idea. I'm hoping to learn a lot about this subject. visit this site: https://www.ukassignmentshelp.co.uk/assignment-viva-services.php

    ReplyDelete
  8. I have learned alot of things in this blog.This is really helpful and informative for me.If you are looking to buy an online men denim jeans collection for men turnout to exportclub.pk for all the fashion stuff.

    ReplyDelete