View previous topic :: View next topic
|
Author |
Message |
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Hi all,
According to theories, and many posts in the forum, an S9(4) COMP variable can hold a maximum value of +/- 32767 i.e. 2 raised to 15.
I wrote a small program to verify it..but it is not giving the desired results...
COBOL Module:
Code: |
WORKING-STORAGE SECTION.
01 WS-DISP-VAR PIC S9(05).
01 WS-DISP-VAR1 PIC 9(05) VALUE 32766.
01 WS-NUM-VAR PIC S9(04) COMP.
01 WS-NUM-VAR1 PIC S9(04) COMP.
PROCEDURE DIVISION.
A000-MAINPARA.
ACCEPT WS-DISP-VAR.
DISPLAY "DISP VARIABLE : " WS-DISP-VAR.
MOVE WS-DISP-VAR TO WS-NUM-VAR.
ADD 1 TO WS-DISP-VAR1.
MOVE WS-DISP-VAR1 TO WS-NUM-VAR1.
DISPLAY "DISP VARIABLE1 : " WS-DISP-VAR1.
DISPLAY "COMP VARIABLE1 : " WS-NUM-VAR.
DISPLAY "COMP VARIABLE2 : " WS-NUM-VAR1.
STOP RUN. |
RUN JCL SYSIN
Code: |
//SYSIN DD *
3276F
/* |
SYSOUT
Code: |
DISP VARIABLE : 3276F
DISP VARIABLE1 : 32767
COMP VARIABLE1 : 2766
COMP VARIABLE2 : 2767 |
Please let me know if I missed out on any Compiler option...
I havent given any compiler option while compiling. |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
Hi,
What is the number in SYSIN. Please show it us in HEX ON. |
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Its the zoned decimal input--- the number is +32766 |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Thanks for the information.
It is working fine now...
But can you provide me some inputs on where and when to use the compiler options...
If possible, please take some random scenario where we need to use some compiler option other than the default one |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
If your compiler supports COMP-5 (Native Binary), then the TRUNC option has no effect.
COMP-5 support was introduced with OS390/COBOL 2.2.1.
Bill |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
But can you provide me some inputs on where and when to use the compiler options...
If possible, please take some random scenario where we need to use some compiler option other than the default one |
Part of the problem here is that IBM allows, during installation of COBOL, for each site to set up their default COBOL options to be different than what is in the manual. This can be done for CICS compiles separately from batch compiles. Unless you contact your site support group, you cannot know absolutely for sure about the default options (other than running a compile, of course).
Additionally, changing the compile options depends largely upon the needs of the program and you should document such deviations very carefully (so the next person to compile your code in 1 month or 7 years -- or whenever -- can get a clean compile). The best recommendation would be to read the compiler options in the COBOL Programming Guide manual (link at the top of the page) and consider when you would need that option changed. |
|
Back to top |
|
|
TS70363
New User
Joined: 07 Apr 2010 Posts: 94 Location: Bangalore, India
|
|
|
|
Oh..Thanks for guiding... |
|
Back to top |
|
|
|