Page 1 of 1

Populating negative sign in easytreive

PostPosted: Tue Mar 22, 2011 2:38 pm
by Ramanath
Hi Folks,

Can any one throw light on this?

The Input file contains 625.00

The following is the output file field

DFIELD-5 65 16 N

This filed populates in output as 0000000000625Û00

Now according to the new requirement when this field in the Input 625.00
It should populates in output as 0000000000625Û00 (It is same as above)

And when this filed in the input is -625.00
It should populates in output as -000000000625Û00 (Note: Most significant bit Zero is relaced by negative sign)

How can we do this?

Re: Populating negative sign in easytreive

PostPosted: Tue Mar 22, 2011 3:28 pm
by BillyBoyo
Ramanath wrote:DFIELD-5 65 16 N



Easytrieve treats as signed any field with decimal places. It looks like you want them, but haven't coded. Try "DFIELD-5 65 16 N 2".

If you don't have any decimals but want negative, you have to specify zero decimal places "XXXX * 7 N 0".

If you want to format it for printing, look it up in the manual. Not hard to find.

Re: Populating negative sign in easytreive

PostPosted: Tue Mar 22, 2011 6:11 pm
by Ramanath
Through this
65 16 N 2
I am not getting the result in the alignment which I needed, however sign is coming.
It is coming as -625.00
But I want -000000000625Û00
I am not looking for format it for prnting.

Re: Populating negative sign in easytreive

PostPosted: Wed Mar 23, 2011 1:28 am
by BillyBoyo
Ramanath wrote:Û


Please tell me what the above is.

Please show me what your input field is defined as.

Please give a few examples of possible input data, with the appropriate output data you are expecting.

Normally, on a file, you'd keep the data in a manipulable format, and then only do your final destination formatting (like for a print) at the last stage. But, for some reason you want it in your format.

Easytrieve Plus, unlike Cobol, provides a "mask" to edit fields for printing, but that means you can't get Easytrieve Plus to format for a file.

For your minus in the left-most digit, you'll have to "redefine" the field to make a space for the sign. Then you have to test for something being negative (less that zero is a good way) and set it to "-" if so. In Easytrieve Plus, for a field to possibly be negative, it must have decimal places. If a field that must have decimal places does not have decimal places, then you have to tell it 0 decimal places, and you get a signed field.