View previous topic :: View next topic
|
Author |
Message |
madhu_910
New User
Joined: 21 Feb 2005 Posts: 10
|
|
|
|
Hi all,
I have 2 arrays declared in my cobol program.I call two common modules to get data for the output file.The data from the common module is stored in each array respectively.Now my question is I want the data in a certain orde for my output structure.The data is not numeric to sort the array.Can anyone help me. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You have been a member here for more than 7 years. . . Why have you chosen such a topic title? It tells us Nothing to have a subject of "cobol" in the part of the forum that is ONLY for cobol topics. . .
Why might you believe the data needed to be numeric to sort it?
In order for someone to be of help, you need to more clearly explain just what you are trying to do. If anyone posts suggestions/solutions now, it would only be a guess because you have not given usable info. You need to explain the arrays, the "common modules", why you have not soerted the data before loading the arrays and possibly much other info. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Your perception that only numeric data can be sorted is very wrong
You can atleast try bubble sort |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Rather than just suggest "bubble sort", i believe we can be more help if we require more detail (as i mentioned before - we shouldn't guess or need to). I could only think of several "solutions" but they all required assumptions as the poster did not provide any info . . . I chose to suggest nothing.
Quote: |
Your perception that only numeric data can be sorted is very wrong |
I suspect there is much that is not as it seems.
Maybe some clarification will be provided. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
It's COBOL so they are tables. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Yes Dick I got it |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
instead of a sorting the data within the COBOL program
what is wrong with a SORT Step following the COBOL program?
That would not only make the COBOL program easier to write,
but a separate SORT step would be the best use of resources. |
|
Back to top |
|
|
madhu_910
New User
Joined: 21 Feb 2005 Posts: 10
|
|
|
|
I want to clear the things
1.the arrays I used is in the cobol which is occurs clause that has 100 rows
2.the data that comes from the common modules is depends on the database tables.As soon as I get the data for each satisfied criteria I move into my internal tables.
3.Now the data is in 2 internal working storage tables.
first internal table has
1.batch cat code
2.batch description
3.batch date
4.content
Second internal table has
1.batch cat code
2.batch module name
3.batch module date
4.module content
I want the output to be in
1.batch cat code(PR -BATCH CODE)
1.batch description(PR DESC)
2.batch module name(PR MODL NAME)
2.batch cat code(RT-BATCH CODE)
1.batch desc(RT-desc)
2.batch modl name(RT modl name)
.
.
.
...
100 times
This is all related to cobol program code
where I wanted to store the data in this particular order to move it to output structure.let me know if this makes clear |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
actually, it is not clear yet. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
They are tables - not arrays. And they have entries not rows.
Are the 2 tables in the same sequence? If so, what is stopping you from creating your output - one record created from the 2 tables - entry by entry. Sort the data afterwards. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I assume there is some common field in the two COBOL Internal Tables linking one to another.
so, why have two tables?
there should only should be one.
that will solve most of your problems. |
|
Back to top |
|
|
madhu_910
New User
Joined: 21 Feb 2005 Posts: 10
|
|
|
|
Dbz,
The thing is I manually move certain code to the common field depending on the other fields in the tableSo I need 2 tables. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you have not explained why.
all you have provided us is your solution to a problem/requirement
that you have as yet, not explained. |
|
Back to top |
|
|
madhu_910
New User
Joined: 21 Feb 2005 Posts: 10
|
|
|
|
Dick,
I answered for the question why I need 2 tables
The 2 tables data comes from 2 different programs
If I have to store in 1 table I need search before I store
To make it simple I loaded in 2 tables
But the data in the 2 tables is in different orders
Now I want to load 1 more table in certain order so that I can move it to output structure directly
How to load the table in certain order is a question |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
why not post the COBOL copybooks of the arrays to clarify the problem
from Your description the content of the <rows> of the arrays look different
post the COPYBOOKS ( the relevant part ) using the code tags |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Do you get the data by calling the common module(s) from within your program or do you read them in as files? I ask this because I do not see the specifics only that the data comes from a common module (first post) 2 different modules (last post). Your last post says you read in the data which implies a file which implies that you can sort the data before it hits your program and you can do a 2 file match. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I suspect that this approach has been dictated or conceived and now there is a desire to see it thru.
From the initial post, i've believed if we knew proper detail (not yet provided) we could offer alternatives that would be much easier to implement and later to understand / maintain. |
|
Back to top |
|
|
|