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
 

 

Need to move SORT statements from main procedure to subrouti

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Need to move SORT statements from main procedure to subrouti
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Fri Mar 19, 2010 5:30 am    Post subject:
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

Site Director


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

PostPosted: Fri Mar 19, 2010 8:49 am    Post subject:
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    Post subject: Reply to: Need to move SORT statements from main procedure t
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    Post subject:
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: 662
Location: Pennsylvania

PostPosted: Fri Mar 19, 2010 10:00 pm    Post subject:
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    Post subject: Reply to: Need to move SORT statements from main procedure t
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

Site Director


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

PostPosted: Fri Mar 19, 2010 10:10 pm    Post subject:
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: 662
Location: Pennsylvania

PostPosted: Fri Mar 19, 2010 10:32 pm    Post subject:
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    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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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