Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncate Empty Spaces

Status
Not open for further replies.

marinos

Programmer
May 13, 2010
12
CY
Dear All,
i am using the PUT Statement Function to display some details for a bank. The small problem i am facing is the following, i have a field (character) "x(35)" to display the name of the bank. The problem is that if the name is less than the field size which is 35 the system puts blank spaces till the 35th character. Can anyone knows how to delete those blank spaces.

Thanks
Marinos
 
This has been asked and answered already, i.e. TRIM or RTRIM functions should work.

Please post example code that produces the problem.

 
I have use the TRIM and RTRIM function but is not working on my program. Whenever i use the right trim function cuts the half of the field. Can you please help me how can i solve this?

Thanks
 
Sorry for not answering earlier but i was very busy. This is the code for the PUT Statement:
/************************************ Acp20088.i * Bank Transfer Expense Statement******************************/
w3-total = (w3-total + exp-total)-(exp-advpay).

if last-of(exp-emp)then do:
put
"#" at 01
"EG" at 02
"#" at 04
"EFT" at 05
"#" at 08
w1-finaldate at 09
"#####" at 17
w-cush at 22
"#" at 25
w3-total at 26
"##" at 36
w1-bankbacc at 37
"#####" at 47
"#####" at 52
"OUR" at 57
"###" at 60
w1-expref at 63
"##########" at 80
"#########" at 90
w1-empbacc at 100
"#" at 134
w1-empname at 135
"##" at 170
w1-empadr at 172
"#" at 207
w2-empadr at 208
"#######" at 243
emp-swift at 250
"#" at 286
bank-adr at 287
"########" at 323
"########" at 331
emp-branch at 339
"####" at 374
"NOADVISE" at 378
"###" at 386
w1-bankbacc at 389
"##" at 399
"Not a Bank" at 401.
PUT SKIP.

w4-total = w4-total + w3-total.
w3-total = 0.
end.

w2-count = w2-count + 1.

And this is the output:
#EG#EFT#20100531#####EGP# 20.00# ##########OUR###20 #################### # ## # ####### # ################ ####NOADVISE#####Not a Bank



Thanks
 
Your code and output will be easier to read if you post it between 'code' tags like this:

[ignore]
Code:
<your code and output goes here>
[/ignore]

Is 'emp-branch' the bank name field you are concerned with?

It looks to me like your output is a fixed-length format and you have supplied the correct position for the following '###' constant, i.e. there is room for a 35 character field between position 339 and position 374.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top