Use of ‘THRU’ in cobol ?

5 pts.
Tags:
AS/400
COBOL
COBOL Programs
COBOL statements
Hi.

i have 2 questions in cobol :

1) Suppose i have a para : 1000-process

Now while processing if i use : perform 1000-process thru 1000-exitand perform 1000-process .What will be the difference.

2) Suppose there is a cobol pgm named ABC .and in indentification division, i i give the name XYZ.Then i call the pgm ABC.It works.then what is the use of program-id.Why it is mandatory ?

 



Software/Hardware used:
as400

Answer Wiki

Thanks. We'll let you know when a new response is added.

I haven’t used cobol in a few years, but I think if you just perform <b>1000-process </b> then when the logic flow hits the next sequential paragraph name after 1000-process, it will return to the original calling point.

If you perform <b>1000-process </b> thru <b>1000-exit </b>, then it will process any/all paragraphs before returning to the calling point. You must ensure that the logic flow eventually gets to the <b>1000-exit </b> paragraph, otherwise, you will have lost control of the application logic (perform loop without a return condition).

I can’t provide an absolute answer to your second question except I think that the use of the program id has lost some of its relevence (from the original cobol language specification) and is more a convention, rather than fact. It’s good programming practice to have the same name in the progam-id field as well as the source file name.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    I generally avoid using THRU. If a series of paragraphs is to be executed, it is rare that they would ever be executed separately. So, use a SECTION header before each group of paragraphs, the PERFORM the SECTION instead of the paragraphs. A SECTION header will cause all of the paragraphs within that section to be recognized as a related group. If there is ever a need to execute the paragraphs individually or to execute a subset of the section, you can still name the paragraphs in the PERFORM statement or specify the beginning and end with THRU. You can use section or paragraph names with THRU if you wish. When you specify a section name, the entire SECTION is executed. The PROGRAM ID is a COBOL standard. In the AS/400 line (and probably with many other COBOL compilers), you are allowed to override the PROGRAM ID name at compile-time. Some compilers might not implement the same standard. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following