Urgent Help needed!!.. again same problem. exporting Data
from txt to Subfile
Jeff Hoffman
wonicon at optusnet.com.au
Thu Mar 8 19:48:54 CST 2007
Vamsi
Here is some code that should work, has not been tested. Depends on
you having a file defined in your dictionary.
*********************
acc tempfile ; tempfile consists of 1 field temprec CHAR,
; size as required (see file_len)
sel tempfile if temprec[1:1] <> delim ;ignore trailer records
; Program Variables
def file_len = 400 ; max record length of
; tempfile
def delim char*1 = " " ; or whatever
temp strt
temp endd
; User Variables
temp cust-no
temp order-no
temp part-no
; Col A Customer number
item strt = 1
item endd = index(temprec[strt:file_len -strt],delim)
item cust-no = ncon(temprec[strt:endd -1])
; Col B Order Number
item strt = strt + endd
item endd = index(temprec[strt:file_len -strt],delim)
item order-no = ncon(temprec[strt:endd -1])
; Col C Part Number
item strt = strt + endd
item endd = index(temprec[strt:file_len -strt],delim)
item endd = file_len - strt &
if endd < 1 else & ; last field could fill
the record
; so there may not be a
trailing delimiter
endd
item part-no = ncon(temprec[strt:endd -1])
subfile wks1 keep include &
rego-no, order-no, part-no
; subfile can be an indexed subfile but this could be slow
; if handling a large number of records
; depends upon operating system
go
*****************************************************************
Jeff
PS it would help if you could include you environment details, next time
At 03:09 AM 9/03/2007, you wrote:
>Guys,
>
>I tried my best to do this.. but failed..
>
>Please find the attached text file.
>
>Here's what i need to do..
>
>There are three items in the text file:
>
>1st:Customer number
>2nd: Order Number
>3rd: Part Number
>
>In the powerhouse dictionary,
>Customer number's size is 9
>order number's size is 20
>Part Number's size is 12 (right Justified with spaces)
>
>In the attached file:
>Customer number's size is 9
>order number's size is 5
>Part Number's size is 7 or 6 ( no proper justification)
>
>Now i need a subfile which will contain all the three items, and I
>should be able to link them with dictionary file (that means subfile
>should contain index consisting of all three items)
>
>Please if anyone can send me the detailed process to deal with this,
>that would be really grateful.
>
>Let me know if you have any queries.
>
>Thanks and Regards,
>Vamsi
>
>--
>"Nothing is impossible as impossible itself says i m possible"
>Content-Type: text/plain; name=final.txt; charset=ANSI_X3.4-1968
>X-Attachment-Id: f_ez1eakt9
>Content-Disposition: attachment; filename="final.txt"
>
>--
>= = = = = = = = = = = = = = = = = = = = = = = = = = = =
>Mailing list: powerh-l at lists.sowder.com
>Subscribe: "subscribe" in message body to
>powerh-l-request at lists.sowder.com
>Unsubscribe: "unsubscribe <password>" in message
>body to powerh-l-request at lists.sowder.com
>http://lists.sowder.com/mailman/listinfo/powerh-l
>This list is closed, thus to post to the list you must be a subscriber.
>Add 'site:lists.sowder.com powerh-l' to your search terms to search
>the list archive at Google.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sowder.com/pipermail/powerh-l/attachments/20070309/225d7eff/attachment.htm
More information about the powerh-l
mailing list