|
Joel, I have done this in a program by doing a scan on the ~ and putting the results in an array. Then using the array to substring the values. For example: c eval data2 = delimiter + data c delimiter scan data2 posn c eval segment_id = %subst(data : posn(1)) c eval temp = %subst(data : posn(2)) c movel temp carseq c eval eqpgrp = %subst(data : posn(3)) c eval init = %subst(data : posn(4)) c eval temp = %subst(data : posn(5)) c movel temp car# As you can see, I needed a temporary character field (temp which is defined as the same size as data) for the numeric fields (carseq, car#). The original data is in field data, note that I put a ~(delimiter) in front of this (data2) to scan on. In that way the result array(posn) has the starting position of each delimited field, ie; posn(3) is the start position of the third field. Also, my example works because my database field sizes always matched the incoming data. It would be better to do the substring like: c eval field = %subst(data : posn(3) : posn(4) - posn(3)) This would only extract the data between the ~'s. If you have any questions feel free to e-mail me privately. Scott Mildenberger > -----Original Message----- > From: Stone, Joel [SMTP:StoneJ@GourmetAward.com] > Sent: Monday, February 07, 2000 9:05 AM > To: 'MIDRANGE-L@midrange.com' > Subject: Tilde delimited fields in a PC file - how to upload & > convert fie lds to AS/400 physical file > > An example record: > > 40354~KMART STORE# 37~3665 HWY > 6~~DALLAS~TX~77478~~~~~713-980-8888~~~4362~~100~3~0~0~~0~ > > Are there any utilities to split a file with records as shown above into > an AS/400 PF? I would like the tilde's gone, where each tilde acts as the > delimiter to begin a new field. > > Can Client/Access do this job by itself? > > What other options to I have. Does anyone know of a magazine article with > a free utility program? Other options? > > Must I build the DDS by hand? I have a listing of field names and > lengths. > > The data is from a query tool on a Unix box. > > Thanks! > > +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.