![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
From what I have read so far, this can be difficult if the CSV has abnormal characters, such as line feeds and quote marks in the fields. |
#2
| |||
| |||
|
|
Hello, My system is Universe v10 running on Windows 2003 I have a CSV file called deals.csv that I would like to make into a pick file called deals.mv I have been searching the group, trying to help myself, but honestly don't have the experience to make this work. I was hoping I could obtain some source code that would permit me to manually copy and paste the deals.csv file into my C:\IBM\UV folder, then when I run the program, it creates a new PICK file called deals.mv. Each row of the CSV file would be a record in the deals.mv file, with the name of the record being the very first field of each row in the deals.csv file. For example, the first row of deals.csv is 123456,starburst,bx,9.99,7950000232 I would like to turn that into a record in the deals.mv file entitled 123456 with the contents of the record being: 0001: 123456 0002: starburst 0003: bx 0004: 9.99 0005: 7950000232 From what I have read so far, this can be difficult if the CSV has abnormal characters, such as line feeds and quote marks in the fields. I believe my CSV file is "clean" and does not have any quotes or LF/CR in them. There are, however, spaces in some of the fields. Thank you in advance for any tips or assistance. Phil |
#3
| |||
| |||
|
|
To make your life easier, I'd open the file in Excel, then save as a tab delimited file --> Excel does this well, and you will not have any "issues" to deal with. Next, pop your file into a type 1/19 file (directory) so that it can be accessed. I'll assume that this file is called "DOS", the source item is called "SOURCE" and your target file is deals.mv, and that there isn't a "header" record for the SOURCE item Code would be : OPEN "","DOS" TO DOS.FV ELSE STOP "OPEN DOS FAILED" OPEN "","DEALS.MV" TO DEALS.FV ELSE STOP "OPEN TARGET FAILED" READ DOS.REC FROM DOS.FV,"SOURCE" ELSE STOP "SOURCE READ FAILED" * MANY WAYS TO IMPROVE THIS LOOP, BUT FOR SMALL * ITEMS THIS IS FINE NOL = DCOUNT(DOS.REC,@FM) ;* number of lines (new records) FOR I = 1 TO NOL ALINE = DOS.REC<I> ;* get a raw line CONVERT CHAR(9) TO @FM IN ALINE ;* put into UV format WRITE ALINE ON DEALS.FV, ALINE<1> ;* write it out NEXT I STOP "ALL DONE" hth Wytevette wrote: Hello, My system is Universe v10 running on Windows 2003 I have a CSV file called deals.csv that I would like to make into a pick file called deals.mv I have been searching the group, trying to help myself, but honestly don't have the experience to make this work. I was hoping I could obtain some source code that would permit me to manually copy and paste the deals.csv file into my C:\IBM\UV folder, then when I run the program, it creates a new PICK file called deals.mv. Each row of the CSV file would be a record in the deals.mv file, with the name of the record being the very first field of each row in the deals.csv file. For example, the first row of deals.csv is 123456,starburst,bx,9.99,7950000232 I would like to turn that into a record in the deals.mv file entitled 123456 with the contents of the record being: 0001: 123456 0002: starburst 0003: bx 0004: 9.99 0005: 7950000232 From what I have read so far, this can be difficult if the CSV has abnormal characters, such as line feeds and quote marks in the fields. I believe my CSV file is "clean" and does not have any quotes or LF/CR in them. There are, however, spaces in some of the fields. Thank you in advance for any tips or assistance. Phil |
#4
| |||
| |||
|
|
My system is Universe v10 running on Windows 2003 I have a CSV file called deals.csv that I would like to make into a pick file called deals.mv I have been searching the group, trying to help myself, but honestly don't have the experience to make this work. I was hoping I could obtain some source code that would permit me to manually copy and paste the deals.csv file into my C:\IBM\UV folder, then when I run the program, it creates a new PICK file called deals.mv. Each row of the CSV file would be a record in the deals.mv file, with the name of the record being the very first field of each row in the deals.csv file. For example, the first row of deals.csv is 123456,starburst,bx,9.99,7950000232 I would like to turn that into a record in the deals.mv file entitled 123456 with the contents of the record being: 0001: 123456 0002: starburst 0003: bx 0004: 9.99 0005: 7950000232 From what I have read so far, this can be difficult if the CSV has abnormal characters, such as line feeds and quote marks in the fields. I believe my CSV file is "clean" and does not have any quotes or LF/CR in them. There are, however, spaces in some of the fields. Thank you in advance for any tips or assistance. |
#5
| |||
| |||
|
|
...come to think of it, you could even replace UV with openQM and then wouldn't require any of those third party bits and their complication |
#6
| ||||||
| ||||||
|
|
I'm not sure from whence all of the Excel references came when you asked about CSV formated files |
|
- if you really want/need to use a spreadsheet application as a filter OOCalc is more capable |
|
and infinitely less expensive |
|
but: If your CSV file is RFC compliant or even if "all fields are wrapped in quotes", openQM has the ability to directly parse your file into either a hashed MV file or a directory file. The directory file may well be UV compatible but if not you could easily do a T-DUMP and simply T-LOAD into UV. |
|
An openQM license is vaguely equivalent to the cost of an Excel license |
|
and there is no need to import into Excel; export as another delimited format or install anyone's adware and the required transport layer license. Hmmmm ... come to think of it, you could even replace UV with openQM and then wouldn't require any of those third party bits and their complication - might make more sense than a mediocre spreadsheet application or "free" adware as filters. -Tom |
#7
| |||
| |||
|
#8
| |||
| |||
|
#9
| |||
| |||
|
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |