in reply to Re^3: File read and re-ordering
in thread File read and re-ordering

Advice and suggestions are greatly appreciated. I am a complete newb when it comes to PERL. I will need to capture line 3 if it appears and line 4 always since there will always be a name there. The a/c #'s are supposed to be the same number and have been only represented once in the past so a capture of either is fine. The dates are dd MMM yyyy format yes. Line 18 is the starter of the detail and needs to be included in the first line on the details file. Pad character needs to be a space, there should be no truncating of data but if the data that populates the specific field is longer than the specified width it would truncate certainly ( has not been an issue before). I am going to give the format for the header file now so bear with me. Starting at character 0( is the account number line 8 or 11 and field 1), starting character 18 is field 2(40 characters) static text, character 58 is field 3(40 characters) static text, starting character 98 is field 4(40 characters) static text, starting character 138 is field 5(40 characters) static text, starting character 178 is field 6(40 characters) is line 3 if data exists or line 4 if it does not exist, starting character 218 is field 7(40 characters) and is line 5, starting character 258 is field 8(40 characters) and is line 7, starting character 298 is field 9(40 characters) static text, starting character 338 is field 10(40 characters) static text, starting character 378 is field 11(7 characters which is the first date value on line 12 and needs to be formated to ddmmmyy), starting character 385 is field 12(7 characters, the second date on line 12 and needs to be format ddmmmyy), starting character 392 is field 13(10 characters)static text, starting character 402 is field 14(10 characters) static text, starting character 412 is field 15(40 characters) this is line 4 if line 3 has data and results to blanks if no data on line 3, starting character 452(8 characters) this is the starting line count for the matching detail file, starting character 460(6 characters) this is the count of detail lines outputted to the detail file( used to compute the prior value obviously). If this is unclear, do you have a way I could send you the lay out file and what not so you could see more clearly how it is laid out?

Replies are listed 'Best First'.
Re^5: File read and re-ordering
by johngg (Canon) on Oct 23, 2006 at 18:55 UTC
    Not quite done with questions it seems.

    Fields 2 - 5, 9, 10, 13 and 14 don't appear to have any data associated with them, should they be space-filled?

    In this node you say that city/state/ZIP need to be split out but here the whole of line 7 goes into field 11 (offset 378). What gives?

    Your fields at offsets 452 and 460 seem to mandate one header file and one detail file as output rather than separate detail files for each customer. Is the starting line offset into the detail file zero-based?

    Cheers,

    JohnGG

      Sir, Field 2 contains a static text that my company will imput for each record, field 3 is the same, as with field 4. Field 5 is blank. Field 9 and 10 are blank as well. Field 13 and 14 used to contain data but is being suspended for this run so will contain blanks. So all of those other than 2, 3 and 4 should be space filled. Field 11 you are correct, I mis-spoke earlier, I had assumed it was seperate but as I looked into it I noticed it is all one line. My apologies! And it is one header file where each line is a customer record, and one detail file for all records where starting line is 0. Again I apologize for the miss communication for field 11.
        Great, I think I have all the info now. No need to apologize about field 11, easy slip to make with such complex data :)

        I will spend a bit of time digesting all of the information and try out one or two ideas then I'll make suggestions, probably in another reply to the OP.

        Cheers,

        JohnGG