View previous topic :: View next topic
|
Author |
Message |
sairam442 Warnings : 1 New User
Joined: 23 Nov 2006 Posts: 3 Location: banglore
|
|
|
|
hi all
pls help me
the fallowing statement is
PERFORM PARA1 IN PARA2
pls tell me the meaning of this one |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
mkk157
Active User
Joined: 17 May 2006 Posts: 310
|
|
|
|
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 |
|
|
cobolunni
Active User
Joined: 07 Aug 2006 Posts: 127 Location: kerala,india
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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
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 |
|
Back to top |
|
|
cobolunni
Active User
Joined: 07 Aug 2006 Posts: 127 Location: kerala,india
|
|
|
|
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 |
|
|
|