writing quote (") to a file in a routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
hrthomson
Participant
Posts: 25
Joined: Fri Aug 20, 2004 9:57 am
Location: Ottawa, Canada

writing quote (") to a file in a routine

Post by hrthomson »

Hello,

We are trying to create a file from a routine and need to write double quotes to it. Does anyone know how to specify quote characters within the DataStage Basic language?


Thanks in advance,

Heather
what a man is contributes much more to his happiness than what he has, or how he is regarded by others.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Heather, in DataStage Basic you can use ", ', or / as a quote character interchangeably. So you can assign a double-quote via '"' or /"/ .
hrthomson
Participant
Posts: 25
Joined: Fri Aug 20, 2004 9:57 am
Location: Ottawa, Canada

Post by hrthomson »

Thanks for the quick response...however....

I have the following piece of code, using DOS to pipe a line to a file:

CALL DSExecute('DOS','echo SignonMake ' : '"' : ModelSignon : '"' : ' PromptForPassword False UserId ' : '"' : DBSignonUId : '"' : ' Password ' : '"' : DBSignonPwd : '"': ' >':SignonMDLFile,sResult,sReturnCode)

I get quotes around the first parameter, but none after that. If anyone has any ideas, they would be greatly appreciated.

cheers,

Heather
what a man is contributes much more to his happiness than what he has, or how he is regarded by others.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try using a function such as Quote or DQuote.

Code: Select all

CALL DSExecute('DOS', 'echo SignonMake ' : Quote(ModelSignon) : ' PromptForPassword False UserId ' : Quote(DBSignonUId) : ' Password ' : Quote(DBSignonPwd) : ' >' : SignonMDLFile, sResult, sReturnCode) 
Beware (search the forum) that passing quoted strings to another shell can cause one level of quotes to be stripped off. If you don't need to capture the result, you may be better off using the PERFORM statement with the DOS verb.

Code: Select all

Command = 'echo SignonMake ' : Quote(ModelSignon) : ' PromptForPassword False UserId ' : Quote(DBSignonUId) : ' Password ' : Quote(DBSignonPwd) : ' >' : SignonMDLFile
PERFORM "DOS /C " : Command
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
manojmathai
Participant
Posts: 23
Joined: Mon Jul 04, 2005 6:25 am

Post by manojmathai »

Hi

You can use char(34) to put double quotes while creating a file from the routine.

For eg : Char(34) : "Tom" : Char(34) will give the out file as "Tom"

Regards
Manoj
hrthomson
Participant
Posts: 25
Joined: Fri Aug 20, 2004 9:57 am
Location: Ottawa, Canada

Post by hrthomson »

Hi

I tried all three of the above suggestions and am still not getting the quotes after the first parameter. Actually, the PERFORM command doesn't do anything.

And we've just discovered that if the parameter value has a space in it, the quotes work, otherwise they're ignored.

So I guess my question is, is there any way to force quotes to a file. I run the same command on the dos prompt, and everything is fine.

Again, thanks for your help.

Heather
what a man is contributes much more to his happiness than what he has, or how he is regarded by others.
hrthomson
Participant
Posts: 25
Joined: Fri Aug 20, 2004 9:57 am
Location: Ottawa, Canada

Post by hrthomson »

Hi everyone, me again.

I ended up using the OpenSeq command and writing to the file that way. Since this is supposed to be dynamic, I'll simply use the DOS command to pipe to and create an empty file.

Thanks again for your input.

cheers,

Heather
what a man is contributes much more to his happiness than what he has, or how he is regarded by others.
Post Reply