Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

What is difference between this codes
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Mon Sep 24, 2007 11:28 am    Post subject: What is difference between this codes
Reply with quote

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
View user's profile Send private message

Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Mon Sep 24, 2007 11:35 am    Post subject:
Reply with quote

Do you get different outputs with this two piece of code
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Mon Sep 24, 2007 11:56 am    Post subject:
Reply with quote

easy to test, test it and post the results.
Back to top
View user's profile Send private message
mabidin

New User


Joined: 18 Sep 2007
Posts: 5
Location: malaysia

PostPosted: Mon Sep 24, 2007 12:03 pm    Post subject:
Reply with quote

nope .. there is no difference between above codes. try both codes. compile with no error and get same outputs
Back to top
View user's profile Send private message
saptagiri kintali

New User


Joined: 21 Sep 2007
Posts: 20
Location: chennai

PostPosted: Mon Sep 24, 2007 12:21 pm    Post subject: Reply to: What is difference between this codes
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Mon Sep 24, 2007 12:36 pm    Post subject:
Reply with quote

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
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Mon Sep 24, 2007 1:50 pm    Post subject:
Reply with quote

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
View user's profile Send private message
shankar.v

Active User


Joined: 25 Jun 2007
Posts: 196
Location: Bangalore

PostPosted: Mon Sep 24, 2007 2:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 24, 2007 4:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Mon Sep 24, 2007 5:03 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Sep 24, 2007 8:58 pm    Post subject:
Reply with quote

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
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Wed Sep 26, 2007 3:11 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Sep 26, 2007 11:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Fri Sep 28, 2007 3:25 pm    Post subject:
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Fri Sep 28, 2007 4:07 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Fri Sep 28, 2007 6:34 pm    Post subject:
Reply with quote

You're welcome icon_smile.gif

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
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Thu Oct 04, 2007 2:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Thu Oct 04, 2007 2:24 pm    Post subject:
Reply with quote

dick scherrer wrote:
You're welcome icon_smile.gif

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
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Fri Oct 05, 2007 7:29 am    Post subject:
Reply with quote

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
View user's profile Send private message
snehalpatel

New User


Joined: 13 Sep 2007
Posts: 37
Location: India

PostPosted: Fri Oct 05, 2007 2:03 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts Difference space showed for TS and it... autobox DB2 1 Thu Apr 14, 2016 1:07 pm
No new posts Difference Between CICS WebSupport an... sachinji84 CICS 1 Mon Mar 07, 2016 7:25 pm
No new posts Difference between -180 and -181 with... deepak_shrivastava DB2 4 Wed Jan 06, 2016 10:00 am
No new posts Difference between COBOL for MAINFRAM... dejunzhu COBOL Programming 1 Sat Oct 31, 2015 2:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us