View previous topic :: View next topic
|
Author |
Message |
NithyaSiva
New User
Joined: 26 Nov 2006 Posts: 10 Location: Bangalore
|
|
|
|
Hello, I have an easytrieve program which reads a file and writes a report. Header of the report is written using a variable from the file. The header consitutes of a variable and a fixed text. i am concatenating this variable text and the fixed text. both are of alphanumeric 50. after concatenating, i have still 30 to 40 spaces as blanks. While printing this header, as this is aligned center (the complete text with spaces), the report looks to have a left aligned header. Can anybody help me in suppressing leading and trailing spaces. Please. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
If you want to put in the work, between the index and varying parameters of the define, you could (easily) truncate the trailing blanks and (less easily) get rid of the leading blanks.
Do you have a reference guide? |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
Could you clarify,
are you using the HEADING or TITLE command for this? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Stumbled across this, if it works, good job VB
VB wrote: |
Here's a macro:
MACRO 4 FIELD1 SIZE1 FIELD2 SIZE2
*-----------------------------------------------------------------------
* THIS MACRO TAKES ONE FIELD, TRIMS IT AND CENTERS IN ANOTHER
* USES INDEXES
*-----------------------------------------------------------------------
DEFINE FIELD11 &FIELD1 1 A OCCURS &SIZE1 INDEX I1
DEFINE FIELD22 &FIELD2 1 A OCCURS &SIZE2 INDEX I2
I1 = &SIZE1
I2 = 0
&FIELD2 = ' '
DO WHILE I1 GT 0 AND FIELD11 EQ ' '
I1 = I1 - 1
END-DO
I1 = I1 + 1
IF I1 > 0
I2 = (&SIZE2 - I1) / 2 + 1
MOVE &FIELD1 TO FIELD22 I1
END-IF
To use:
FILE PERSNL
NAME-FIRST 25 8 A
W-CENTERED W 30 A
JOB INPUT PERSNL
%CENTER NAME-FIRST 8 W-CENTERED 30
DISPLAY '-' W-CENTERED '-' |
|
|
Back to top |
|
|
NithyaSiva
New User
Joined: 26 Nov 2006 Posts: 10 Location: Bangalore
|
|
|
|
Thanks so much Thomson and IQofaGerbil.
Thomson, i will try this tomorrow and will let you know how this works. Thanks a lot for your help. |
|
Back to top |
|
|
|