|
|
| Author |
Message |
sant532
New User
Joined: 02 Jun 2008 Posts: 17 Location: India
|
|
|
|
I have an input file with hundreds of thousands of records. The file contains records that starts with number 1 and ends with 9.
eg:
1safs 0000 25278 djhdld
2gdtyd 87380 0000 87833 hd
3gjdf kjsjf kjfsj sdjkl
3jhjhfddhjk 868373
4gjkhd kjk7j l7776 001 10111
4jhjfd 000111 kjkj
4jhdh 878 gdkjhd
5hjxhkl 790010101
6uhds
7gkjd
8jhl
9tye00
this same structure repeats in the input file.
In that structure first(1) and last(9) records are unique that means from 2 to 8 may repeat many times with in that structure (like 3 is repeated 2 times and 4 is repeated 3 times with different data).
Now I want to read input file and based upon the some condition (that condition will be checked with 5 record), if that 5 record value satisfies the condition then I need to write the record from 1 to 9 into output file. |
|
| Back to top |
|
 |
References
|
|
 |
dbzTHEdinosauer
Senior Member
Joined: 20 Oct 2006 Posts: 1639 Location: germany
|
|
|
|
you want to write selected groups of records 1 thru 9 when record 5 has a code that indicates that this group of 9 records should be output.
other than having to deal with a chance that there are not 9 records between two 1 records, suggest that you declare in internal cobol table to store the 9 records. After you have read and stored a 9 record - or end of file, check the 5 record (5th item) code and write all 9 records from the table, clear your table (a counter) then read and load another 9 records into your internal cobol table. |
|
| Back to top |
|
 |
sant532
New User
Joined: 02 Jun 2008 Posts: 17 Location: India
|
|
|
|
hi,
in between 1 and 9 there may be many records (some times 100 records)with same number like 3 and 4 in the previous example. |
|
| Back to top |
|
 |
sant532
New User
Joined: 02 Jun 2008 Posts: 17 Location: India
|
|
|
|
| I don't know how to code a cobol internal table. |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8733 Location: 221 B Baker St
|
|
|
|
Hello,
| Quote: |
| I don't know how to code a cobol internal table. |
Then this would be a good time to learn Many, many requirements are met using some internal table. Look here:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3pg20/1.4?
If you read something that is not clear, post what you read and what is not clear. Someone will be able to clarify.
Your code would read your input file and copy the records from "1" to "9" into the array/table. When you reached the "9", you would look at the "5" and decide whether to copy the records from the table to the output file.
When the records are copied (or not), move spaces to the array and continue thru the input file. |
|
| Back to top |
|
 |
sant532
New User
Joined: 02 Jun 2008 Posts: 17 Location: India
|
|
|
|
| Thanks A lot...now i got the idea to code the total logic. |
|
| Back to top |
|
 |
dick scherrer
Global Moderator
Joined: 23 Nov 2006 Posts: 8733 Location: 221 B Baker St
|
|
|
|
You're welcome - someone will be here if questions arise
d |
|
| Back to top |
|
 |
|
|