Pipe Delimited File Putting Quotes at Beggining & End of Row

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
7 posts Page 1 of 1

cderendinger

Posts: 5
Joined: Tue Jan 14, 2014 10:17 am

Post by cderendinger » Tue Jan 14, 2014 11:45 am
I am trying to write a pipe delimited text file. I am able to write the file but there are quotes at the beginning and end of each row. How do I write the file without the quotes?

Christina

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Tue Jan 14, 2014 11:56 am
Christina,

Please post the XML for your project here so that we can see what you're trying to do and help you correct it.

Or, email it to [email protected] and one of our Support Technicians will be glad to help!
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

cderendinger

Posts: 5
Joined: Tue Jan 14, 2014 10:17 am

Post by cderendinger » Tue Jan 14, 2014 12:24 pm
Below is the XML for the project that I am trying to create a pipe delimited file for.


Code: Select all
<project name="Phin Solutions Daily" mainModule="Main" version="2.0" logLevel="debug">

	<module name="Main" logLevel="debug">

		<createWorkspace version="1.0" />


		<timestamp version="1.0">
			<format outputVariable="today" pattern="MM-dd-yy" />
		</timestamp>


		<setVariable name="fileDate" value="${today}" version="2.0" />


		<sql resourceId="IBM iSeries" version="1.0" disabled="false">
			<query outputVariable="deleteFile">
				<statement>select * from scdata.phinfle</statement>
			</query>
			<query outputVariable="textFile">
				<statement>select * from scdata.phinfle2</statement>
			</query>
		</sql>


		<writeCSV inputRowSetVariable="${deleteFile}" outputFile="berlin_wheeler${fileDate}-o.del" fieldDelimiter="pipe" textQualifier="none" outputFileVariable="deleteFile2" version="1.0" />


		<writeCSV inputRowSetVariable="${textFile}" outputFile="berlin_wheeler${fileDate}-o.csv" fieldDelimiter="pipe" textQualifier="none" applyTextQualifierTo="all" outputFileVariable="textFile2" version="1.0" />


		<rename inputFile="${deleteFile2}" newName="l_berlin_wheeler${fileDate}.del" outputFilesVariable="deleteFile3" version="1.0" disabled="false" />


		<rename inputFile="${textFile2}" newName="l_berlin_wheeler${fileDate}.txt" outputFilesVariable="textFile3" version="1.0" disabled="false" />


		<copy destDir="resource:smb://BWMOSBS/Linoma/" whenFileExists="overwrite" version="1.0" disabled="false">
			<fileset dir="${system.job.workspace}" />
		</copy>


		<sftp resourceId="Phin Solutions" version="1.0" disabled="true">
			<put sourceFile="{delFile}" destinationDir="/inbox/" processedSourceFilesVariable="filesout" />
			<put sourceFile="${txtFile}" destinationDir="/inbox/" />
		</sftp>


		<sendEmail resourceId="Berlin Email" toList="[email protected]" version="2.0">
			<from address="[email protected]" />
			<subject>
				<![CDATA[Phin Solutions Daily File]]>
			</subject>
			<attachment file="${deleteFile2}" />
			<attachment file="${textFile3}" />
		</sendEmail>


		<deleteWorkspace version="1.0" />

	</module>

</project>

cderendinger

Posts: 5
Joined: Tue Jan 14, 2014 10:17 am

Post by cderendinger » Tue Jan 14, 2014 1:40 pm
Here is the XML for the project I have setup.
Code: Select all
<project name="Phin Solutions Daily" mainModule="Main" version="2.0" logLevel="debug">

	<module name="Main" logLevel="debug">

		<createWorkspace version="1.0" />


		<timestamp version="1.0">
			<format outputVariable="today" pattern="MM-dd-yy" />
		</timestamp>


		<setVariable name="fileDate" value="${today}" version="2.0" />


		<sql resourceId="IBM iSeries" version="1.0" disabled="false">
			<query outputVariable="deleteFile">
				<statement>select * from scdata.phinfle</statement>
			</query>
			<query outputVariable="textFile">
				<statement>select * from scdata.phinfle2</statement>
			</query>
		</sql>


		<writeCSV inputRowSetVariable="${deleteFile}" outputFile="berlin_wheeler${fileDate}-o.del" fieldDelimiter="pipe" textQualifier="none" outputFileVariable="deleteFile2" version="1.0" />


		<writeCSV inputRowSetVariable="${textFile}" outputFile="berlin_wheeler${fileDate}-o.csv" fieldDelimiter="pipe" textQualifier="none" applyTextQualifierTo="all" outputFileVariable="textFile2" version="1.0" />


		<rename inputFile="${deleteFile2}" newName="l_berlin_wheeler${fileDate}.del" outputFilesVariable="deleteFile3" version="1.0" disabled="false" />


		<rename inputFile="${textFile2}" newName="l_berlin_wheeler${fileDate}.txt" outputFilesVariable="textFile3" version="1.0" disabled="false" />


		<copy destDir="resource:smb://BWMOSBS/Linoma/" whenFileExists="overwrite" version="1.0" disabled="false">
			<fileset dir="${system.job.workspace}" />
		</copy>


		<sftp resourceId="Phin Solutions" version="1.0" disabled="true">
			<put sourceFile="{delFile}" destinationDir="/inbox/" processedSourceFilesVariable="filesout" />
			<put sourceFile="${txtFile}" destinationDir="/inbox/" />
		</sftp>


		<sendEmail resourceId="Berlin Email" toList="[email protected]" version="2.0">
			<from address="[email protected]" />
			<subject>
				<![CDATA[Phin Solutions Daily File]]>
			</subject>
			<attachment file="${deleteFile2}" />
			<attachment file="${textFile3}" />
		</sendEmail>


		<deleteWorkspace version="1.0" />

	</module>

</project>

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Tue Jan 14, 2014 2:14 pm
Christina,

A few things stand out in your XML script:

1- Your writeCSV tasks create 2 file variables ( deleteFile2 & textFile2 )
2- Your rename tasks renames those 2 files and creates corresponding variables ( deleteFile3 & textFile3 )
3- Your sftp task puts 2 files onto the "Phis Solutions" server as:
Code: Select all
		<sftp resourceId="Phin Solutions" version="1.0" disabled="true">
			<put sourceFile="{delFile}" destinationDir="/inbox/" processedSourceFilesVariable="filesout" />
			<put sourceFile="${txtFile}" destinationDir="/inbox/" />
		</sftp>
**NOTE** I know this is disabled, but .. just following the logic through your script.

{delFile} : Does not have a $ in front to make it a variable and is not defined within your XML
${txtFile} : Is not defined within your XML

4- Your sendEmail task attaches 2 file variables ( deleteFile2 & textFile3 ) -- these may be incorrect increments to attach. Not sure.

==================

What is it you are seeing in your output Files that is incorrect?
Also, do not forget you can add Data Options to your columns read from your IBMi Tables while writing to the writeCSV Task.
Do the values you're selecting from the Table already have DoubleQuotes attached?

Can you email us at [email protected] with examples of your data (before & after) so we can see what is happening?
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696

wfpturner

Posts: 7
Joined: Fri Jun 20, 2014 10:00 am

Post by wfpturner » Wed Aug 20, 2014 8:12 am
Was there ever a solution posted for this problem? I am encountering the same issue using the WRITECSV task to create a pipe-delimited text file. Some of the output records are completely enclosed in quotes. As an example, my output file will look like this:

Field1|Field 2|Field 3|Field 4
"Field1|Field 2|Field 3|Field 4"
"Field1|Field 2|Field 3|Field 4"
Field1|Field 2|Field 3|Field 4
"Field1|Field 2|Field 3|Field 4"
Field1|Field 2|Field 3|Field 4

It appears to be random as to which records are enclosed in quotes. I've analyzed the input data file and cannot see any reason or pattern as to why the quotes are there for some records.

Thanks.

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Wed Aug 20, 2014 9:50 am
Yes,

The user was using an incorrect Variable (Variable Name) thus the issue was associated to that.

We would need to see your XML file and review that to give you any indication of what's going on with your project. A snapshot of a few lines from the Source File would be an added bonus toward helping.

Thanks!
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
7 posts Page 1 of 1