View previous topic :: View next topic
|
Author |
Message |
balaji81_k
Active User
Joined: 29 Jun 2005 Posts: 155
|
|
|
|
Hi Folks,
I need a help . I want to change a cobol program which is of write operation in to sequential file. JCL corresponds to GDG Generation for this file . Program existing logic will be of read from VSAM file and write entries in to flat file .
Problem is when read from VSAM if we have more than one entry for account(Key fields) with different amount values,Instead of writing in to mutliple records for the same Account with different amount in GDG file , i want to sum the amount for all entries of the account and write as single record/ entry in to sequential file. Existing logic is fiel is in open output mode and correspond jcl parameter is of DISP=NEW.
Iam also trying with several logic . If any can help me out .
Thanks
Balaji K |
|
Back to top |
|
|
smitha T
New User
Joined: 04 Jun 2008 Posts: 2 Location: Hyderabad
|
|
|
|
Hi Balaji,
Is Account number key field in the VSAM? Pls clarify. Also, pls post sample input records. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
where are You facing issues, the logic or the coding?
learn also to split Your logic...
using a gdg is not a programming issue, it is a data/storage management issue
the program is unaware about it
after six years of hanging around here You should have learned how to post better
OK for the language barrier,
but reread Your post and tell us sincerely if it is something that we can understand clearly . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You've been on here for six years.
You seem to be describing a simple situation. How have you not come across such a thing in all that time?
Code: |
save first key (from priming read, for instance) intitliase values
test for change of key
if so, output to file with old key, store new key, initalise values
accumulate necessary values
at end-of-file ensure last data is output (before closing output file!) |
Maybe I'm missing something?
When I say "initialise" I don't mean use INITIALIZE. I think that verb was introduced to dig people who couldn't code a loop properly out of a hole they were faced with all the time. First step on the slippery path... |
|
Back to top |
|
|
balaji81_k
Active User
Joined: 29 Jun 2005 Posts: 155
|
|
|
|
Hi Smitha,
There is no problem in reading VSAM , the logic in which we need to populate records for Flat file(GDG).
Existing code is just move to record structure of flat file and write it .Now the logic we need is instead of directly writing in to it we need to hold some records and check for same account is received for different amount and then combined the amount and write as one record in flat file.
Thanks
Balaji K |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Are you, slowly, going through the posts one-by-one and not reached enrico's yet?
Forget about anything being a GDG. It is irrelevant to your program code.
When you later get to my post, see if the outline helps. If not, tell us the specific problem that you have. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
This
balaji81_k wrote: |
Existing code is just move to record structure of flat file and write it .Now the logic we need is instead of directly writing in to it we need to hold some records and check for same account is received for different amount and then combined the amount and write as one record in flat file. |
and the green-color-text from Bill --
Code: |
save first key (from priming read, for instance) intitliase values
test for change of key
if so, output to file with old key, store new key, initalise values
accumulate necessary values
at end-of-file ensure last data is output (before closing output file!) |
don't you think you've the answer already? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What about summarize do you not yet understand?
If you are looking for someone to do the work for you, sorry. We will help, but not actually do this for you.
A good way to get help is to show what you have done so far and where you are stuck. Someone should be able to offer a suggestion. |
|
Back to top |
|
|
balaji81_k
Active User
Joined: 29 Jun 2005 Posts: 155
|
|
|
|
Hello,
If you carefull read my first statement posted in this topic sates that "that i am also trying several logic " to implement this and i want to get some sharing ideas. Anyway i have implement my own split logic and its working fine . People who posting queries are not to get work done by some other but to get ideas from experts who are specialized in that respective skills.
Please let me know your concerns.
Thanks
Balaji K |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
for such a task You do not have any reasonable alternative than follow Bill' s logic.
it seems anyway strange that after 6 years of IT practicing You have not mastered such a simple issue
getting rid of duplicated ( with or without summing up something ) is probably the third exercise in basic <COBOL> training |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Please post your solution, as it may help others faced with a similar requirement in the future. |
|
Back to top |
|
|
|