View previous topic :: View next topic |
Author |
Message |
koolspark Beginner
Joined: 27 May 2010 Posts: 29 Topics: 13
|
Posted: Mon Aug 23, 2010 6:47 am Post subject: Accessing GDG generations Randomly in COBOL program |
|
|
hi,
I've a GDG generation and I want to access it randomly in my cobol program. Is this possible with out using arrays? Can I use START command on GDG generation? My requirement is as follows.
1. i've a cursor in my cobol+db2 program which is fetching the account numbers.
2. I've a gdg generation file. If the account number fetched from the cursor is present in the gdg generation, then i should not process the account otherwise i should process the account.
Can somebody please let me know how to do this?
Thanks, |
|
Back to top |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Mon Aug 23, 2010 7:24 am Post subject: |
|
|
what kind of file is the gdg?
qsam?
you can only read a qsam file sequentially.
suggest you presort the gdg input in the same order as the cursor, then you can match merge. _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Mon Aug 23, 2010 10:46 am Post subject: |
|
|
Load your GDG into a KSDS; maybe, create a key including the G000V00 value and keep everyone happy. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
papadi Supermod
Joined: 20 Oct 2009 Posts: 594 Topics: 1
|
Posted: Mon Aug 23, 2010 2:10 pm Post subject: |
|
|
How many "keys" are in the sequential file? _________________ All the best,
di |
|
Back to top |
|
|
koolspark Beginner
Joined: 27 May 2010 Posts: 29 Topics: 13
|
Posted: Tue Aug 24, 2010 9:17 am Post subject: |
|
|
I've only one key in the file which is the account number. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Aug 24, 2010 10:45 am Post subject: |
|
|
koolspark,
1. Pre-sort the GDG on the account number by providing the sortin with GDG base.
2. Open cursor
3. Fetch cursor
4. Read the first record in file
5. Compare it Db2 key against the file-key.
6. If file-key is less than Db2 key , read the file till file-key is equivalent or greater to DB2-key
7. If file-key is greater than DB2 key , go back to step 3 and repeat till the end of cursor.
Kolusu |
|
Back to top |
|
|
Crox Beginner
Joined: 29 May 2004 Posts: 52 Topics: 9
|
Posted: Mon Aug 30, 2010 11:46 am Post subject: |
|
|
if you are able to open the files in a dynamic way, you can first read a directory list, finding the right datanames. Then you can choose out of the datanames and open the files using a dynamic allocation. |
|
Back to top |
|
|
|
|