How to read a bank file

bernfish

New Member
I'm trying to read in an input file from a bank and then compare some of bank input fields to some of the fields in the MFG/Pro ck_mstr and ckd_det tables. The input file has no separations like " or , and each line is a seperate record and the information is fixed. I tried the "set" command with no success, I probably need to use temp tables? I have two questions, I don't know how to read in the file and separate it out and I'm not sure how to use the "For Each" and "find" statements to compare the input information to our fields to the MFG/Pro check tables?

Example of input file from bank:
10101010191919191919191P20061212
12122938383838373736373S20061020
Acc# Pos 1-10
Check# Pos 11-20
check amt Pos 21-23
check type Pos 24
check date Pos 25-32

Thanks, Bernfish
 

joey.jeremiah

ProgressTalk Moderator
Staff member

Code:
define temp-table Bank no-undo

    field fld1 as char /* put whatever fields there are in the file */
    field fld2 as char 
    
    index fld1 is primary unique fld1.



run fillBank.

/* now you can use the bank temp-table to do whatever */



for each Bank: /* test */

    display Bank with width 200.

end. /* for each bank */



procedure fillBank: /* fills the bank temp-table */

    define var str as char no-undo.



    empty temp-table Bank.

    input from bank.dat.

    repeat:

        import unformatted str. /* when import reaches eof it will
                                 * raise the endkey condition and will exit the loop */
        create Bank.
        
        assign
            Bank.fld1 = substr( str, 1, 15 ) /* you can use substr to strip off the values */
            Bank.fld2 = substr( str, 16 ).

    end. /* repeat */

    input close. /* test.dat */
    
end procedure. /* fillBank */

hth
 
Top