Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to work with negative numbers

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to work with negative numbers
 Login/Join
 
Guru
posted
I’m working on a little project where I have to add all earnings (from an employee’s various earning codes). The format of the field I'm working with is P11.2C. In some cases, the numbers can be negative, such as for a pay adjustment. My code works great, except when it comes to a negative amount. The code adds the negative number instead of subtracting it. How do I handle the negative amounts? I always thought if you added a negative amount into a subtotal, the amount would be automatically subtracted. However, in my case, that is not happening.

Here is a piece of my code:

EARN010 /P8.2C = IF EBEOB EQ '010' THEN EBEOW ELSE 0;
EARN011 /P8.2C = IF EBEOB EQ '011' THEN EBEOW ELSE 0;
EARN012 /P8.2C = IF EBEOB EQ '012' THEN EBEOW ELSE 0;
EARN014 /P8.2C = IF EBEOB EQ '014' THEN EBEOW ELSE 0;
EARN015 /P8.2C = IF EBEOB EQ '015' THEN EBEOW ELSE 0;
EARN016 /P8.2C = IF EBEOB EQ '016' THEN EBEOW ELSE 0;
EARN017 /P8.2C = IF EBEOB EQ '017' THEN EBEOW ELSE 0;
EARN018 /P8.2C = IF EBEOB EQ '018' THEN EBEOW ELSE 0;
EARN019 /P8.2C = IF EBEOB EQ '019' THEN EBEOW ELSE 0;
EARN020 /P8.2C = IF EBEOB EQ '020' THEN EBEOW ELSE 0;
EARN021 /P8.2C = IF EBEOB EQ '021' THEN EBEOW ELSE 0;
EARN022 /P8.2C = IF EBEOB EQ '022' THEN EBEOW ELSE 0;
EARN024 /P8.2C = IF EBEOB EQ '024' THEN EBEOW ELSE 0;
EARN025 /P8.2C = IF EBEOB EQ '025' THEN EBEOW ELSE 0;
EARN026 /P8.2C = IF EBEOB EQ '026' THEN EBEOW ELSE 0;
EARN027 /P8.2C = IF EBEOB EQ '027' THEN EBEOW ELSE 0;
EARN028 /P8.2C = IF EBEOB EQ '028' THEN EBEOW ELSE 0;
EARN029 /P8.2C = IF EBEOB EQ '029' THEN EBEOW ELSE 0;
EARN030 /P8.2C = IF EBEOB EQ '030' THEN EBEOW ELSE 0;
EARN031 /P8.2C = IF EBEOB EQ '031' THEN EBEOW ELSE 0;
EARN032 /P8.2C = IF EBEOB EQ '032' THEN EBEOW ELSE 0;
EARN033 /P8.2C = IF EBEOB EQ '033' THEN EBEOW ELSE 0;
EARN034 /P8.2C = IF EBEOB EQ '034' THEN EBEOW ELSE 0;
EARN035 /P8.2C = IF EBEOB EQ '035' THEN EBEOW ELSE 0;
EARN036 /P8.2C = IF EBEOB EQ '036' THEN EBEOW ELSE 0;
EARN039 /P8.2C = IF EBEOB EQ '039' THEN EBEOW ELSE 0;
EARN040 /P8.2C = IF EBEOB EQ '040' THEN EBEOW ELSE 0;
EARN041 /P8.2C = IF EBEOB EQ '041' THEN EBEOW ELSE 0;
EARN042 /P8.2C = IF EBEOB EQ '042' THEN EBEOW ELSE 0;
EARN043 /P8.2C = IF EBEOB EQ '043' THEN EBEOW ELSE 0;
EARN044 /P8.2C = IF EBEOB EQ '044' THEN EBEOW ELSE 0;
EARN045 /P8.2C = IF EBEOB EQ '045' THEN EBEOW ELSE 0;
EARN046 /P8.2C = IF EBEOB EQ '046' THEN EBEOW ELSE 0;
EARN047 /P8.2C = IF EBEOB EQ '047' THEN EBEOW ELSE 0;
EARN050 /P8.2C = IF EBEOB EQ '050' THEN EBEOW ELSE 0;
EARN051 /P8.2C = IF EBEOB EQ '051' THEN EBEOW ELSE 0;
EARN051 /P8.2C = IF EBEOB EQ '051' THEN EBEOW ELSE 0;
EARN052 /P8.2C = IF EBEOB EQ '052' THEN EBEOW ELSE 0;
EARN055 /P8.2C = IF EBEOB EQ '055' THEN EBEOW ELSE 0;
EARN056 /P8.2C = IF EBEOB EQ '056' THEN EBEOW ELSE 0;
EARN057 /P8.2C = IF EBEOB EQ '057' THEN EBEOW ELSE 0;
EARN058 /P8.2C = IF EBEOB EQ '058' THEN EBEOW ELSE 0;
EARN060 /P8.2C = IF EBEOB EQ '060' THEN EBEOW ELSE 0;
EARN070 /P8.2C = IF EBEOB EQ '070' THEN EBEOW ELSE 0;
EARN080 /P8.2C = IF EBEOB EQ '080' THEN EBEOW ELSE 0;
EARN091 /P8.2C = IF EBEOB EQ '091' THEN EBEOW ELSE 0;
EARN092 /P8.2C = IF EBEOB EQ '092' THEN EBEOW ELSE 0;
EARN094 /P8.2C = IF EBEOB EQ '094' THEN EBEOW ELSE 0;
EARN095 /P8.2C = IF EBEOB EQ '095' THEN EBEOW ELSE 0;
EARN096 /P8.2C = IF EBEOB EQ '096' THEN EBEOW ELSE 0;
EARN097 /P8.2C = IF EBEOB EQ '097' THEN EBEOW ELSE 0;
EARN098 /P8.2C = IF EBEOB EQ '098' THEN EBEOW ELSE 0;
EARN099 /P8.2C = IF EBEOB EQ '099' THEN EBEOW ELSE 0;
EARN100 /P8.2C = IF EBEOB EQ '100' THEN EBEOW ELSE 0;
EARN120 /P8.2C = IF EBEOB EQ '120' THEN EBEOW ELSE 0;
EARN121 /P8.2C = IF EBEOB EQ '121' THEN EBEOW ELSE 0;
EARN122 /P8.2C = IF EBEOB EQ '122' THEN EBEOW ELSE 0;
EARN130 /P8.2C = IF EBEOB EQ '130' THEN EBEOW ELSE 0;
EARN131 /P8.2C = IF EBEOB EQ '131' THEN EBEOW ELSE 0;
EARN132 /P8.2C = IF EBEOB EQ '132' THEN EBEOW ELSE 0;
EARN140 /P8.2C = IF EBEOB EQ '140' THEN EBEOW ELSE 0;
EARN143 /P8.2C = IF EBEOB EQ '143' THEN EBEOW ELSE 0;
EARN148 /P8.2C = IF EBEOB EQ '148' THEN EBEOW ELSE 0;
EARN149 /P8.2C = IF EBEOB EQ '149' THEN EBEOW ELSE 0;
EARN150 /P8.2C = IF EBEOB EQ '150' THEN EBEOW ELSE 0;
EARN155 /P8.2C = IF EBEOB EQ '155' THEN EBEOW ELSE 0;
EARN160 /P8.2C = IF EBEOB EQ '160' THEN EBEOW ELSE 0;
EARN165 /P8.2C = IF EBEOB EQ '165' THEN EBEOW ELSE 0;
EARN170 /P8.2C = IF EBEOB EQ '170' THEN EBEOW ELSE 0;
EARN171 /P8.2C = IF EBEOB EQ '171' THEN EBEOW ELSE 0;
EARN176 /P8.2C = IF EBEOB EQ '176' THEN EBEOW ELSE 0;
EARN177 /P8.2C = IF EBEOB EQ '177' THEN EBEOW ELSE 0;
EARN178 /P8.2C = IF EBEOB EQ '178' THEN EBEOW ELSE 0;
EARN179 /P8.2C = IF EBEOB EQ '179' THEN EBEOW ELSE 0;
EARN180 /P8.2C = IF EBEOB EQ '180' THEN EBEOW ELSE 0;
EARN190 /P8.2C = IF EBEOB EQ '190' THEN EBEOW ELSE 0;
EARN191 /P8.2C = IF EBEOB EQ '191' THEN EBEOW ELSE 0;
EARN195 /P8.2C = IF EBEOB EQ '195' THEN EBEOW ELSE 0;
EARN200 /P8.2C = IF EBEOB EQ '200' THEN EBEOW ELSE 0;
EARN210 /P8.2C = IF EBEOB EQ '210' THEN EBEOW ELSE 0;
EARN220 /P8.2C = IF EBEOB EQ '210' THEN EBEOW ELSE 0;
EARN230 /P8.2C = IF EBEOB EQ '230' THEN EBEOW ELSE 0;
EARN240 /P8.2C = IF EBEOB EQ '240' THEN EBEOW ELSE 0;
EARN300 /P8.2C = IF EBEOB EQ '300' THEN EBEOW ELSE 0;
EARN305 /P8.2C = IF EBEOB EQ '305' THEN EBEOW ELSE 0;
EARN310 /P8.2C = IF EBEOB EQ '310' THEN EBEOW ELSE 0;
EARN390 /P8.2C = IF EBEOB EQ '390' THEN EBEOW ELSE 0;
EARN395 /P8.2C = IF EBEOB EQ '395' THEN EBEOW ELSE 0;
EARN400 /P8.2C = IF EBEOB EQ '400' THEN EBEOW ELSE 0;
EARN405 /P8.2C = IF EBEOB EQ '405' THEN EBEOW ELSE 0;
EARN410 /P8.2C = IF EBEOB EQ '410' THEN EBEOW ELSE 0;
EARN415 /P8.2C = IF EBEOB EQ '415' THEN EBEOW ELSE 0;
EARN420 /P8.2C = IF EBEOB EQ '420' THEN EBEOW ELSE 0;
EARN450 /P8.2C = IF EBEOB EQ '450' THEN EBEOW ELSE 0;
EARN500 /P8.2C = IF EBEOB EQ '500' THEN EBEOW ELSE 0;
EARN501 /P8.2C = IF EBEOB EQ '501' THEN EBEOW ELSE 0;
EARN502 /P8.2C = IF EBEOB EQ '502' THEN EBEOW ELSE 0;
EARN503 /P8.2C = IF EBEOB EQ '503' THEN EBEOW ELSE 0;
EARN504 /P8.2C = IF EBEOB EQ '504' THEN EBEOW ELSE 0;
EARN510 /P8.2C = IF EBEOB EQ '510' THEN EBEOW ELSE 0;
EARN511 /P8.2C = IF EBEOB EQ '511' THEN EBEOW ELSE 0;
EARN512 /P8.2C = IF EBEOB EQ '512' THEN EBEOW ELSE 0;
EARN513 /P8.2C = IF EBEOB EQ '513' THEN EBEOW ELSE 0;
EARN514 /P8.2C = IF EBEOB EQ '514' THEN EBEOW ELSE 0;
EARN690 /P8.2C = IF EBEOB EQ '690' THEN EBEOW ELSE 0;
EARN691 /P8.2C = IF EBEOB EQ '691' THEN EBEOW ELSE 0;
EARN777 /P8.2C = IF EBEOB EQ '777' THEN EBEOW ELSE 0;
EARN800 /P8.2C = IF EBEOB EQ '800' THEN EBEOW ELSE 0;
EARN880 /P8.2C = IF EBEOB EQ '880' THEN EBEOW ELSE 0;
EARN990 /P8.2C = IF EBEOB EQ '990' THEN EBEOW ELSE 0;
EARN991 /P8.2C = IF EBEOB EQ '991' THEN EBEOW ELSE 0;
EARN992 /P8.2C = IF EBEOB EQ '992' THEN EBEOW ELSE 0;
EARN993 /P8.2C = IF EBEOB EQ '993' THEN EBEOW ELSE 0;
PREVEARN /P8.2C = EARN010 + EARN011 + EARN012 + EARN014 +
EARN015 + EARN016 + EARN017 + EARN018 + EARN019 +
EARN020 + EARN021 + EARN022 + EARN024 + EARN025 +
EARN026 + EARN027 + EARN028 + EARN029 + EARN030 +
EARN031 + EARN032 + EARN033 + EARN034 + EARN035 +
EARN036 + EARN039 + EARN040 + EARN041 + EARN042 +
EARN043 + EARN044 + EARN045 + EARN046 + EARN047 +
EARN050 + EARN051 + EARN052 + EARN055 + EARN056 +
EARN057 + EARN058 + EARN060 + EARN070 + EARN080 +
EARN091 + EARN092 + EARN094 + EARN095 + EARN096 +
EARN097 + EARN098 + EARN099 + EARN100 + EARN120 +
EARN121 + EARN122 + EARN130 + EARN131 + EARN132 +
EARN140 + EARN143 + EARN148 + EARN149 + EARN150 +
EARN155 + EARN160 + EARN165 + EARN170 + EARN171 +
EARN176 + EARN177 + EARN178 + EARN179 + EARN180 +
EARN190 + EARN191 + EARN195 + EARN200 + EARN210 +
EARN220 + EARN230 + EARN240 + EARN300 + EARN305 +
EARN310 + EARN390 + EARN395 + EARN400 + EARN405 +
EARN410 + EARN415 + EARN420 + EARN450 + EARN500 +
EARN501 + EARN502 + EARN503 + EARN504 + EARN510 +
EARN511 + EARN512 + EARN513 + EARN514 + EARN690 +
EARN691 + EARN777 + EARN800 + EARN880 + EARN990 +
EARN991 + EARN992 + EARN993;
END
-*
TABLE FILE EBFILE
PRINT EMP_NAME EMP_ID_300 EBEOW
EARN096
PREVEARN
JOB_CD_300
EBEOB
WHERE EMP_ID_300 EQ '452515359'
END
-RUN
-*
TABLE FILE EBFILE
-*
SUM
-*
EMP_NAME_EA AS 'NAME'
EMP_ID_300 AS 'IDX'
EBEOW AS 'GROSX'
EARN010
EARN011
EARN012
EARN014
EARN015
EARN016
EARN017
EARN018
EARN019
EARN020
EARN021
EARN022
EARN024
EARN025
EARN026
EARN027
EARN028
EARN029
EARN030
EARN031
EARN032
EARN033
EARN034
EARN035
EARN036
EARN039
EARN040
EARN041
EARN042
EARN043
EARN044
EARN045
EARN046
EARN047
EARN050
EARN051
EARN052
EARN055
EARN056
EARN056
EARN057
EARN058
EARN060
EARN070
EARN080
EARN091
EARN092
EARN094
EARN095
EARN096
EARN097
EARN098
EARN099
EARN100
EARN120
EARN121
EARN122
EARN130
EARN131
EARN132
EARN140
EARN143
EARN148
EARN149
EARN150
EARN155
EARN160
EARN165
EARN170
EARN171
EARN176
EARN177
EARN178
EARN179
EARN180
EARN190
EARN191
EARN190
EARN195
EARN200
EARN210
EARN220
EARN230
EARN240
EARN300
EARN305
EARN310
EARN390
EARN395
EARN400
EARN405
EARN410
EARN415
EARN420
EARN450
EARN500
EARN501
EARN502
EARN503
EARN504
EARN510
EARN511
EARN512
EARN513
EARN514
EARN690
EARN691
EARN777
EARN800
EARN880
EARN990
EARN991
EARN992
EARN993
PREVEARN
JOB_CD_300 AS 'JCDE'
EBEOB AS 'EBEOBT'
-*
IF EMP_ID_300 NE ' '
IF CORP_200 EQ '001'
IF EBEOW GT 0
-*
BY EBKEY
-*WHERE EMP_ID_300 EQ '365982461' OR '632039429'
-*WHERE RECORDLIMIT EQ 250
-*
ON TABLE HOLD AS H934A
-*
END


Thanks in advance...looking forward to getting your suggestions!

This message has been edited. Last edited by: webmeister,


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
What evidence can you offer that the calculation is not working as expected for a particular data instance?

Note that there is such a thing as an unsigned packed decimal field, although Focus' P format assumes signed. Check the data source vs. the Focus description. Can you post a layout of the source (Cobol 01, or SQL CREATE) and corresponding Focus MDF?


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
Looks like an SCT/Banner HRS file that I knew in a previous life.

You've also got "IF EBEOW GT 0" so you're eliminating any records that could possibly be negative. Maybe I'm not quite understanding your process.

About the only other answer, as Jack mentions, is that your number is not actually stored as a negative, but the logic in your application displays it as such based on earnings code or some other factor.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Guru
posted Hide Post
quote:
You've also got "IF EBEOW GT 0" so you're eliminating any records that could possibly be negative.


Darin,

Well slap me silly and call me blind, too! That little line was the culprit. I commented out the line and all is now right with the world.

Thank you so much!


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to work with negative numbers

Copyright © 1996-2020 Information Builders