‎2007 May 23 2:19 PM
Hello All,
I have string which has trailing zeros. These string values should be stored in application server.
The problem is! when i save the file in the application server i am unable to these trailing zeros after saving the file in the application server.
So how can i handle this.
Thanks and regards,
Lisa.
‎2007 May 23 2:24 PM
can you post the code how your transferring the file to application server??
‎2007 May 23 2:45 PM
Hi Chandrasekhar,
here is is the code
OPEN DATASET file FOR OUTPUT IN TEXT MODE
ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
the above is my transfer mode
and
TRANSFER trans_file TO file LENGTH len.
Regards,
Lisa
‎2007 May 23 2:26 PM
Hi Lisa,
While transferring the String to Application Server ensure that your data is in the Character Format.
ie suppose you are Transferring an internal table which has Numc Fields which has leading Zeroes,now u need to Convert the Intrnal table fields to Char with similar length and decimal places ,
transfer this Internal table to File.
Hope this wil Solve your Problem.
Award Points if Useful.
Regrds,
Mithun
‎2007 May 23 2:54 PM
Hi Mithiun,
What do you mean by String must be in character format. Doest mean like below code must be there.
data i(200) type c.
Tranfer i to file.
If this is your question then i can't put trailing zeros. Do you have any idea how to put trailing zeros in this case.
Regards,
Lisa.
‎2007 May 23 2:27 PM
Hi Lisa,
are this numbers after decimal point? Probably because of internal type definition. Same can happen to leading zeros. Are they part of some kind of order?
Best regards,
ok
‎2007 May 23 2:55 PM
Hello oliver,
These numbers are not after decimals.
Regards,
Lisa.
‎2007 May 23 9:08 PM
‎2007 May 23 5:10 PM
HI Lisa,
not sur eif this is exactly what you need, but i was able to write trailing 0's with this example:
data: s1(50) type c,
s2 type c value ' ',
z1 type c value '0',
l1 type i.
data: f1(50) value 'test_file'.
clear: s1.
move: '123456789' to s1.
l1 = strlen( s1 ).
do 50 times. "(or replace with a value of s1 max len (50) - l1 )
replace ' ' in section offset l1 length 1 of s1 with '0'.
enddo.
open dataset f1 for output in text mode encoding non-unicode.
transfer s1 to f1.
close dataset f1.
-
not quite an elegant piece of code but hope this helps!
best regards,
fredy
‎2007 May 23 7:39 PM
Hi,
I guess trailing zero's were also transfered to your file(app server)may be some part of the record only visible to you.
so download the file into presentation server using CG3Y transaction in asci mode and check file whether file contains the leading zero's or not....
reward if needful...