Page 1 of 1

Formatting a numeric field to make it negative.

Posted: Tue May 02, 2017 4:49 pm
by utkarsh
Hi,

For a test SORT job I need to format a numeric field to make it negative. For that, I can think of two options, one is to multiply yhr fied with "-1" or subtractit from 0. In both the case which one is more efficeint and why, please let me know.

If I have to test such scenario my own what can I do to get a fair estimate on this?

Re: Formatting a numeric field to make it negative.

Posted: Tue May 02, 2017 5:02 pm
by enrico-sorichetti
how many billions of records do You have to process that would make any difference ?

Re: Formatting a numeric field to make it negative.

Posted: Thu Nov 09, 2017 5:42 pm
by utkarsh
Not billions of records are there but I shall have considerable amount of records, at least in millions. This job would be a daily job.

Re: Formatting a numeric field to make it negative.

Posted: Thu Nov 09, 2017 8:52 pm
by Robert Sample
Even if you are processing 10 million records per day, that is only 3.65 billion per year. With the cycle time of the system Z machines, you might (and I stress MIGHT) make a few CPU seconds difference over the course of the entire year. You have already spent more time worrying about this than you could possibly save in several years or more.

Re: Formatting a numeric field to make it negative.

Posted: Thu Nov 09, 2017 9:02 pm
by enrico-sorichetti
...I can think of two options, one is to multiply the field by -1 or subtract it from 0.
You are not making a field negative You are just switching the sign :?

Re: Formatting a numeric field to make it negative.

Posted: Tue Feb 27, 2018 2:52 pm
by utkarsh
enrico-sorichetti wrote: Thu Nov 09, 2017 9:02 pmYou are not making a field negative You are just switching the sign
But are not both mean same?

Sorry for a late reply.

Re: Formatting a numeric field to make it negative.

Posted: Tue Feb 27, 2018 6:32 pm
by Robert Sample
But are not both mean same?
Not at all -- if the value is +10 and you multiply by -1 you have a -10; if the value is -10 and you multiply by -1 you have a +10. This is switching the sign. Making the field negative would be testing the value and if it is positive then multiply by -1; if the value is negative then don't do anything to it.

Re: Formatting a numeric field to make it negative.

Posted: Fri Mar 30, 2018 12:20 pm
by utkarsh
Robert Sample wrote: Tue Feb 27, 2018 6:32 pmNot at all -- if the value is +10 and you multiply by -1 you have a -10; if the value is -10 and you multiply by -1 you have a +10. This is switching the sign. Making the field negative would be testing the value and if it is positive then multiply by -1; if the value is negative then don't do anything to it.
:shock:, never thought it that way. Thanks.