I need a space between commas in a comma delimited file

Pickering, John (NORBORD) PICKERIJ@norbord.com
Tue, 19 Oct 1999 13:45:03 -0400


>VAX/VMS    POWERHOUSE 710G1
same answer for all platforms

>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 " "

these 2 statements do nothing except waste machine cycles

>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

how about:

define x char*10 = tru(some_field) + "," &
  if "" ne some_field else " ," ; that's blank comma
define y char*10 = tru(other_field) + "," &
  if "" ne other_field else " ," ; that's blank comma
 ; repeat this for all 75 fields :-(

define dataline char*100 &
 = tru(x) + tru(y) + ... all the rest

John Pickering
JWP Systems Inc
Toronto

ps. How many would like enhancements to subfile creation options in both
Quiz and Qtp (actually I'd settle for even one of them :-) so that subfiles
could be generated as comma sep or tab delimited files? Why limit it to tab
as a delimiter - let me specify it! Enhancements? What's that?
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
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.