MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Operational Sign in Cobol

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
jctgf
Beginner


Joined: 05 Nov 2006
Posts: 89
Topics: 36

PostPosted: Thu Sep 03, 2009 6:55 am    Post subject: Operational Sign in Cobol Reply with quote

Hi,

Is it important to declare the operational sign in Cobol variables, if I'm dealing only with positive values?

I mean, is there a reason to use

01 fields pic S9(09) comp-3.

instead of

01 fields pic 9(09) comp-3 ?

I was told that declaring the "S" makes the program faster. Is it true?

Thanks.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Thu Sep 03, 2009 11:25 am    Post subject: Reply with quote

jctgf,

Quote:
I was told that declaring the "S" makes the program faster. Is it true?


It depends on the compiler option NUMPROC. Check this

Quote:

Using the NUMPROC(PFD) compiler option generates significantly more efficient code for numeric comparisons. It also avoids the generation of extra code that NUMPROC(NOPFD) or NUMPROC(MIG) generates for most references to COMP-3 and DISPLAY numeric data items to ensure a correct sign is being used. With NUMPROC(NOPFD), sign fix-up processing is done for all references to these numeric data items. With NUMPROC(MIG), sign fix-up processing is done only for receiving fields (and not for sending fields) of arithmetic and MOVE statements. With NUMPROC(PFD), the compiler assumes that the data has the correct sign and bypasses this sign fix-up processing. NUMPROC(MIG) generates code that is similar to that of OS/VS COBOL. Using NUMPROC(NOPFD) or NUMPROC(MIG) may also inhibit some other types of optimization. However, not all external data files contain the proper sign for COMP-3 or DISPLAY signed numeric data, and hence, using NUMPROC(PFD) may not be applicable for all application programs. For performance sensitive applications, NUMPROC(PFD) is recommended when possible.

Performance considerations using NUMPROC:

On the average, NUMPROC(PFD) was 1% faster than NUMPROC(NOPFD), with a range of 12% faster to equivalent.
On the average, NUMPROC(PFD) was 1% faster than NUMPROC(MIG), with a range of 8% faster to equivalent.
On the average, NUMPROC(MIG) was equivalent to NUMPROC(NOPFD), with a range of 11% faster to equivalent.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group