Convert Each Record in Database File to Fixed-Width Text Fil
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts
Page 1 of 1
I need to create order confirmations to send to a website. All the information that needs to be sent is stored in database file, one record per confirmation.
I need to read through the database file and convert each record into a fixed-width text file, with the value of the key field as part of the file name. (For example if the value in the key field is 'ABCD' then the text file would be named 'conf-ABCD.txt.)
Once a record has been converted, it can be deleted from the database file. Once all the records are converted, they will be ftp-ed to the website.
The database file can contain zero or more records, depending on how many orders have been shipped since the last time the project was run.
What is the best way to handle this? Does anyone have an example project that does something similar that they'd be willing to share?
Thanks!
Janell Haskins
Senior Business Analyst & System Manager
Knit-Rite, Inc.
I need to read through the database file and convert each record into a fixed-width text file, with the value of the key field as part of the file name. (For example if the value in the key field is 'ABCD' then the text file would be named 'conf-ABCD.txt.)
Once a record has been converted, it can be deleted from the database file. Once all the records are converted, they will be ftp-ed to the website.
The database file can contain zero or more records, depending on how many orders have been shipped since the last time the project was run.
What is the best way to handle this? Does anyone have an example project that does something similar that they'd be willing to share?
Thanks!
Janell Haskins
Senior Business Analyst & System Manager
Knit-Rite, Inc.
- Support Specialist
- Posts: 590
- Joined: Tue Jul 17, 2012 2:12 pm
- Location: Phoenix, AZ
-
Janell,
A pseudo-code option to this would be something like the following:
A pseudo-code option to this would be something like the following:
Code: Select all
Hope this helps!CreateWorkSpace
SQL-Read Database to create Rowset (Data)
For-Each ${Data}
SetVar ToFile = ${ Concat( 'Conf-', Data[x], '.txt') }
WriteFixedWidth WorkSpace/${ToFile}
(Data field definitions attached)
SQL-Delete from Database where ConfCode = ${Data[x]}
EndFor
Create File List - WorkSpace/*.txt (MyFileList)
FTP Target Server
Put-${MyFileList}
DeleteWorkSpace
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts
Page 1 of 1