jBASE 4.1 Linux - Concatenate

140 views
Skip to first unread message

ww

unread,
Oct 13, 2009, 4:09:17 PM10/13/09
to jBASE
I have the following code and I want EMAIL.BODY to be one long string
that I can email.

CNT = DCOUNT(ITM, AM)
FOR I = 1 TO CNT
ITM<I> = ITM<I>:CRR
EMAIL.BODY = EMAIL.BODY:ITM<I>
NEXT I

If I CRT EMAIL.BODY all I get is the last line rather than a long
string of all the ITM items.

Any thoughts?

pat

unread,
Oct 13, 2009, 5:59:38 PM10/13/09
to jBASE
I assume 'CRR' is a <carriage return> ( CHAR(13) ), rather than
<carriage return><linefeed> sequence ( CHAR(13):CHAR(10) ) ?

Your 'CRT' would, in that case, be displaying the entire 'ITEM.BODY',
however each successive 'line' is 'overwriting', in the preceding
'line' on terminal display

Pat.

Igor Micev

unread,
Oct 13, 2009, 5:38:32 PM10/13/09
to jBASE
You missed to do concatenation of EMAIL.BODY
EMAIL.BODY := EMAIL.BODY:ITM<I>


JOSE L MARTINEZ-AVIAL

unread,
Oct 13, 2009, 5:26:29 PM10/13/09
to jb...@googlegroups.com
Try this.

EMAIL.BODY =''
CNT = DCOUNT(ITM, AM)
FOR I = 1 TO CNT
EMAIL.BODY:=ITM<I>:CRR
NEXT I

2009/10/13 ww <wa...@waltwhite.com>

ww

unread,
Oct 13, 2009, 6:27:44 PM10/13/09
to jBASE
Thanks folks. I never knew there was a := operator so that's nice to
know. And the CRR was only a carriage return so I changed that as
well. The final code is:

EMAIL.BODY = ''
CNT = DCOUNT(ITM, AM)
FOR I = 1 TO CNT
EMAIL.BODY:=ITM<I>:CHAR(13):CHAR(10)
NEXT I
CRT @(-1)
CRT EMAIL.BODY

which produces the proper result.

Thanks again,

WW

bw@ht

unread,
Oct 14, 2009, 10:46:29 AM10/14/09
to jBASE
The simplest way of all is to do a global search & replace:

EMAIL.BODY = CHANGE(ITM,AM,CHAR(13):CHAR(10))
then add the final CRLF
EMAIL.BODY := CHAR(13):CHAR(10)

It's also my impression that jBase does this conversion automatically
when an attribute mark delimited record is written directly to an
Operating System folder, e.g. a program source directory.
Reply all
Reply to author
Forward
0 new messages