View previous topic :: View next topic
|
Author |
Message |
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
Hi All
I saw below code used in one of the program written by other team .
PERFORM 500-PROCESS-xxxx-para
UNTIL (INPUT-EOF = 'Y') .
But in our team we usually use below format
PERFORM 500-PROCESS-xxxx-para
UNTIL INPUT-EOF = 'Y' .
Is there some difference between above codes :
Note: 500-PROCESS-xxxx-para reads the file and at end sets INPUT-EOF = 'Y' to true . |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
Do you get different outputs with this two piece of code |
|
Back to top |
|
|
acevedo
Active User
Joined: 11 May 2005 Posts: 344 Location: Spain
|
|
|
|
easy to test, test it and post the results. |
|
Back to top |
|
|
mabidin
New User
Joined: 18 Sep 2007 Posts: 5 Location: malaysia
|
|
|
|
nope .. there is no difference between above codes. try both codes. compile with no error and get same outputs |
|
Back to top |
|
|
saptagiri kintali
New User
Joined: 21 Sep 2007 Posts: 20 Location: chennai
|
|
|
|
ya there will be no diff between those two.only if you want to specify more than one condition you have to use braces and if it is one condition u may use or may not ..no problem. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Hi snehalpatel,
Why do u think there is any difference in the code as Saptagiri mentione for one condition using of braces is optional.
Please let us know if u r not convinced |
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
guptae wrote: |
Hi snehalpatel,
Why do u think there is any difference in the code as Saptagiri mentione for one condition using of braces is optional.
Please let us know if u r not convinced |
Thanks all for valuable suggestion
I executed my program with both code and both codes gave same results (no compile / runtime error).
The reason that I doubted about code was that, usually for multiple condition check we use Braces, but here Braces were used for Single condition check.
I am totally convinced. |
|
Back to top |
|
|
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 196 Location: Bangalore
|
|
|
|
Braces are used in UNTIL conditions if there are AND and OR mixed combinations.
For example
If you want PERFORM C UNTIL A = 9 AND (B = 9 OR B = 8) and code as
PERFORM C UNTIL A = 9 AND B = 9 OR B = 8 will be treated as PERFORM C UNTIL (A = 9 AND B = 9) OR B = 8. So in this case it is must to use braces.
If you want PERFORM C UNTIL (A = 9 AND B = 9) OR B = 8 and code as PERFORM C UNTIL A = 9 AND B = 9 OR B = 8 will be treated as PERFORM C UNTIL (A = 9 AND B = 9) OR B = 8. So in this case it is optional to use braces. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you use parenthsis to either improve readability or to override the 'order of precedence'.
In cases like this where the amount of different code is small, look at the assembler that is generated. When that is the same, you do not need to test to insure that both modules have the same behaviour. |
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
dbzTHEdinosauer wrote: |
you use parenthsis to either improve readability or to override the 'order of precedence'.
In cases like this where the amount of different code is small, look at the assembler that is generated. When that is the same, you do not need to test to insure that both modules have the same behaviour. |
Hi
I could not get by the sentance " look at the assembler that is generated " . Is it related to Compiler listing ? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
When you compile a COBOL program, the compilation generates assembler code from the COBOL syntax that is then assembled/linked to create the executable module. You can specify that the compilation show the generated assembler code in the output.
Keep in mind that the generated code is not the way an assembler programmer would write the code. |
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
dick scherrer wrote: |
Hello,
You can specify that the compilation show the generated assembler code in the output.
Keep in mind that the generated code is not the way an assembler programmer would write the code. |
Thanks Dick
In our Shop we use 'Endevor' to compile Element and Add to NED. I could not find option to see Assembler code. Can you suggest me the method to see Assembler code in compilation listing.
This would be helpful to know how assembler treats code internally. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
In the PARM for the compile, your parm specifies NOLIST or that is the default for yor compiler. If you run the compile with LIST instead, you should see the generated assembler code. |
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
dick scherrer wrote: |
Hello,
In the PARM for the compile, your parm specifies NOLIST or that is the default for yor compiler. If you run the compile with LIST instead, you should see the generated assembler code. |
Thanks Dick
Thanks for quick reply. I tried to set the option before compilation but i could not find any. I guess our Shop does not have this option. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
snehalpatel wrote: |
I tried to set the option before compilation but i could not find any. I guess our Shop does not have this option. |
Bull pucky...take a look of the first page of your compile, before the IDENTIFICATION DIVISION, you will find either LIST or NOLIST...... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
Quote: |
I tried to set the option before compilation but i could not find any. I guess our Shop does not have this option. |
This is typically not a shop option - it is part of the basic compiler. What version of the compiler are you using? Once upon a time, the parameter was PMAP.
If you post the compiler version (found on the top of each compile) we may be able to spot which PARM you need to use. |
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
CICS Guy wrote: |
snehalpatel wrote: |
I tried to set the option before compilation but i could not find any. I guess our Shop does not have this option. |
Bull pucky...take a look of the first page of your compile, before the IDENTIFICATION DIVISION, you will find either LIST or NOLIST...... |
Hi
I see 'LIST' option in my compiler listing before IDENTIFICATION DIVISION |
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
dick scherrer wrote: |
You're welcome
Quote: |
I tried to set the option before compilation but i could not find any. I guess our Shop does not have this option. |
This is typically not a shop option - it is part of the basic compiler. What version of the compiler are you using? Once upon a time, the parameter was PMAP.
If you post the compiler version (found on the top of each compile) we may be able to spot which PARM you need to use. |
Hi Dick
We are using 'IBM Enterprise COBOL for z/OS 3.4.1' Compiler version |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Here is an example from the same Enterprise COBOL compiler
Code: |
176 1 HEX-UNDER-LINE. . . . . . . . . . . . . . . . BLW=00012 888
177 2 HEX-UNDER-CHAR. . . . . . . . . . . . . . . BLW=00012 888
178 HU-INX. . . . . . . . . . . . . . . . . . . IDX=00003 000
180 1 ORIGINAL-LINE . . . . . . . . . . . . . . . . BLW=00012 8A0
181 2 ORIG-CHAR . . . . . . . . . . . . . . . . . BLW=00012 8A0
182 ORG-INX . . . . . . . . . . . . . . . . . . IDX=00004 000
PP 5655-G53 IBM ENTERPRISE COBOL FOR Z/OS 3.4.1 DSCHCOBX
000000 DSCHCOBX DS 0H PROGRAM:
USING *,15
000000 47F0 F028 B 40(,15) BYPASS C
000004 00 DC AL1(0) ZERO NAM
000005 C3C5C5 DC CL3'CEE' CEE EYE
000008 00000168 DC X'00000168' STACK FR
|
Just after the header line you see DSCHCOBX DS 0H . This is the bbeginning of the generated assembler.
If your compile parm says LIST you should already have this in your output. If your compile parm says NOLIST, change it to LIST to get this. |
|
Back to top |
|
|
snehalpatel
New User
Joined: 13 Sep 2007 Posts: 37 Location: India
|
|
|
|
dick scherrer wrote: |
Hello,
Here is an example from the same Enterprise COBOL compiler
Code: |
176 1 HEX-UNDER-LINE. . . . . . . . . . . . . . . . BLW=00012 888
177 2 HEX-UNDER-CHAR. . . . . . . . . . . . . . . BLW=00012 888
178 HU-INX. . . . . . . . . . . . . . . . . . . IDX=00003 000
180 1 ORIGINAL-LINE . . . . . . . . . . . . . . . . BLW=00012 8A0
181 2 ORIG-CHAR . . . . . . . . . . . . . . . . . BLW=00012 8A0
182 ORG-INX . . . . . . . . . . . . . . . . . . IDX=00004 000
PP 5655-G53 IBM ENTERPRISE COBOL FOR Z/OS 3.4.1 DSCHCOBX
000000 DSCHCOBX DS 0H PROGRAM:
USING *,15
000000 47F0 F028 B 40(,15) BYPASS C
000004 00 DC AL1(0) ZERO NAM
000005 C3C5C5 DC CL3'CEE' CEE EYE
000008 00000168 DC X'00000168' STACK FR
|
Just after the header line you see DSCHCOBX DS 0H . This is the bbeginning of the generated assembler.
If your compile parm says LIST you should already have this in your output. If your compile parm says NOLIST, change it to LIST to get this. |
Thanks Dick
Yeah I got Assembler listing for compiled Code. This Info was useful. Thanks For quick Reply. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome |
|
Back to top |
|
|
|