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 

need help in an internal table

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


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Tue Nov 13, 2007 7:22 am    Post subject: need help in an internal table Reply with quote

I have a file with records as below and i want to read record by record and store unique combinations of first 1 -5 bytes
and 2 bytes from pos 31 - 32 in an internal array.
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
06111                         AB                                       
06111                         AB                                       
06111                         BC                                       
06112                         EF                                       
06112                         EF                                       
06112                         GH                                       
06113                         PQ                                       
06114                         XY                                       
**************************** Bottom of Data ****************************


I want to store in an internal array as follows:
Code:

06111AB
06111BC
06112EF
06112GH
06113PQ
06114XY

And finally i want to write to a file in the same format as stored in the array.

Can anybody post the solution / do we have sample links for this kind of requirement and i want COBOL program
only to do it.
Back to top
View user's profile Send private message
CraigG
Intermediate


Joined: 02 May 2007
Posts: 202
Topics: 0
Location: Viginia, USA

PostPosted: Tue Nov 13, 2007 8:20 am    Post subject: Re: need help in an internal table Reply with quote

yadav2005 wrote:
zCan anybody post the solution / do we have sample links for this kind of requirement and i want COBOL program
only to do it.

1. How many possible key combinations are there going to be?

2. How much money in your development budget is available for this?
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Tue Nov 13, 2007 9:43 am    Post subject: Re: need help in an internal table Reply with quote

yadav2005 wrote:
zCan anybody post the solution / do we have sample links for this kind of requirement and i want COBOL program
only to do it.
Seems like a lot of work for a simple sort solution....
Is the input sorted?
Do you expect the output to be sorted?
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Tue Nov 13, 2007 10:01 am    Post subject: Reply with quote

CICS Guy,

The input is sorted and it has to be done in COBOL only and the output obviously will be sorted as the input is sorted.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Tue Nov 13, 2007 10:28 am    Post subject: Reply with quote

why bother to store in an internal cobol table? are you processing the data? simple read, reformat, output should solve the problem, unless you are doing some other processing.

SORT could also be a solution. yeah, yeah, I heard you. 'hast to be cobol'.
so what?
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Tue Nov 13, 2007 10:46 am    Post subject: Reply with quote

Dick,

Thanks for your reply . I am also doing some other processing that is why i am storing them in internal table and doing some processing further and that is the reason i am going for a COBOL Program.
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Tue Nov 13, 2007 11:44 am    Post subject: Reply with quote

You stated that the input is sorted, so any dups will be on consecutive records on the input file. Just compare the values in the last element added to the WS table to the values coming in from the input file. If the values are the same, don't add anything to the WS table. If the values are different, add the values to the WS table. Or did I miss something?
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Tue Nov 13, 2007 12:42 pm    Post subject: Reply with quote

or use SUM FIELDS=NONE in the sort which will drop records with duplicate keys. If there are more keys than the 2 mentioned then do another sort using just those keys. Saves a bit of logic in your Cobol program.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Wed Nov 14, 2007 7:15 am    Post subject: Reply with quote

There is a small change in the requirement as i want the output to a file written as:
Code:

061110611206113
ABBCEFGHPQXY

on two different lines in the output file.
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