IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What is the meaning of PERFORM PARA1 IN PARA2


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sairam442
Warnings : 1

New User


Joined: 23 Nov 2006
Posts: 3
Location: banglore

PostPosted: Tue Mar 06, 2007 8:37 am
Reply with quote

hi all
pls help me
the fallowing statement is

PERFORM PARA1 IN PARA2

pls tell me the meaning of this one
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Mar 06, 2007 9:21 am
Reply with quote

Hello,

Please post the actual code including a few statements before the perform and both "para1" and "para2".

What you have posted does not conform to any of the standard perform formats. There is an in-line perform, but it is not coded as your example is.

If you'll show more of the code where you found this, we can be more help.
Back to top
View user's profile Send private message
mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Wed Mar 07, 2007 8:23 am
Reply with quote

Hi sairam,

When u write "PERFORM PARA1 IN PARA2" statement then it treats para1 in para2 as a procedure name and we did not defined any procedure here.

The actual error message is :
"PARA1 OF PARA2" was not defined as a procedure-name. The statement was discarded.
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Wed Mar 07, 2007 8:49 pm
Reply with quote

PERFORM PARA1 IN PARA2.
its actually mean that perform a paragraph named PARA1 in section named PARA2

Code:
PROCEDURE DIVISION.
MAIN-SECTION.
     PERFORM PARA1 IN PARA2.
PARA2 SECTION.
PARA1.
     DISPLAY 'HELLO'.
STOP RUN.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Mar 08, 2007 4:35 am
Reply with quote

Hi cobolunni,

You seem to be sure of your ans but I've never run across this usage. Can you please supply the documentary source for this? I'd appreciate it.

I should also say that I've seen it used in the context of elementary variables of the same name residing in two different group levels.

To make them unique you refer to them as being "IN" their respective groups, e.g.:

FLD3 IN GRP1
FLD3 IN GRP2

But I've never seen that PERFORM usage.

Thanx and
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 08, 2007 8:10 am
Reply with quote

Hello,

Was curious myself and decided to put it in some code and see what the compiler did.

The compiler is Enterprise COBOL for Z/OS (3.4.1).

The line of code is
Code:
    PERFORM 020-READ IN 2000-GET-FINAL.

020-READ is a paragraph in the 2000-GET-FINAL SECTION.

This code compiled with no errors or warnings.

Added a second 020-READ in another section.

This compiled with no errors or warnings.

Changed the perform to PERFORM 020-READ.

Compile failed - PROCEDURE NAME "020-READ" WAS MULTIPLY DEFINED".


Makes sense (kinda), but i have no idea where it might be documented icon_smile.gif

Interesting, though most of my sites have standards that say paragraphs must be numbered in ascending sequence. That would eliminate use of this feature.

Thanks Cobolunni icon_cool.gif
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Thu Mar 08, 2007 12:53 pm
Reply with quote

Quote:
Duplicate Paragraph Names

If your program contains duplicate paragraph names, both COBOL systems
will resolve references to the duplicate paragraph names in the same way,
provided the duplicate paragraph names are only referenced from within
the sections in which they are declared. If, however, you reference a
duplicate paragraph name from a different section to the one it is
declared in, the RM/COBOL system will assume that the reference is to the
next declaration of the duplicate paragraph name, whereas this COBOL
system will give an error when you are producing intermediate code.

Solution

To ensure that references to duplicate paragraph names are correctly
resolved, you must qualify a reference to a duplicate paragraph name by
adding the section name in which it is declared.

Example

If your source code contains the following:

....
PERFORM para-2.
....
sect-1 SECTION.
para-1.
....
para-2.
....
sect-2 SECTION.
para-2.
....

the RM/COBOL system will resolve the reference to para-2 in the PERFORM
statement by using the declaration of para-2 in the sect-1 SECTION. Under
this COBOL system, however, you must qualify the reference to the
duplicate paragraph name in your source code by using the PERFORM para-2
OF sect-1 statement.


this is from rm/cobol but found that it works in all type of cobol compilers
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Use of Perform Thru Exit COBOL Programming 6
No new posts what is meaning of the number in dcl PL/I & Assembler 2
No new posts WER416B Error meaning SYNCSORT 9
No new posts How to perform Digest Access Authenti... All Other Mainframe Topics 0
No new posts Meaning of low values and high values COBOL Programming 12
Search our Forums:

Back to Top