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

Need to move SORT statements from main procedure to subrouti


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

New User


Joined: 19 Mar 2010
Posts: 4
Location: Plano, Tx

PostPosted: Fri Mar 19, 2010 3:46 am
Reply with quote

I need to move SORT statements from the main procedure of my code into one or more separate subroutines. I also need to remove the use of RETURN and RELEASE statements from the main procedure as well. How do I go about doing this? Should I create temporary files that contain the data that would have been RELEASED to the sort work file? Can I pass an SD in the linkage section? Can I write to an SD just as I would to an FD? If so, I wouldn't need a USING clause, would I? Even better, would it be possible to create a generic SORT subroutine that I could use to replace all of my specific SORT statements?

The SORT statements I'm currently working with are of the variety of SORT ... INPUT / OUTPUT PROCEDURE ...

The platform is IBM z/OS COBOL 3.2.

Thanx for any help that anyone can provide.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Mar 19, 2010 5:30 am
Reply with quote

You cannot use WRITE to an SD.

Although you are using COBOL, these questions are more SORT oriented. Which SORT package are you using so we can move this topic to the appropriate forum?
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: Fri Mar 19, 2010 8:49 am
Reply with quote

Hello and welcome to the forum,

For us to be much help you need to explain why youn need to so drastically change the process. Rather than just carving up the existing code suggest some study go into what has changed in the requirement. . .

If you change from release/return to writing files and then sorting them, you will quite likely take a performance hit.
Back to top
View user's profile Send private message
John G Carter

New User


Joined: 19 Mar 2010
Posts: 4
Location: Plano, Tx

PostPosted: Fri Mar 19, 2010 8:56 pm
Reply with quote

The reason for the change is that we are moving from programming in COBOL to a model-driven development system that generates COBOL. However, it does not have a built-in SORT so I have to restructure the code so the sorts are done in hand-edited COBOL. I want to have as little code in the hand-edited COBOL as possible as I can duplicate the rest of it in the model.

Here's a thought; what if I have a COBOL subprogram with multiple entry points. One for the sort itself and others for RELEASEs and RETURNs. Since all of these statements would be in the same COBOL subprogram, they can all work against the same SD.
Back to top
View user's profile Send private message
John G Carter

New User


Joined: 19 Mar 2010
Posts: 4
Location: Plano, Tx

PostPosted: Fri Mar 19, 2010 9:08 pm
Reply with quote

Oops, I just realized that the multiple entry point subprogram won't work as the RELEASE and RETURN statements are called from the sort program itself.

I guess what I'm going to have to do is write to a separate file instead of doing RELEASEs and use the SORT ... USING syntax instead of the SORT ... INPUT syntax. Either that or put all of the code used by the sort (namely the input and output procedures) into the subprogram as well. From a performance point of view, doing this might be better but it means there will be more code outside of the model that has to be maintained separately.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Mar 19, 2010 10:00 pm
Reply with quote

This seams to be a MAJOR design/platform change for your company.

They may want to consider purchasing and external sort product such as Dfsort or Syncsort (may be other cheaper ones as well.)

This way you can have your data in the order you need it leaving the Cobol code, however it is generated, worry about the buisness logic.

Your posts remind me of a six year old rambling on making no sense what so ever.

It may just be the run on paragraphs.
Back to top
View user's profile Send private message
John G Carter

New User


Joined: 19 Mar 2010
Posts: 4
Location: Plano, Tx

PostPosted: Fri Mar 19, 2010 10:09 pm
Reply with quote

Gee, Dave, don't hold back. Tell us what you really think.

Your response is not helpful in the least. If I'm not being clear enough for you, please just say so and I'll try to provide more info. But insults are never appreciated or helpful.
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: Fri Mar 19, 2010 10:10 pm
Reply with quote

Hello,

Quote:
They may want to consider purchasing and external sort product such as Dfsort or Syncsort
The system surely already has a sort product installed.

When SORT is used in COBOL (internal sort) the system sort is invoked whether it is DFSORT, Syncsort, or some other sort.

If the goal is to keep as much of the code as possible in the "generator", you might consider simply removing the sort from the current process. Write all of the data as needed and when the process completes, then sort the data and do whatever "back end" processing is needed with the sorted data.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Fri Mar 19, 2010 10:32 pm
Reply with quote

John,

It was not meant as an insult, just an observation, meant in a light hearted way.

In terms of not being helpful, seeing through the 'insults' in my previous post:

1) Remove the sort logic from the cobol code.
2) Use external sort product to transform data before (or after as Dick suggests)
3) Use code generator for buisness logic
4) Avoid run on thoughts, they are difficult to pick out of a long paragraph

All of the above was mentioned.

Sorry if you were insulted, that was not the intent.

If you read through many posts on this forum, I am an amature at witty retorts compared to others on here.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top