Hi,
I have a flat file, which has a header, Some 'P' records, some 'S' records and a trailer.
In o/p i wish to omit the 'S' records
O/p file should have header. 'P' records and trailer.
Trailer should have the total count of available 'P' records (count should exclude header and trailer).
*Header(has branch no as zero)
0
*records
*branch| accountno| hier_ind| cutoff
1234 11111 P 20081212
1234 11111 S 20081203
1234 11111 S 20081204
*Trailer(has branch no as 9999999)
9999999 3
o/p required is
0
1234 11111 P 20081212
9999999 1(1 is the total number of 'P' records,how to get this 1)
------------------------
besides:
lrecl = 1000
recfm=fb for both i/p and o/p files
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Hello,
Quote:
hope this clarifies
No, seeing this I got more qns. Here you've 2 output files which is not mentioned in your original post.
Are you trying to split the input file into two files - one each for "P" and "S" records? If yes, how the header/trailer records should like? Should it be the same for both the output files except for the count? You need to do a better job of explaining what exactly you want to achieve.
--Header contains branch number as zeroes (helps to identify header)
--Each record contains several details and an indicator at the 684th position 'P' or 'S', indicating primary or secondary record
--Trailer contains several details, but branch number for trailer will be 9999999, and it will have a total of the number of records ('P' or 'S') at position 28, length 8
Requirement:
file 1 should contain header (branch number 0)
records with ind 'P'
Trailer should contain all the details as they were in i/p file except for position 28, which will contain count of all 'P' records
file 2 should not contain header
records with ind 'S'
trailer should have all details as it was in i/p file except at loaction 28, that has count of all 'S' records.
-----------------------------------------------
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
AnujaS,
sunnychopra's "solution" will NOT preserve the information in the trailer record as you requested because it just rebuilds certain fields in the trailer record. It also does NOT use the positions you specified for the fields.
Here's a DFSORT/ICETOOL job that will actually do what you asked for based on what you've said in your posts: