This is a post now to the listserv, instead of the Google group. Sorry for the 
duplication!

Hi, I have a comma-delimited extract from a file that has numeric and character 
fields, and I would like to turn it into a true CSV file by making the 
character fields quoted.

I have a 2-line header (column names, and column types) which indicates which 
are CHAR fields, but cannot figure out how to capture the information from the 
header to apply to the actual data lines.

For example, I have this in my file:
ITM_ID,DESC,SHORT_DESC,U_M,UNIT_PRICE,ON_HAND,COMMIT,INV_HOLD,DISC_QTY,DISC_PCT,B_O_QTY,ON_ORD,ACT_YR,ACT_MO,ACT_DAY
                                      
CHAR(10) N.N.,CHAR(30) NOT NULL,CHAR(8) N.N.,CHAR(4) N.N.,DEC(7,2) 
N.N.,DEC(7,0) N.N.,DEC(7,0) N.N.,CHAR(1) N.N.,DEC(7,0) N.N.,DEC(3,1) 
N.N.,DEC(7,0) N.N.,DEC(7,0) N.N.,CHAR(2) N.N.,CHAR(2) N.N.,CHAR(2) N.N.
A10000,CARPETED RUBBER 
MATS-FRONT-RED,FLOORMAT,PAIR,22.99,135,205,Y,5000,1.5,0,0,87,02,02
A10001,CARPETED RUBBER 
MATS-REAR(RED),FLOORMAT,PAIR,12.99,277,14,N,250,1.5,0,0,86,02,20  
A10002,PERSONALIZED VINYL 
MATS(BEIGE),FLOORMAT,PAIR,19.99,296,7,N,250,1.5,0,0,87,02,03  
A10003,4-PIECE CARPET MAT SET (BLUE),MAT 
SET,SET,19.99,275,2,N,250,1.5,0,0,87,02,03      
A10004,SPLASH GUARDS-ALUMINUM,SPLSHGRD,PAIR,8.99,523,55,N,500,1.5,0,0,87,02,03  
        
A10005,SPLASH GUARDS-VINYL,SPLSHGRD,PAIR,8.99,550,25,N,500,1.5,0,0,87,02,03     
         
A10006,MONOGRAMMED SPLASH 
GUARDS,SPLSHGRD,PAIR,11.99,300,0,N,250,1.5,0,0,86,02,20        

and want the output to look like this:
"A10000","CARPETED RUBBER 
MATS-FRONT-RED","FLOORMAT","PAIR",22.99,135,205,"Y",5000,1.5,0,0,87,02,02
"A10001","CARPETED RUBBER 
MATS-REAR(RED)","FLOORMAT","PAIR",12.99,277,14,"N",250,1.5,0,0,86,02,20  
"A10002","PERSONALIZED VINYL 
MATS(BEIGE)","FLOORMAT","PAIR",19.99,296,7,"N",250,1.5,0,0,87,02,03  
"A10003","4-PIECE CARPET MAT SET (BLUE)","MAT 
SET","SET",19.99,275,2,"N",250,1.5,0,0,87,02,03      
"A10004","SPLASH 
GUARDS-ALUMINUM","SPLSHGRD","PAIR",8.99,523,55,"N",500,1.5,0,0,87,02,03         
 
"A10005","SPLASH 
GUARDS-VINYL","SPLSHGRD","PAIR",8.99,550,25,"N",500,1.5,0,0,87,02,03            
  
"A10006","MONOGRAMMED SPLASH 
GUARDS","SPLSHGRD","PAIR",11.99,300,0,"N",250,1.5,0,0,86,02,20        

Is there a way to see which column type contains CHAR( -- each of the types is 
column separated -- and then be able to apply quotes to that particular output 
field? I am not sure about this, but hope there is an answer here.

Thank you for your help!
Don Johnson
Sr. Principal Support Engineer  |  MSD - Datacom product family
Broadcom Software

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to