Posted: Tue Jul 04, 2017 9:46 am Post subject: Pick Records matching the criteria using SORT
Input File is Report File(FBA File) :
The report file contains data for several cities chennai,madurai,etc with multiple pages for each city.
Input file data is shown below.
Code:
HEADING :(PAGE1)
1PQ9111-001 ABCD TEST BANK 001
MLS1111S CHENNAI GEN
TYPE 3
DETAIL RECORD :
RECORD 1
RECORD 2
HEADING :(PAGE2)
1PQ9111-001 EFGH TEST BANK 001
MLS1111S CHENNAI GEN
TYPE 3
STATE TOTALS
DETAIL RECORD :
19541112 VEHICLE - DEFERRED DEALER COMMISSION 25
42041117 VEHICLE - INTEREST INCOME 50
42041119 VEHICLE - PAID LATE CHARGES 75
In output file, I want to pick 'VEHICLE - INTEREST INCOME' record and amount 50 should be written into particular position(say 40th position) of output file using sort. The 'VEHICLE - INTEREST INCOME' record is available for all cities but I want to pick data only for chennai city.
Can anyone plz help me in resolving this problem.
Joined: 26 Nov 2002 Posts: 12373 Topics: 75 Location: San Jose
Posted: Tue Jul 04, 2017 12:23 pm Post subject:
sublak123,
Since you are a new member you need to follow a couple of rules.
1. Use meaningful topics (don't use the Forum name for the topic). Use a descriptive title to explain your problem. Post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question. I have edited your title for now but next time try to follow the rules.
2. Use code tags to have your data retain spacing and readable. Check this link which explains in detail about code tags
Kolusu -- won't that insert the '50' for every Vehicle interst income line?
OP wanted this only for certain cities within the file. I think the 3rd line of the file has the city name.
Joined: 26 Nov 2002 Posts: 12373 Topics: 75 Location: San Jose
Posted: Tue Jul 04, 2017 5:46 pm Post subject:
t-bonham@scc.net wrote:
Kolusu -- won't that insert the '50' for every Vehicle interst income line?
OP wanted this only for certain cities within the file. I think the 3rd line of the file has the city name.
t-bonham,
I am only including the lines that have the text "VEHICLE - INTEREST INCOME ". I do NOT reformat the contents at all.
If OP and your intention is to INCLUDE the city name then OP needs WHEN=GROUP clause and Push the city name onto the detail records. So we need to know how to identify the city Name. Probably checking for MLS1111S or may 3rd header line, but not really sure. _________________ Kolusu
www.linkedin.com/in/kolusu
HEADING :(PAGE1)
1PQ9111-001 ABCD TEST BANK 001
MLS1111S MADRAS GEN
TYPE 3
DETAIL RECORD :
RECORD 1
RECORD 2
HEADING :(PAGE2)
1PQ9111-001 EFGH TEST BANK 001
MLS1111S MADRAS GEN
TYPE 3
STATE TOTALS
DETAIL RECORD :
19541112 VEHICLE - DEFERRED DEALER COMMISSION 25
42041117 VEHICLE - INTEREST INCOME 50
42041119 VEHICLE - PAID LATE CHARGES 75
HEADING :(PAGE1)
1PQ9111-001 ABCD TEST BANK 001
MLS1111S Bangalore GEN
TYPE 3
DETAIL RECORD :
RECORD 1
RECORD 2
HEADING :(PAGE2)
1PQ9111-001 EFGH TEST BANK 001
MLS1111S Bangalore GEN
TYPE 3
STATE TOTALS
DETAIL RECORD :
19541112 VEHICLE - DEFERRED DEALER COMMISSION 15
42041117 VEHICLE - INTEREST INCOME 40
42041119 VEHICLE - PAID LATE CHARGES 35
HEADING :(PAGE1)
1PQ9111-001 ABCD TEST BANK 001
MLS1111S Cochin GEN
TYPE 3
DETAIL RECORD :
RECORD 1
RECORD 2
HEADING :(PAGE2)
1PQ9111-001 EFGH TEST BANK 001
MLS1111S Cochin GEN
TYPE 3
STATE TOTALS
DETAIL RECORD :
19541112 VEHICLE - DEFERRED DEALER COMMISSION 35
42041117 VEHICLE - INTEREST INCOME 30
42041119 VEHICLE - PAID LATE CHARGES 55
Above is the report and we pickup the values for each city for Accounts 19541112
42041117
42041119
Joined: 26 Nov 2002 Posts: 12373 Topics: 75 Location: San Jose
Posted: Thu Jul 20, 2017 2:36 pm Post subject:
Suchay,
Use the following untested DFSORT control cards which will give you the desired results. Based on your latest data it seems that you have the accounts '19541112, 42041117 and 42041119 ) in position 1. If they are not then change the positions on the IFTHEN statements accordingly.
Also you show the numeric data as whole numbers, but your final output shows it with decimal data. Is that necessary?
Joined: 26 Nov 2002 Posts: 12373 Topics: 75 Location: San Jose
Posted: Thu Jul 20, 2017 3:47 pm Post subject:
Magesh_J wrote:
Why do we need a sort ? I think OPTION COPY would be sufficient.
Magesh_J,
How are you planning to get a summary record for each city? What happens if you happen to have another Bangalore after Cochin? or for any of the city if it is repeated later?
If OP confirms that the city names occur only once then he can replace the SORT FIELDS with OPTION COPY _________________ Kolusu
www.linkedin.com/in/kolusu
How are you planning to get a summary record for each city? What happens if you happen to have another Bangalore after Cochin? or for any of the city if it is repeated later?
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum