IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Can any one tel me the meaning of this data type.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Naresh Ch

New User


Joined: 16 Jan 2009
Posts: 2
Location: India

PostPosted: Tue Apr 07, 2009 6:01 pm
Reply with quote

Hi All,

I work in an application that is around 5 years old. While debugging a program to solve a prod error, I have come across a data type like
-10(9).99.

The error was that the variable with the above mentioned data type doesnt accept positive values and its size was 14 bytes. When I removed the negative sign it was accepting both positive and negative values but the size became 4 bytes(I saw the variable sizes through expeditor)


Can anyone tell me what this declaration means and also the significance of the negative sign
Back to top
View user's profile Send private message
leo_sangha

New User


Joined: 11 Aug 2005
Posts: 85
Location: England

PostPosted: Tue Apr 07, 2009 6:27 pm
Reply with quote

5 yrs old Mainframe application is pretty new i would say.

Please post the complete declaration of the variable.

Also post the snapshot that you saw through expeditor.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


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

PostPosted: Tue Apr 07, 2009 6:39 pm
Reply with quote

Quote:
a data type like -10(9).99.
Like?
As in maybe it was -9(10).99?
Or something else?
I can see 0(9) works but I don't see how the '1' works.....
Back to top
View user's profile Send private message
Naresh Ch

New User


Joined: 16 Jan 2009
Posts: 2
Location: India

PostPosted: Tue Apr 07, 2009 6:51 pm
Reply with quote

The declaration looks like this..

05 WT-TOT-PRM-L1 PIC -(10)9.99 VALUE ZERO.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Apr 07, 2009 7:07 pm
Reply with quote

One of the reasons it is so important to cut and paste from the actual code is when you paraphrase, you get it wrong.
Quote:
I have come across a data type like -10(9).99.
-(10)9.99 makes sense, or -9(10).99 -- but you paraphrased it wrong.

Quote:
The error was that the variable with the above mentioned data type doesnt accept positive values
This is nonsense -- you misunderstand what COBOL is telling you, or you don't know enough COBOL to realize that your statement is wrong.

To wit:
Code:
       WORKING-STORAGE SECTION.
       01  WS-A1   PIC -(10)9.99.
       01  WS-B1   PIC -(10)9.99.
      /
       PROCEDURE DIVISION.
       S1000-MAIN       SECTION.
           MOVE -12345.67              TO  WS-A1.
           MOVE  12345.67              TO  WS-B1.
           DISPLAY  'WS-A1: ' WS-A1.
           DISPLAY  'WS-B1: ' WS-B1.
produces output of
Code:
 WS-A1:      -12345.67
 WS-B1:       12345.67
which very clearly proves that a -(10)9.99 field will accept a positive value. The negative sign is printed if and only if the value is negative -- otherwise a space is printed. The -(10)9.99 indicates there are 11 characters in front of the decimal point and 2 characters after the decimal point. If the value is negative, the negative sign will appear just before the first significant digit.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Apr 07, 2009 8:57 pm
Reply with quote

... all of which is explained in glorious detail in the COBOL Language Reference manual.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top