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
 

 

Suggest Field definition for Negative values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
harry07
Warnings : 1

New User


Joined: 15 Nov 2006
Posts: 7

PostPosted: Fri Nov 17, 2006 10:14 pm    Post subject: Suggest Field definition for Negative values
Reply with quote

Hi
Please suggest the field definition for my requirement below.

If the field is negative it should be occupy first position in the field
& if not positive then the first position should be occupied by zero & not spaces.

Suppose if the field is 1 & pic 9(9).9(2)

if negative should be displayed as -00000001.00
if positive should be displayed as 000000001.00

Please let me know your inputs on the same.
Back to top
View user's profile Send private message

mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Nov 19, 2006 2:12 am    Post subject:
Reply with quote

Hi Harry,

You didn't say what you plan to do after you get what you want. What you defined in your post is a numeric edited field and you can only use it for display purposes, i.e. you can't do math on it.

So, how do you plan to use it. An answer (if any) depends on the ans to this ques.
Back to top
View user's profile Send private message
harry07
Warnings : 1

New User


Joined: 15 Nov 2006
Posts: 7

PostPosted: Sun Nov 19, 2006 2:27 am    Post subject: Re: Suggest Field definition for Negative values
Reply with quote

hi
I would like it for display purpose only & nothing is required for mathematical calculations.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon Nov 20, 2006 2:24 am    Post subject:
Reply with quote

Hi Harry,

Your PIC s/b be something like pic -9(9).9(2). That will display the minus sign when the value is neg.

If it's pos you can do something like this:

IF VAR(1:1) = SPACE
MOVE ZERO TO VAR(1:1)
END-IF

Or you can move in a '+' (my choice), but you know your requirements better than me (er.. I).

Can't think of anything more elegant.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 755
Location: Germany

PostPosted: Mon Nov 20, 2006 2:15 pm    Post subject: Re: Suggest Field definition for Negative values
Reply with quote

Hi !

Why not using a mask like:

01 ZNUM-1206 PIC +++++++++++9,999999.
01 ZNUM-1602 PIC +++++++++++++++9,99.
01 ZNUM-1800 PIC ZZZZZZZZZZZZZZZZZ9.
01 ZNUM-0400 PIC ZZZ9.
01 ZNUM-08BB PIC 999B999B99.

Regards, UmeySan
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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am


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