Joined: 01 Feb 2007 Posts: 123 Location: Hyderabad
Hi,
Here is my requirement.
My input file is of FB format and LRECL is 231 and two output files of same record length.
When 26,3 position is equal to ABC it should be written to ABC output file.
When 26,3 position is equal to XYZ or KLM it should be written to XYZ output file.
The header record for the output files should have the same header as input. The first 3 characters should be ABC or XYZ according to the output file replacing XXX.
The same way for the trailer record and the total record count should include header and trailer.
Input file will contain records as follows:
Code:
XXX200804211-FEB-2008 21:11:45
20080211SMS 35305300003ABC BDP14475825456887 THE TEXT
20080211SMS 35300000002ABC BDP1447770450222 THE TEXT
20080211SMS 35300000001XYZ BDP1441216527432 THE TEXT
20080211SMS 35305300009XYZ BDP144221144541 THE TEXT
20080211SMS 35305300002XYZ BDP14477787878787 THE TEXT
20080211SMS 35305300001XYZ BDP14477785825641 THE TEXT
20080211SMS 35305300000KLM BDP1442246448641 THE TEXT
20080211SMS 35305300000KLM BDP1447777748641 THE TEXT
20080211SMS 35300000004KLM BDP1442227984190 THE TEXT
XXX20080420000001111-FEB-2008 21:11:45
ABC output file is as follows:
Code:
ABC200804211-FEB-2008 21:11:45
20080211SMS 35300000001ABC BDP1441216527432 THE TEXT
20080211SMS 35305300009ABC BDP144221144541 THE TEXT
20080211SMS 35305300002ABC BDP14477787878787 THE TEXT
20080211SMS 35305300001ABC BDP14477785825641 THE TEXT
RBS20080420000000611-FEB-2008 21:11:45
XYZ output file is as follows:
Code:
XYZ200804211-FEB-2008 21:11:45
20080211SMS 35305300003XYZ BDP14475825456887 THE TEXT
20080211SMS 35300000002XYZ BDP1447770450222 THE TEXT
20080211SMS 35305300000KLM BDP1442246448641 THE TEXT
20080211SMS 35305300000KLM BDP1447777748641 THE TEXT
20080211SMS 35300000004KLM BDP1442227984190 THE TEXT
XYZ20080420000000711-FEB-2008 21:11:45
How can i do this. I had done this job which is very length and in 3 steps. I had attached here. How can i modify this to simpler. Or any other alternative solution.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
The output you show doesn't match your description of the rules.
I see two 26,3 = ABC records in the input file, but you show four in the output file - why?
I see four 26,3 = XYZ records in the input file, but you show two in the output file - why?
Why does the trailer record for the ABC output file have RBS instead of ABC?
Can the header and trailer records in the input file be identified by 'XXX' in positions 1-3 (the other records don't have that), or can they be identified some other way?
What is the starting position, length and format of the total record count value in the trailer record.
Joined: 01 Feb 2007 Posts: 123 Location: Hyderabad
Hi Frank,
Sorry i had given input wrongly. Thanks for pointing out.
Here is the corect input and output files.
Input file will contain records as follows:
Code:
XXX200804211-FEB-2008 21:11:45
20080211SMS 35305300003ABC BDP14475825456887 THE TEXT
20080211SMS 35300000002ABC BDP1447770450222 THE TEXT
20080211SMS 35300000001ABC BDP1441216527432 THE TEXT
20080211SMS 35305300009ABC BDP144221144541 THE TEXT
20080211SMS 35305300002XYZ BDP14477787878787 THE TEXT
20080211SMS 35305300001XYZ BDP14477785825641 THE TEXT
20080211SMS 35305300000KLM BDP1442246448641 THE TEXT
20080211SMS 35305300000KLM BDP1447777748641 THE TEXT
20080211SMS 35300000004KLM BDP1442227984190 THE TEXT
XXX20080420000001111-FEB-2008 21:11:45
ABC output file is as follows:
Code:
ABC200804211-FEB-2008 21:11:45
20080211SMS 35305300003ABC BDP14475825456887 THE TEXT
20080211SMS 35300000002ABC BDP1447770450222 THE TEXT
20080211SMS 35300000001ABC BDP1441216527432 THE TEXT
20080211SMS 35305300009ABC BDP144221144541 THE TEXT
ABC20080420000000611-FEB-2008 21:11:45
XYZ output file is as follows:
Code:
XYZ200804211-FEB-2008 21:11:45
20080211SMS 35305300002XYZ BDP14477787878787 THE TEXT
20080211SMS 35305300001XYZ BDP14477785825641 THE TEXT
20080211SMS 35305300000KLM BDP1442246448641 THE TEXT
20080211SMS 35305300000KLM BDP1447777748641 THE TEXT
20080211SMS 35300000004KLM BDP1442227984190 THE TEXT
XYZ20080420000000711-FEB-2008 21:11:45
Quote:
Can the header and trailer records in the input file be identified by 'XXX' in positions 1-3 (the other records don't have that), or can they be identified some other way?
Yes. Header and trailer records can be identified by 'XXX' in positions 1-3. Other data records wont have 'XXX'.
Quote:
What is the starting position, length and format of the total record count value in the trailer record.
The trailer record format is as follows.
Position 1-3 will be either ABC or XYZ depending on the file we are writing
position 4-10 should be the same value from the input file
position 11-18 will be the record count of LENGTH 8
position 19 onwards should be the same values from input file