Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
harry07
Warnings : 1

New User

Joined: 15 Nov 2006
Posts: 7

 Posted: Fri Nov 17, 2006 10:14 pm    Post subject: Suggest Field definition for Negative values 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.

mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Sun Nov 19, 2006 2:12 am    Post subject: 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.
harry07
Warnings : 1

New User

Joined: 15 Nov 2006
Posts: 7

 Posted: Sun Nov 19, 2006 2:27 am    Post subject: Re: Suggest Field definition for Negative values hi I would like it for display purpose only & nothing is required for mathematical calculations.
mmwife

Super Moderator

Joined: 30 May 2003
Posts: 1592

 Posted: Mon Nov 20, 2006 2:24 am    Post subject: 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.
UmeySan

Active Member

Joined: 22 Aug 2006
Posts: 757
Location: Germany

 Posted: Mon Nov 20, 2006 2:15 pm    Post subject: Re: Suggest Field definition for Negative values 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
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics LOW VALUES as a KEY juares castro DB2 10 Sat Apr 07, 2018 1:06 am How to include a particular field val... sakrat DFSORT/ICETOOL 8 Fri Apr 06, 2018 8:27 pm Extract the records with a PD field's... sudhakar84 DFSORT/ICETOOL 11 Mon Apr 02, 2018 7:26 pm Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us