Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Can any one tel me the meaning of this data type.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Can any one tel me the meaning of this data type.
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    Post subject: Reply to: Can any one tel me the meaning of this data type.
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: 2150
Location: At my coffee table

PostPosted: Tue Apr 07, 2009 6:39 pm    Post subject:
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    Post subject:
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: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Tue Apr 07, 2009 7:07 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Setting Font Type for XMIT satish.ms10 All Other Mainframe Topics 3 Fri Sep 15, 2017 10:01 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us