Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

COBOL write operation in to sequential file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
balaji81_k

New User


Joined: 29 Jun 2005
Posts: 86

PostPosted: Mon Oct 03, 2011 10:26 am    Post subject: COBOL write operation in to sequential file
Reply with quote

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

smitha T

New User


Joined: 04 Jun 2008
Posts: 2
Location: Hyderabad

PostPosted: Mon Oct 03, 2011 11:35 am    Post subject: Reply to: COBOL SEQUENTIAL READ
Reply with quote

Hi Balaji,

Is Account number key field in the VSAM? Pls clarify. Also, pls post sample input records.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Mon Oct 03, 2011 11:46 am    Post subject: Reply to: COBOL SEQUENTIAL READ
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Oct 03, 2011 11:57 am    Post subject:
Reply with quote

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

New User


Joined: 29 Jun 2005
Posts: 86

PostPosted: Mon Oct 03, 2011 3:46 pm    Post subject: Re: Reply to: COBOL SEQUENTIAL READ
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Mon Oct 03, 2011 6:25 pm    Post subject: Reply to: COBOL SEQUENTIAL READ
Reply with quote

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

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Oct 03, 2011 6:56 pm    Post subject: Re: Reply to: COBOL SEQUENTIAL READ
Reply with quote

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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Oct 03, 2011 9:55 pm    Post subject:
Reply with quote

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

New User


Joined: 29 Jun 2005
Posts: 86

PostPosted: Tue Oct 04, 2011 2:32 pm    Post subject:
Reply with quote

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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Oct 04, 2011 3:07 pm    Post subject: Reply to: COBOL SEQUENTIAL READ
Reply with quote

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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Oct 04, 2011 4:43 pm    Post subject: Reply to: COBOL SEQUENTIAL READ
Reply with quote

Please post your solution, as it may help others faced with a similar requirement in the future.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us