I need a space between commas in a comma delimited file

Walker, Chris ChrisWalker@tateandlyle.com
Tue, 19 Oct 1999 18:36:56 +0100


You need to stop the TRUNC and PACK from removing your spaces.  (Actually
the TRUNC in your definition of DATALINE does nothing: a char*100 item will
always report 100 wide, TRUNCed or not.)

How about:

def x char*10 = trunc(some_field) + "," if some_field ne "" else " ,"
def y char*10 = trunc(some_field) + "," if other_field ne "" else " ,"

def dataline char*100 =			&
	trunc(x) +			&  = "BOB,"
	trunc(y)	+			&  = " ,"
	...

Chris Walker
Tate & Lyle
London

> -----Original Message-----
> From:	mmorgan@accubanc.com [SMTP:mmorgan@accubanc.com]
> Sent:	Tuesday, October 19, 1999 6:30 PM
> To:	powerh-l@lists.swau.edu
> Subject:	I need a space between commas in a comma delimited file
> 
> 
> 
> 
> 
> VAX/VMS    POWERHOUSE 710G1
> 
> Hello,
> 
> I?m trying to put a single space in a comma delimited file when a field IS
> blank (Don?t ask me why, I just have to do it).  The problem, is that
> there
> can?t be any leading or trailing spaces when the field is NOT blank.
> 
> I have to truncate and pack to get rid of the leading/trailing spaces, but
> I don?t want to trunc/pack if the field is blank.
> 
> Lets say SOME_FIELD = "BOB" and OTHER_FIELD IS BLANK
> 
> 
> DEFINE X CHAR*10 = SOME_FIELD IF SOME_FIELD NE "" ELSE " "
> DEFINE Y CHAR*10 = OTHER_FIELD IF OTHER_FIELD NE "" ELSE " "
> 
> DEFINE DATALINE CHAR*100 = &
> TRUNC(PACK(X + "," + Y + ","))
> 
> REPORT DATALINE
> 
> This would produce an output file that looks like this
> 
> BOB,,
> 
> What I want it to look like is this
> 
> BOB, ,
> 
> 
> I Have about 75 fields to deal with so if anyone can help, I sure would
> appreciate it.
> 
> Thanks,
> Mark
> 
> 
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> =
> Subscribe: "subscribe powerh-l" in message body to
> majordomo@lists.swau.edu
> Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
> This list is closed, thus to post to the list, you must be a subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.