Page 1 of 1

asciioutput record count

Posted: Thu Jan 26, 2017 11:00 pm
by ravi
Hi All,

I have been trying achieve row record count and decimals in asciioutput file-but unsuccessful- i thought seek your advise
In the asciioutput - file it need to contain decimal and trailing zeros.
Example AMOUNT column need to contain the decimal 4 places like 1234 filed would look like 1234.0000.

My Code
AsciiOutput( sFilename, 'vCurrenies', vDeptarment,vProject,vAccount,vPeriod, NumberToString(VALUE) );

I also need to do trailing record count in file output file

appreciate your advise.

Thanks
10.2 ver

Re: asciioutput record count

Posted: Thu Jan 26, 2017 11:40 pm
by Alan Kirk
ravi wrote: I have been trying achieve row record count and decimals in asciioutput file-but unsuccessful- i thought seek your advise
In the asciioutput - file it need to contain decimal and trailing zeros.
Example AMOUNT column need to contain the decimal 4 places like 1234 filed would look like 1234.0000.

My Code
AsciiOutput( sFilename, 'vCurrenies', vDeptarment,vProject,vAccount,vPeriod, NumberToString(VALUE) );
Instead of using NumberToString, use NumberToStringEx. Knowing IBM the link that I've provided should be good for a week or two; after that just consult the .pdf copy of the Reference Guide.
ravi wrote:I also need to do trailing record count in file output file
Declare a variable like iRecordCount = 0; in the Prolog. As the first line in the data tab, update that as iRecordCount = iRecordCount + 1;

You can then output that as part of the AsciiOutput just as you do with the Value.

Re: asciioutput record count

Posted: Fri Jan 27, 2017 1:00 am
by ravi
Hi Alan,
Thank you record count worked after i tried per your suggestion.

I am still having problem to of using "NumberToStringEx" - I will come back if I can't get it.

thanks again.

Re: asciioutput record count

Posted: Fri Jan 27, 2017 8:23 pm
by ravi
Hi

I have been trying to use NumberToStringEx to get decimal after the values, example 1234 to 1234.0000
ASCIIOUTPUT(pFile , vdepartmentt | '|' | vDepartDescr | '|' | NUMBERTOSTRINGEX(ROUNDP(Value,'#,00)) | '|' | dPeriod | '|' | sASOFDATE);
I thought to get expert advise- with some example and explanation.

Thank you for your time.
Ravi

Re: asciioutput record count

Posted: Fri Jan 27, 2017 9:14 pm
by Alan Kirk
ravi wrote:Hi

I have been trying to use NumberToStringEx to get decimal after the values, example 1234 to 1234.0000
ASCIIOUTPUT(pFile , vdepartmentt | '|' | vDepartDescr | '|' | NUMBERTOSTRINGEX(ROUNDP(Value,'#,00)) | '|' | dPeriod | '|' | sASOFDATE);
I thought to get expert advise- with some example and explanation.
Exactly how closely did you look at the documentation that I provided you with a link to?
- Closely enough to know that RoundP is about precision, not formatting and that its second argument is not a format string, but a number of decimal places?
- To know that format strings need to have closing as well as opening quote marks? (Meaning that the expression above would not have even compiled, much less run.)
- That NumberToStringEx has four arguments, not two?
- That if you want four decimal places, you would probably be better off using four zeroes, not two in the format string?

Please take a look at the Reference Guide links again and have another shot at it.

Re: asciioutput record count

Posted: Fri Jan 27, 2017 9:17 pm
by ravi
It worked finally...

ASCIIOUTPUT(pFile , vdepartmentt | '|' | vDepartDescr | '|' | sRet | '|' | dPeriod | '|' | sASOFDATE);


#sRet= NumberToStringEx(Value, '####0.0000', '.', '');

Thanks again for your time..