View previous topic :: View next topic |
Author |
Message |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Tue May 15, 2007 2:29 am Post subject: Remove trailing spaces in Easytrieve |
|
|
Hi
I am concatenating two strings, each is of 50 char length. This will be reported in the header of a report.
String 1 has "Reassessment of UIT "
String 2 has "USA analysis report "
How do you remove the trailing spaces in the string after concatenating and finally have the text center aligned in the header. This should be done in Easytrieve. Can anybody please help me. _________________ Thanks
Madhu Sudhan |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12380 Topics: 75 Location: San Jose
|
Posted: Tue May 15, 2007 7:48 am Post subject: |
|
|
psmadhusudhan,
Please use a descriptive title to explain your problem, instead of a generic title. I have changed the title. Try this untested easytrieve solution. This combines both strings into a single string trimming the trailing spaces. If you are writing a report in easytrieve the title is automatically aligned to the center unless you override it.
Code: |
DEFINE W-INP-STRING1 W 050 A
DEFINE W-INP-STRING2 W 050 A
DEFINE W-OUT-STRING W 100 A
DEFINE W-OUT-STR W-OUT-STRING 001 A OCCURS 50
DEFINE W-STRING W 050 A
DEFINE W-STR W-STRING 001 A OCCURS 50
DEFINE I-SUB W 002 B 0
DEFINE O-SUB W 002 B 0
DEFINE S-CHAR-FOUND W 001 A
JOB INPUT NULL
W-INP-STRING1 = 'REASSESSMENT OF UIT'
W-STRING = W-INP-STRING1
PERFORM STRIP-BLANKS
O-SUB = I-SUB + 2
MOVE W-STR(1) (I-SUB) TO W-OUT-STR (1) (O-SUB)
W-STRING = ' '
W-INP-STRING2 = 'USA ANALYSIS REPORT'
W-STRING = W-INP-STRING2
PERFORM STRIP-BLANKS
MOVE W-STR(1) (I-SUB) TO W-OUT-STR (O-SUB) (I-SUB)
STOP
STRIP-BLANKS. PROC
I-SUB = 50
S-CHAR-FOUND = 'N'
DO UNTIL I-SUB EQ 0 OR S-CHAR-FOUND = 'Y'
IF W-STR(I-SUB) > ' '
S-CHAR-FOUND = 'Y'
ELSE
I-SUB = I-SUB - 1
END-IF
END-DO
END-PROC
/* |
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
psmadhusudhan Beginner

Joined: 28 Nov 2006 Posts: 143 Topics: 48
|
Posted: Tue May 15, 2007 8:50 am Post subject: |
|
|
Thanks kolusu. I will try to use descriptive titles from now onwards. _________________ Thanks
Madhu Sudhan |
|
Back to top |
|
 |
|
|