Reading from Flat file

KGS

Member
Hi,

I need to read from flat file using UBE(No Table Conversion).

The file format will be (12~~34~~56~~87).

The Fields are separated by two character (~~).

What Business function I can use to read from flat file and separate the fields?

Please help me.

Thanks in Advance
 
Hi SureshKumar,
I Created lot of Batches. Here i am sending event rules of one of my
batch. It may help full to you.
Here we use Business Function "Fetch Next Line from Flat File"

v WO Information Interface transfers work order released from PS-
P(Flat File Information) to E1 for processing of MRP messages in E1.
The Flat file information is divided into the Header record, which has
to update in to F4801 and Routing record, which had to be update in
F3112 in E1.

=D8 // Read flat file specified in the processing option

=D8 Fetch Next Line from Flat File

=D8 PO szVariableLengthField1 -> szFlatFileName

=D8 VA sec_idGenericLong_GENLNG <> idFilePtr

=D8 VA sec_szFlatFileRecord_APTA <- szFlatFileRecord

=D8 "100" -> mnRecordLength

=D8 VA sec_cEverestEventPoint01_EV01 <- cErrorCode

=D8 // Read flat file until the END of the file

=D8 While VA sec_cEverestEventPoint01_EV01 is equal to <Zero>

o VA rpt_szIdentifier2ndItem_LITM =3D substr([VA
sec_szFlatFileRecord_APTA],0,9)

o VA rpt_szFillerSpaces_AA09 =3D substr([VA sec_szFlatFileRecord_APTA ],9,9)

o VA rpt_szPLCCategory_PLC =3D substr([VA sec_szFlatFileRecord_APTA], 18,3)

o VA rpt_szDispoBulletin_AA10 =3D substr([VA
sec_szFlatFileRecord_APTA],21,10)

o Convert String to Math Numeric

=D8 VA rpt_szDispoBulletin_AA10 -> szInputString

=D8 VA rpt_mnDispoBulletin_DOCO <- mnOutputMathNumeric

o VA rpt_szActiondate_AA10 =3D substr([VA sec_szFlatFileRecord_APTA], 31,10)

=D8 ! VA rpt_szsubstryear_AA04 =3D substr([VA rpt_szActiondate_AA10 ],31,4)

=D8 ! VA rpt_szsubstring_AA05 =3D substr([VA rpt_szActiondate_AA10] ,36,5)

=D8 ! VA rpt_szconvertedstr_VC10A =3D concat(concat([VA
rpt_szsubstring_AA05],'-'),[VA rpt_szsubstryear_AA04])

o Convert String to Date Using Format Mask

=D8 VA rpt_jdFSCActionDate_FSCACJ <- ConvertedDate

=D8 VA rpt_szActiondate_AA10 -> StringToConvert

=D8 "OSASE" -> FormatMask

o VA rpt_szFSCDirection_FSCD =3D substr([VA sec_szFlatFileRecord_APTA ],41,2)

o VA rpt_szFillerspaces_AA06 =3D substr([VA sec_szFlatFileRecord_APTA ],43,6)

o F552203.Insert

=D8 VA rpt_szIdentifier2ndItem_LITM -> TK 2nd Item Number

=D8 VA rpt_mnDispoBulletin_DOCO -> TK Document (Order No, Invoice, etc .)

=D8 VA rpt_jdFSCActionDate_FSCACJ -> TK Date - FSC Action

=D8 VA rpt_szFSCDirection_FSCD -> TK FSC Direction

=D8 VA rpt_szPLCCategory_PLC -> TK PLC Category

o Fetch Next Line from Flat File

=D8 PO szVariableLengthField1 -> szFlatFileName

=D8 VA sec_idGenericLong_GENLNG <> idFilePtr

=D8 VA sec_szFlatFileRecord_APTA <- szFlatFileRecord

=D8 "100" -> mnRecordLength

=D8 VA sec_cEverestEventPoint01_EV01 <- cErrorCode

o End While





Thanks.........


fields?




--
Bindu K
 
Hi,

To read the flat file you can use BSFN "B76B0220 FetchNextLinefromFlatFile". You need to create a while loop with this BSFN for the retrieval. For more information on using of the BSFN please check to Oracle Metalink3.

After you read the record based on your field positions you can trim-out the separators using event logic.
 
hi . in this case if we dont know the length of the Flat file, then how to process it. my issue is i want to count total number of lines in my flat file. and number of lines will be more than 2000. how to get that by using this BSFN. its urgent . plz help
 
hi,
if you want to count number lines in your flat file then use this logic.



Fetch Next Line from Flat File

PO szVariableLengthField1 -> szFlatFileName

VA sec_idGenericLong_GENLNG <> idFilePtr

VA sec_szFlatFileRecord_APTA <- szFlatFileRecord

"100" -> mnRecordLength

VA sec_cEverestEventPoint01_EV01 <- cErrorCode

Count = 1

// Read flat file until the END of the file

While VA sec_cEverestEventPoint01_EV01 is equal to <Zero>



Fetch Next Line from Flat File

PO szVariableLengthField1 -> szFlatFileName

VA sec_idGenericLong_GENLNG <> idFilePtr

VA sec_szFlatFileRecord_APTA <- szFlatFileRecord

"100" -> mnRecordLength

VA sec_cEverestEventPoint01_EV01 <- cErrorCode

Count = Count +1

End While



Here Count variable stores how many number of records in the flat file.


Regards,
Lakshmi



--
Bindu K
 
hi,

Length of flat file no need to know. you need to know the length of record per line if u dont know you can give the max length. Then you read the file one by one using the while loop and increment the variable in side the loop u will get the no of lines in the flat file.
 
Hi please i need your help.

I use the bsfn next flat file, when i arrive for example to the fourth line of the flat file, i cant retrieve all the characters ofthe line, the bsfn retrieves the middle or some caracters of the line
Do you have an idea how can i fix it please ?
Thank you a lot
 
Hi redah


Please mention your JD release?

Can you please attach the file in your post?

Regards
Jitender
 
Re: Reading Flat file

Hi,I have one issue regarding flat file.
I want to know whether a flat file is present in a given path.if file is not found it should give an error otherwise it should read all the records in the flat file.these flat file records should be checked with a table f3002,if a condition is satisfied it should update the records in f3002 otherwise all the records which are not updated in f3002 should write in the pdf.can anyone help me regarding this
 
Back
Top