MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Accessing GDG generations Randomly in COBOL program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
koolspark
Beginner


Joined: 27 May 2010
Posts: 29
Topics: 13

PostPosted: Mon Aug 23, 2010 6:47 am    Post subject: Accessing GDG generations Randomly in COBOL program Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Mon Aug 23, 2010 7:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Mon Aug 23, 2010 10:46 am    Post subject: Reply with quote

Load your GDG into a KSDS; maybe, create a key including the G000V00 value and keep everyone happy. Wink
_________________
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
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Mon Aug 23, 2010 2:10 pm    Post subject: Reply with quote

How many "keys" are in the sequential file?
_________________
All the best,

di
Back to top
View user's profile Send private message
koolspark
Beginner


Joined: 27 May 2010
Posts: 29
Topics: 13

PostPosted: Tue Aug 24, 2010 9:17 am    Post subject: Reply with quote

I've only one key in the file which is the account number.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Tue Aug 24, 2010 10:45 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Crox
Beginner


Joined: 29 May 2004
Posts: 52
Topics: 9

PostPosted: Mon Aug 30, 2010 11:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group