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
 

 

Handling negative signs in EZtrieve

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
View previous topic :: :: View next topic  
Author Message
Ajeevlal

New User


Joined: 19 Feb 2005
Posts: 9
Location: Chennai

PostPosted: Fri Aug 17, 2007 4:51 pm    Post subject: Handling negative signs in EZtrieve
Reply with quote

i have this below simple eztrieve program.

WS-VAR1 W 7 N VALUE 0
WS-VAR2 W 7 N VALUE 0
WS-DIFF W 7 N VALUE 0

JOB INPUT NULL

WS-VAR1 = 9
WS-VAR2 = 2
WS-DIFF = WS-VAR2 - WS-VAR1
DISPLAY 'WS-VAR2 ' WS-DIFF
IF WS-DIFF LE 0
DISPLAY ' LESS THAN '
ELSE
DISPLAY ' GREATER '
END-IF
STOP

The output of the above program is 7 (positive), actually 2-9 is -7. is there any way to identify negative values during computation in eztrieve.
Back to top
View user's profile Send private message

noorkh

New User


Joined: 06 Mar 2006
Posts: 76
Location: Chennai

PostPosted: Fri Aug 17, 2007 4:59 pm    Post subject:
Reply with quote

Hi Ajeevlal,

User Masking to get Negative sign in output.
Remember for negative masking sign needs to be put after digits.
Back to top
View user's profile Send private message
Ajeevlal

New User


Joined: 19 Feb 2005
Posts: 9
Location: Chennai

PostPosted: Fri Aug 17, 2007 5:55 pm    Post subject: Reply to: handling negative signs in eztrieve.
Reply with quote

thanks. i have tried using mask

WS-VAR1 W 7 N VALUE 0
WS-VAR2 W 7 N VALUE 0
WS-DIFF W 7 N VALUE 0 MASK 'ZZZZZ99-'

JOB INPUT NULL

WS-VAR1 = 9
WS-VAR2 = 2
WS-DIFF = WS-VAR2 - WS-VAR1
DISPLAY 'WS-VAR2 ' WS-DIFF
IF WS-DIFF LE 0
DISPLAY ' GREATER '
ELSE
DISPLAY ' LESS THAN '
END-IF
STOP

but still the same result.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Aug 17, 2007 6:27 pm    Post subject:
Reply with quote

Quote:
If you specify a numeric field with no decimal positions, CA-Easytrieve/Plus considers that field unsigned
Try
WS-DIFF W 7 N 0 VALUE 0
Back to top
View user's profile Send private message
noorkh

New User


Joined: 06 Mar 2006
Posts: 76
Location: Chennai

PostPosted: Fri Aug 17, 2007 6:43 pm    Post subject:
Reply with quote

Hi Ajeevlal,

I think it can be done only with Signed decimal field.

Try with WS-DIFF W 8 P 2 MASK 'Z,ZZZ,ZZZ,ZZZ,ZZ9.99-' VALUE 0.
Back to top
View user's profile Send private message
Ajeevlal

New User


Joined: 19 Feb 2005
Posts: 9
Location: Chennai

PostPosted: Sat Aug 18, 2007 1:08 pm    Post subject: Reply to: handling negative signs in eztrieve.
Reply with quote

Thank you all guys.

both

WS-DIFF W 7 N 0 VALUE 0
and
WS-DIFF W 8 P 2 MASK 'Z,ZZZ,ZZZ,ZZZ,ZZ9.99-' VALUE 0.

worked well. icon_biggrin.gif
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 -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ON ERROR handling soundarr PL/I & Assembler 2 Wed May 11, 2016 3:37 am
No new posts Exception Handling in Native Stored P... Mariraj DB2 1 Thu Feb 25, 2016 4:08 am
No new posts Negative value used in IFTHEN jacobdng DFSORT/ICETOOL 3 Tue Aug 04, 2015 2:12 pm
No new posts Flip Signs sun_job DFSORT/ICETOOL 7 Wed Jul 15, 2015 8:01 am
No new posts Does FUNCTION NUMVAL work for alphanu... Venkata Ramayya COBOL Programming 8 Fri Mar 20, 2015 10:43 pm


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