IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want the data in a certain order for my output structure


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madhu_910

New User


Joined: 21 Feb 2005
Posts: 10

PostPosted: Mon Oct 08, 2012 7:29 am
Reply with quote

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

Moderator Emeritus


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

PostPosted: Mon Oct 08, 2012 7:55 am
Reply with quote

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

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Oct 08, 2012 10:06 am
Reply with quote

Your perception that only numeric data can be sorted is very wrong

You can atleast try bubble sort
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Oct 08, 2012 10:40 am
Reply with quote

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

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Oct 08, 2012 1:07 pm
Reply with quote

It's COBOL so they are tables.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Oct 08, 2012 1:13 pm
Reply with quote

Yes Dick I got it
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 08, 2012 3:17 pm
Reply with quote

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

New User


Joined: 21 Feb 2005
Posts: 10

PostPosted: Mon Oct 08, 2012 6:56 pm
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 08, 2012 7:00 pm
Reply with quote

actually, it is not clear yet.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Oct 08, 2012 7:32 pm
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 08, 2012 7:38 pm
Reply with quote

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

New User


Joined: 21 Feb 2005
Posts: 10

PostPosted: Mon Oct 08, 2012 7:50 pm
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Oct 08, 2012 7:52 pm
Reply with quote

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

New User


Joined: 21 Feb 2005
Posts: 10

PostPosted: Mon Oct 08, 2012 8:13 pm
Reply with quote

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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Oct 08, 2012 8:27 pm
Reply with quote

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

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Oct 08, 2012 10:40 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Tue Oct 09, 2012 8:11 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Rotate partition-logical & physic... DB2 0
Search our Forums:

Back to Top