Hello,   Being not a UNIX expert, I'm write unix & SQL scripts to generate report. But have difficulty to split the file according the report ID. I'm wondering IF UNIX (sh script) can split a big text file into several different files according to a certain field (from posX to posY), when that field is not in sequence, but from rowA to rowB will be exactly the same.

ie: check text file, if from rowA to rowB, when posX-posY are equal, generate report AB;

if from rowC to rowD, when posX-posY are equal, generate report CD; ....

Here are more info:

I have a table to store report request info from user, like this:

REPORT_ID  DI PL BUI FL ROOM
---------- -- -- --- -- ------
REPORT 1   RC SF DAL nd
REPORT 2   AD LE
REPORT 3   RC DD LKF 01 RENTAL
REPORT 4   *
REPORT 5   CS
REPORT 6   *  DD LKF 01 RENTAL
REPORT 7   RC DD LKF 01 ABCDE
REPORT 8   AB AC LKF 01

After I do error checking and then run the query against DB, I can get a huge temp table to store info, like this:

REPORT_ID  KOMP_IDENT
----------                ----------
REPORT 1   C-773280558
REPORT 1   C-773281754
REPORT 1   C-773281755
REPORT 1   C-773281753
REPORT 3   C-0773280100
REPORT 8   C-063444
REPORT 8   C-063442

Due to invalid records, certain report ID are throw away during the query, therefore nothing in my temp table are in sequence. How could I spool out the file according to group by the report ID??

Maybe this can be done in SQL script but I just running out of my brain for this complex report. (I'm not doing it in Dynamic SQL).

Thanks for advise

Helen



Do You Yahoo!?
Yahoo! Mail Personal Address - Get email at your own domain with Yahoo! Mail.

Reply via email to