Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 33

Thread: Reading Dynamic Flat Files

  1. #1
    Senior Member Larry_Jones's Avatar
    Join Date
    Nov 2000
    Location
    Spokane, WA, USA
    Posts
    3,254

    Reading Dynamic Flat Files

    Chris,

    Here is how I implemented a 'ReadTextLine' function as originally described by Zoltan.

    1. In OMW Copy Data Structures D34A1010A,B,C to D55A1010A,B,C
    2. Create New Data Structure - D55A1010D as follows:
    cSuppressErrorMessage Suppress ErrorMessage ->
    cErrorCode ErrorCode <-
    szErrorMessageId DataItem <-
    idFilePtr GenericLong ->
    szRecord VariableLengthField1 <-
    2. in OMW create a new BSFN - call it B55A1010 - that mirrors B34A1010:
    - Function Names almost same as in B34A1010 but change 'Flat' to 'Text' (you may want to append '55' also)
    - New Function - ReadTextLine
    - uses above new Data structures for functions
    3. Edit BSFN B55A1010 source - copying code from B34A101.c and .h and changing as appropriate to new function names, etc. Add Code for new function - ReadRextLine.

    See attached source code for B55A1010.c and .h

    Regards,
    Larry

    <original Post shown below>
    ----------------------------------------------------------------------
    I was most interested is in a some postings on JDELIST by yourself and Zoltan Gyimesi.
    They listed under 'Raading Dynamic Flat Files' and discussed the addition of a 'ReadNextLine' function to B34A1010.

    We have long wanted to input text files 'line by line' into our own UBE's, but have found no simple standard JDE solution.
    We currently have to endure the inconvenience and limitations of Table
    Conversion.

    Being a absolute novice C programmer, and being totally unfamiliar with JDE C conventions, I was hoping you might be able give us some pointers as to how to implement 'ReadNextLine'.

    It seems to me that the existing 'OpenFlatFile' would need a new option to open in Read Mode. Could the new 'ReadNextLine' be based on the existing 'WriteOneLine', basically by using 'fscanf' in place of 'fprintf' ? Would a new data structure be needed in the header file ?

    Did you end up copying B34A1010 into the user name range (eg B55A1010) and modifying that copy ?
    If so, did you have to change the existing Business Function names in that copy (eg WriteOneLine) to be unique ?

    Would you recommend that the new program only be used for 'OpenForInput' and 'ReadNextLine', while B34A1010 continue to be used for 'WiteOneLine' and 'CloseFlatFile' ?

    Any advice and warnings you may care to provide would be most appreciated.
    __________ __________ __________ __________ ______
    Chris Vaughan Phone: 03 8603 1458 (BH)
    ICT Applications Architecture 0409 199 735 (M)
    PWC BPO Holdings Australia 03 8603 1482 (FX)

    Larry Jones
    ljones@wagstaff.com
    OneWorld XE, SP 15.1
    HPUX 11, Oracle SE 8.1.6
    Mfg, Distribution, Financials

    Attached Files Attached Files
    Larry Jones
    E1 9.2 - TR 9.2.2.6 on Win 2016 R2. SQL Server 2016
    Wintel, BI Publisher

  2. #2

    Re: Reading Dynamic Flat Files

    Larry,
    We now have something that we have needed for a long time.
    Your assistance and advice greatly exceeded what we might have reasonably expected. Many many thanks.



  3. #3
    New Member
    Join Date
    Mar 2001
    Posts
    29

    Re: Reading Dynamic Flat Files

    Hello,
    This is a useful BFSN for Flat File !!!

    Attached Files Attached Files

  4. #4
    Member
    Join Date
    Aug 2001
    Location
    Manchester UK
    Posts
    99

    Re: Reading Dynamic Flat Files

    Another question on the ReadTextLine function. Apologies to Larry if he has sent me a reply to this question i mailed him direct - our mail was down for 24 hours and we lost all incoming mail.

    Anyway the problem i have is as follows:

    (i am not familiar with creating C bsfns except generated as NERs so apologies if i've done something basic wrong)

    I followed Larrys instructions as per the original thread :

    - Copied existing data structures D341010 A -C
    - Created New Data structure D55A1010D as per instructions
    - Created new BSFN B55A1010 and changed names to Text and added new function Read Text Line
    - Copied the .C and .H files from Larrys attachment to the spec and include dirs in the DV7333 pathcode.
    - Generated bsfns

    I have created a dummy UBE to read the contents of a text file on root C. I have set up the code in the INIT event as a quick test as follows:

    -----------------------------------------------------------------------
    0001 //
    0002 VA rpt_cSUPPS_SuppressErrorMssage = "1"
    0003 VA rpt_szVAR1_FilePath = "C:\test.txt"
    0004 //
    0005 Open Text File
    "1" -> cSuppressErrorMessage
    UNDEFINED <- cErrorCode
    VA rpt_szDTAI_DataItem <- szErrorMessageId
    UNDEFINED -> cAppendMode
    VA rpt_sz_GENLNG_GenericLong <- idFilePtr
    VA rpt_szVAR1_FilePath -> szFilePath
    0006 //
    0007 Read Text File Line
    VA rpt_cSUPPS_SuppressErrorMssage -> cSuppressErrorMessage
    VA rpt_cERRC_ErrorCode <- cErrorCode
    VA rpt_szDTAI_DataItem <- szErrorMessageIdDataItem
    VA rpt_sz_GENLNG_GenericLong -> idFilePtrGenericLong
    VA rpt_szVAR1_VariableField1 <- szRecordVariableLengthField1
    0008 //
    0009 RV Variable Length Field 1 = VA rpt_szVAR1_VariableField1
    0010 //
    0011 Close Text File
    VA rpt_cSUPPS_SuppressErrorMssage -> cSuppressErrorMessage
    VA rpt_cERRC_ErrorCode <- cErrorCode
    VA rpt_szDTAI_DataItem <- szErrorMessageId
    VA rpt_sz_GENLNG_GenericLong -> idFilePtr

    What I am finding is that the first Open Text file fails with a return code of:


    VA rpt_szDTAI_DataItem = 078

    It appears the Open text file cannot retrieve the file to open it - however, if i change this to the OpenFlat file business function it find the file ok. This indicates that I have not created the BSFNs corectly.

    I have checked all the data structures and they appear correct and all the BUSBUILD generation completed succesfully. The BSFN appears to pciking up the correct source as wel so I am at a loss as to what i have done wrong.

    Does anyone have any clues?

    thanks

    dave


    OW XE base sp18.1 oracle NT
    -------------------------------------------
    - XE (B7333) SP22, AIX 5.2, Oracle 9i Database
    -
    - JDE EnterpriseOne 9.0 (Tools 8.98), Oracle Linux 5.3, Oracle 11g R1
    -------------------------------------------

    Also have worked on B7332, AS400

  5. #5
    Senior Member Larry_Jones's Avatar
    Join Date
    Nov 2000
    Location
    Spokane, WA, USA
    Posts
    3,254

    Re: Reading Dynamic Flat Files

    Dave,

    yes I did message you - once by email and once via this forum. Oh well.
    Here was my reply:

    Took a brief look at your code - the thing that jumps out right away is that you are not supplying some arguments to the BSFN.

    One critical argument is in the Open - the "AppendMode" argument. Without that the file will not be opened. You must specify either "A" - Open a file for appending (writing) new data to the end of the file (if file does not exist it will be created), "W" - Create a new file for writing to, or "R" open an existing file for reading from.

    I would also strongly suggest you supply a variable for the cErrorCode value - I notice use use one in the ReadText function.

    Regards,
    Larry Jones
    E1 9.2 - TR 9.2.2.6 on Win 2016 R2. SQL Server 2016
    Wintel, BI Publisher

  6. #6

    Re: Sequence Flat File

    Hello all,
    I am using a Process where I need to populate the Time Analysis table from a flat file which comes from a Third Party product. Can anyone tell me how can I sequence the data in the Falt File which is the Input File in the TC so that the output tables are populated faster. Right now I have to Populate a Custom Table and then use that table in another TC inroder to get the sequenced data. The number of records in one exercise counts to upto a million.
    XE. SP22, XU7
    Win2K , Oracle

  7. #7
    Member
    Join Date
    Feb 2003
    Location
    Australia
    Posts
    36

    RE: Sequence Flat File

    Hi
    I hopw this process will work for U

    1) Open the Txt file in EXCEL and sort the COLS
    2) Save the CSV file as TXT]
    3 Use the TXT as a input to TC
    Regards,


  8. #8
    New Member
    Join Date
    Feb 2003
    Location
    Florida
    Posts
    11

    Re: Reading Dynamic Flat Files

    Hi Larry,
    I followed your instructions as far as creating the data stuctures and the BSFN, I've generated the BSFN on CDBASE (Parent DLL). I've created a UBE that uses the Open and Read statements but when the UBE runs (Local) gives me the following OWError:
    "Business Funtion Load Failed - CDBASE - _Open Flat@12"

    Do you have any idea what am I doing wrong?
    Any advice would be greatly appretiated.

    JS

  9. #9
    Senior Member Larry_Jones's Avatar
    Join Date
    Nov 2000
    Location
    Spokane, WA, USA
    Posts
    3,254

    Re: Reading Dynamic Flat Files

    Jerry,

    1. Although I don't think this is your problem, you should never assign custom DLLs to standard JDE Libraries/DLLs - for reasons that have been discussed on this forum. Instead use your own, custom library.

    2. Is it safe to assume the failure is occurring on the same PC where you created and compiled/linked the BSFN?

    3. Other than #1 above I don't know what you did wrong. Can you post (zipped):
    a) a snapshot of the Business Function Design Screen (W9862H) for your BSFN
    b) A screen snaphot of the Datastructure used by the Open function
    c) Your BSFN .c and .h source code.

    Regards,
    Larry Jones
    E1 9.2 - TR 9.2.2.6 on Win 2016 R2. SQL Server 2016
    Wintel, BI Publisher

  10. #10
    Senior Member Zoltan_Gyimesi's Avatar
    Join Date
    Oct 2000
    Location
    Budapest, Hungary
    Posts
    4,167

    Re: Reading Dynamic Flat Files

    Hi Jerry and Larry,

    Larry is right as usual :-)

    Always place your custom BSFN into a custom DLL instead of into any DLL which originally exists in OneWorld.

    Other question:

    Was the BSFN Build TOTALLY successfull without restoring the previous state of the DLL?

    Here is my practice when I build or re-build BSFN:

    1.) I close all application except Object Librarian / Object Management Workbench.

    Reason: the DLL can be locked by an open application.

    2.) I exit and re-enter OW after building and before testing the BSFN.

    Reason: the old version can be cached in the memory and the test won't see the changes.

    Hope, this helps a bit

    Regards,

    Zoltán

    P.S.: Larry, Thank you that you have mentioned my name - that I shared originally this Flat File operation on JDEList Forum.
    - XE UPDATE 2 SP22, Intel NT4, SQL 2000
    - B9 (8.93B1)
    - was/is working with B7321, B7331, B7332 too

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
The legal restrictions and terms of use applicable to this site are available here.
Use of this site signifies your agreement to the terms of use.
JDELIST is NOT affiliated with JD Edwards® & Company, Oracle or Peoplesoft. Contents of this site are neither endorsed nor approved by JD Edwards® & Company and, or Oracle.