hi,
could you please tell us what is the issue and probably the error(s) your
code is returning?.

thank u.

rgds


rafael

2009/9/3 Crusader Sterling Pensions <[email protected]>

>
> I am trying to read from a CSV file, below is my program:
>
>
> SUBROUTINE CSP.UPLOAD.EMPLOYER
>
> *
>
> $INSERT I_EQUATE
>
> $INSERT I_COMMON
>
> $INSERT I_F.CUSTOMER
>
> $INSERT I_F.CATEGORY
>
> $INSERT I_F.PF.EMPLOYER
>
> *
>
> GOSUB INITIALIZE
>
> GOSUB PROCESS.REC
>
> RETURN
>
> *
>
> INITIALIZE:
>
> *
>
> FN.PF.EMPLOYER = 'F.PF.EMPLOYER$NAU'
>
> F.PF.EMPLOYER = ''
>
> CALL OPF(FN.PF.EMPLOYER,F.PF.EMPLOYER)
>
> DEBUG
>
> *
>
> FILE.NAME = 'employer_rc':'.csv'
>
> * Modification of Initial Program to open upload folder
>
> F.FOLDER = ''
>
> F.FOLDER = 'CUSTREG.FILES'
>
> OPEN F.FOLDER TO F.SEQ.FILE.PATH ELSE RETURN
>
> RETURN
>
> *
>
> PROCESS.REC:
>
> YF.COUNT = 0
>
> F.FOLDER = F.FOLDER:'/'
>
> DEBUG
>
> OPEN F.FOLDER TO F.IN.QUEUE THEN
>
> SEL.CMD = "SELECT ": F.FOLDER:" WITH @ID UNLIKE ...-..."
>
> CALL EB.READLIST (SEL.CMD, SEL.LIST,'',Y.RECNO,RET.CODE)
>
> IF Y.RECNO LT '1' THEN
>
> PRINT "ERROR"
>
> RETURN
>
> END
>
> LOOP
>
>
>
> REMOVE Z.YID FROM SEL.LIST SETTING Y.POS
>
> YF.COUNT += 1
>
> YREC.NO = 0
>
> WHILE Z.YID DO
>
> YR.ASCII.ID = Z.YID
>
> IF NOT (INDEX(YR.ASCII.ID,'-',1)) AND YR.ASCII.ID NE '' THEN
>
> READ YR.ASCII.REC FROM YF.ASCII.FILE, YR.ASCII.ID THEN
>
> WRITE YR.ASCII.REC TO YF.ASCII.FILE, YR.ASCII.ID
>
> WRITE YR.ASCII.REC TO YF.ASCII.OUT, YR.ASCII.ID
>
> DELETE YF.ASCII.FILE, YR.SCII.D
>
> END
>
> YOFS.REC = ''
>
> TT1.CNT = 0
>
> TT1.CNT = DCOUNT(YR.ASCII.REC,FM)
>
> DEBUG
>
> FOR TT1 = 1 TO TT1.CNT
>
> YR.ASCII.ENT = YR.ASCII.REC<TT1>
>
> EMP.ID = YR.ASCII.ENT[',',1,1]
>
> NEXT TT1
>
>
>
>
>
> * Read and process each line of the file in loop
>
>  Y.TRANS.CNT = 0
>
>  YEOF = 0
>
>  LOOP
>
>  READSEQ R.SEQ.REC FROM F.SEQ.FILE.PATH ELSE YEOF = 1
>
>  WHILE NOT(YEOF) DO
>
>  EMP.ID = FIELD(R.SEQ.REC,',',1)
>
>  EMP.NAME = FIELD(R.SEQ.REC,',',2)
>
>  EMP.SHORT = FIELD(R.SEQ.REC,',',3)
>
>  EMP.REG.ADD1 = FIELD(R.SEQ.REC,',',4)
>
>  EMP.REG.ADD2 = FIELD(R.SEQ.REC,',',5)
>
>  EMP.STATE = FIELD(R.SEQ.REC,',',6)
>
>  EMP.COUNTRY = FIELD(R.SEQ.REC,',',7)
>
>  EMP.NO = FIELD(R.SEQ.REC,',',8)
>
>  EMP.SECTOR = FIELD(R.SEQ.REC,',',9)
>
>  EMP.IND = FIELD(R.SEQ.REC,',',10)
>
>  EMP.WEB = FIELD(R.SEQ.REC,',',11)
>
>  EMP.CONTRIB1 = FIELD(R.SEQ.REC,',',12)
>
>  EMP.CONTRIB2 = FIELD(R.SEQ.REC,',',13)
>
> PF.REC = ""
>
> PF.ID = EMP.ID
>
> PF.REC<PF.EMP.EMPLOYER.NAME> = EMP.NAME
>
> PF.REC<PF.EMP.SHORT.NAME> = EMP.SHORT
>
> PF.REC<PF.EMP.REG.ADDRESS> = EMP.REG.ADD1
>
> PF.REC<PF.EMP.EMPLOYER.LGA> = EMP.REG.ADD2
>
> PF.REC<PF.EMP.EMPLOYER.STATE> = EMP.STATE
>
> PF.REC<PF.EMP.COUNTRY> = EMP.COUNTRY
>
> PF.REC<PF.EMP.NO.EMPLOYEE> = EMP.NO
>
> PF.REC<PF.EMP.SECTOR> = EMP.SECTOR
>
> PF.REC<PF.EMP.INDUSTRY> = EMP.IND
>
> PF.REC<PF.EMP.WEBSITE> = EMP.WEB
>
> PF.REC<PF.EMP.PER.COY.CONTRIB> = EMP.CONTRIB1
>
> PF.REC<PF.EMP.PER.EMP.CONTRIB> = EMP.CONTRIB1
>
> PF.REC<PF.EMP.RECORD.STATUS> = 'INAU'
>
> PF.REC<PF.EMP.CURR.NO> = '1'
>
> PF.REC<PF.EMP.INPUTTER> = '32_EYOANWAN'
>
> PF.REC<PF.EMP.DATE.TIME> = '0903111530'
>
> PF.REC<PF.EMP.CO.CODE> = 'NG0010001'
>
>
>
>  CALL F.WRITE(FN.PF.EMPLOYER,EMP.ID,PF.REC)
>
>  CALL JOURNAL.UPDATE(EMP.ID)
>
>  REPEAT
>
> END
>
> Pls what am doing wrong......
>
> Thanks
>
> On 6/19/09, Mike Preece <[email protected]> wrote:
>>
>>
>>
>>
>> On Jun 18, 1:25 pm, ufuktu <[email protected]> wrote:
>> > Thanks for all your help, I have written a multithreaded routine with
>> > load, select and processing routines... The bit I was struggling was
>> > when I was reading the CSV file which has a header and more than 1
>> > lines,,, thanks for the samples and correction to my code, that is all
>> > been fixed... Then I had this duplicated entries created,,, debugged
>> > my routine and realized that in the processing routine I missed
>> > "return" statement where the program looped and tried to create the
>> > same transaction for the same line again. This is all been sorted out
>> > now, I appreciate all your help.... Best Regards, Ufuk
>>
>> is=>has
>> is+>has
>> calls well
>>
>>
>>
>> >>
>>


-- 
Raphael

--~--~---------~--~----~------------~-------~--~----~
Please read the posting guidelines at: 
http://groups.google.com/group/jBASE/web/Posting%20Guidelines

IMPORTANT: Type T24: at the start of the subject line for questions specific to 
Globus/T24

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to