Read Flat File

  • Thread starter Adrian_Chimirel
  • Start date
Adrian_Chimirel

Adrian_Chimirel

Legendary Poster
The Search site returns way too many posts ... can't use it (tried flat + file, text + file, read + text, ....)
confused.gif

I want to read a flat file but B76B0220 Fetch Next Line From Fat File returns error code = 1. This is my code:
Listing of ER for Report: Report : Load Ceridian (Payroll) Flat File (R560904)
=======================================================================
SECTION: Driver [GROUP SECTION] (S3)
=======================================================================
OBJECT: SECTION
EVENT: Do Section
-----------------------------------------------------------------------
0001 // Open Flat File
0002 Open Flat File
RV Error Code <- cErrorCode
RV Error Message <- szErrorMessageId
<Zero> -> cAppendMode
VA rpt_mnFilePointer_GENLNG <- idFilePtr
VA rpt_szPathAndFile_EFRM -> szFilePath
0003 RV File Pointer = VA rpt_mnFilePointer_GENLNG
0004 While VA rpt_szFlatFileRecord_FFRC is not equal to <Blank> And VA rpt_szFlatFileRecord_FFRC is not equal to <Null>
0005 // Fetch Line from Flat File while it returns a record
0006 Fetch Next Line from Flat File
VA rpt_szPathAndFile_EFRM -> szFlatFileName
VA rpt_mnFilePointer_GENLNG -> idFilePtr
VA rpt_szFlatFileRecord_FFRC <- szFlatFileRecord
VA rpt_mnRecordLength_RCLN <- mnRecordLength
RV Error Code <- cErrorCode
RV Error Message <- szErrorMessageID
0007 RV My File Record = VA rpt_szFlatFileRecord_FFRC
0008 If RV Error Code is equal to <Zero>
0009 Do Custom Section(RS My Text File Upload)
0010 VA rpt_mnRecordCounter1_CNR1 = [VA rpt_mnRecordLength_RCLN]+1
0011 End If
0012 End While
0013 Close Flat File
RV Error Code <- cErrorCode
RV Error Message <- szErrorMessageId
VA rpt_mnFilePointer_GENLNG -> idFilePtr
Friday March 06, 2009 15:37
 
Error code '1' is returned when the business function can't find any more records to read. Make sure the file has records in it, and that they are formatted correctly. Also check to see if the error is happening when you call "Open Flat File".
 
Good point! I've changed the Open File append parameter from Zero to '1' -> cAppendMode, and I don't get the error anymore.
But I still don't get any line from my text file (I do have many many lines there like these two:
30002210 CAD 3500SCORE 011509
70001100 CAD 72750GARNISHEE 011509

What am I doing wrong?
 
Adrian,

when your While statement is first encountered
"While VA rpt_szFlatFileRecord_FFRC is not equal to <Blank> And VA rpt_szFlatFileRecord_FFRC is not equal to <Null>"
what is the value in the variable VA rpt_szFlatFileRecord_FFRC ?

Hint: this is a trick question
 
It was set to the word 'blank' in the Initialize Section event, just to ignite the loop, Larry
grin.gif

But, it would not cycle (now I am passing the record length to the bsfn), see attached.
 

Attachments

  • 143849-R560904 ER.txt
    5.2 KB · Views: 246
As far as narrowing your JDEList search result frustrations...

+read +text
returns more focused results than
+ read + text or
read +text

The search engine does not infer a "+" on the initial keyword.
 
Thank you kindly Curtis
blush.gif

Every day I learn something from JDEList
cool.gif
 
Thank you everybody.
After using the Cross Reference, I saw how the BSFN is to be used - and it works! See attached.
 

Attachments

  • 143855-R560904 20090307.txt
    10.6 KB · Views: 396
Hi Adrain,

Little surprised!! the ER dump that u published, looks different than the usual er dump that we get from JDE (standard way).

Do you use any tool to get ER Dump?
 
Hi Gov,
That'a a very good question - sorry I didn't mention, the text is the result of a VERY useful tool named OneAssist. You may take its trial version for a ride from Alex' EverestSoftware website.
It was love at first sight for me, and I made it a standard documentation tool here, at ERCO. OneAssist plus Boomerang allowed us to do the upgrade from 810 to 812 with one developer and a half (me
grin.gif
), only.
 
I have no problem with it for the first fifty times. But if it happens the fiftyfirst time, I'll do what my dad did
shocked.gif
 
Back
Top