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 

Suggestion needed for a COBOL with SORT capacity

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


Joined: 05 Oct 2005
Posts: 28
Topics: 20
Location: INDORE

PostPosted: Sat Aug 25, 2007 2:21 pm    Post subject: Suggestion needed for a COBOL with SORT capacity Reply with quote

Hi,
There is a job which is having 5 stpes.The first step with a program(say x) creates 2 files and then the next 2 stpes are SORT steps.the 4th and 5 th steps again creates 2 diffrent reports with 2 diffrent programs by using the SORT'ed (2 nd and 3 rd sort steps) o/p files.

Now our requireent is to combine all these steps into a sinlge stp thru a COBOL program.The basic idea here is to remove the SORT conditions.

Here are the sample details.

The input file is a VSAM file and based on few conditions we create 2 flat files.
Let's say the 2 flat files are of FB with the below.
File -1

AAA 123 X
BBB 234 Y
CCC 123 X
DDD 135 Y

file-2
CCC 123456 xyz
DDD 234567 klm
EEE 123456 xyz

Now in the second step we are SORTing the file-1 on second column and in 3 rd SORT step we are sorting on third column.The 4 step uses the 2 nd sort out file and creates a report.The same way the 5 th step create a report using 3 rd sorted o/p file form step 3.

The final o/p files from the step 4 and step 5 will come like below.

4 th :

AAA 123 X
CCC 123 X
DDD 135 Y
BBB 234 Y

5 th:
CCC 123456 xyz
EEE 123456 xyz
DDD 234567 klm

Can anybody give some idea how to achive this one in a single step.
I am having an option to use multiple programs with internal calling.
Like I can use the CALL <program> in the X program.

Thanks
Tempuser
Back to top
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Sat Aug 25, 2007 4:39 pm    Post subject: Reply with quote

One input, two intermediate and two reports?

COBOL internal SORT:
Read input...
Add an extra identifier for the two outputs, selecting for one or the other or both...
If needed, add additional keys for the sort...
Upon the extra identifier, use fro one report or the other....
Do-able....

Need more info?
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Sat Aug 25, 2007 11:58 pm    Post subject: Reply with quote

Though the number of Steps in the job will be reduced, is this such long running job (5 steps) that it is worth exchanging the 5 obvious (and probably simple) steps to the complexity of one monster program which will be harder to maintain than the 5 simple steps?

is the extract criteria so complex that the 1st program could not be replaced with enhanced sort 2 and 3? sort can read vsam. code the INCLUDE parms and you have your sorted output without the need of pgm 1.

is the report format so complex that you can't use sorts report building capabilities? If you did that you would only need two steps and nothing else.

If you just gotta write a monster program, have it read the two sort outputs and CALL modified versions of pgm's 4 and 5. Pgms 4 and 5 would be gutted. I/O removed to new control pgm. Pgm 4 and 5 would be passed the record image.

So instead of having one new monster program scenario to replace 5 steps, that by the way work, think about using the extract and report building capabilites of sort. If the extract criteria or the reporting criteria is really, really complex then you can use the user exits capabiliites of either DFSORT or SYNCSORT.
  • If DFSORT, then you have Frank, Kolusu and many others on this board to help.
  • If SYNCSORT, then you have Alissa, Kolusu and many others on this board to help.
Thus you would reduce the Job from 5 to 2 steps - without increasing the sort volume.

If some yoyohead hands you garbage about the possibility of changing sort products, this can't be the only job in your system that uses sort.

you are looking at the possibility of generating control cards for a pair of sort steps in a few days, as apposed to the development time of a new monster module - which based on your original question will take you definitely more than a few days to develop. (and that is after you figure out what to do).

In addition, there is a higher cost to debugging a COBOL internal sort than debugging a complex sort. The Frank's and Alissa's will always be around (they support the SORT product), but the original developer of the Monster Double Internal COBOL Sort and Report program (MDICSRAP) may not always be available to your shop. That is a pro-argument for management. The trade of complexity of a one program solution to the simple-to-analyze-and-change-control-cards solution is BEST PRACTICE. If these are large volume sorts, combining them will make it a single double-large volume sort.

Agreed, an experienced sr. programmer/analyst (if he choose to accept this assignment) could write/debug/install/DOCUMENT this monster program within a couple of weeks. Actually, the job is easy - if you are experienced and understand what is involved. But if you don't, you are talking about a real-pain-in-the-butt debugging project, as well as the fact that this is not a Best Practice to reduce steps in a job with a higher volume sort and complex program.

sorry about the preaching, it's Sunday!
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


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

PostPosted: Sun Aug 26, 2007 12:44 am    Post subject: Reply with quote

Quote:
Now our requireent is to combine all these steps into a sinlge stp thru a COBOL program.The basic idea here is to remove the SORT conditions.


hi, still preaching. How are you going to remove the SORT conditions? Read the vsam and build internal tables?

How big are these vsam files and how large is the extract (record size and volume).

Your original post was rather sketchy on the report definition, but it seemed to be a detail listing, which was sorted.

One of the goals of our contributions, in addition to here and there tech tips, is to pass-on Best Practices.

If you would elaborate on the extract criteria and a little more detail about the reporting requirements, we would be in a better position to provide 'full service'.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
edkir98
Beginner


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Mon Aug 27, 2007 6:09 am    Post subject: Re Reply with quote

Given the current situation the best option would be
1) Execute the first X program
2) Use COBOL sort for the 1st file
3) Use COBOL sort for the 2nd file
4) Open the output of the 1st sort file and do the report process
5) Open the output of the 2nd sort file and do the report process
Although this process is bound to be less effective than using the JCL sort, given this situation only this could be effective. Smile
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Aug 27, 2007 6:48 am    Post subject: Reply with quote

Quote:

There is a job which is having 5 stpes.The first step with a program(say x) creates 2 files and then the next 2 stpes are SORT steps.the 4th and 5 th steps again creates 2 diffrent reports with 2 diffrent programs by using the SORT'ed (2 nd and 3 rd sort steps) o/p files.

Now our requireent is to combine all these steps into a sinlge stp thru a COBOL program.The basic idea here is to remove the SORT conditions.


tempuser,


The latest products can act like a programming language. with the help of IFTHEN statements you can avoid the 2 sort steps. You are splitting the file into 2 files based 2 conditions. Assuming that it is an indicator here is a sort step which will give you the final output files without intermediate sorting.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD *
----+----1----+----2----+----3                         
AAA 123 X          FILE1                 
BBB 234 Y          FILE1                 
CCC 123 X          FILE1                 
DDD 135 Y          FILE1                 
CCC 123456 XYZ     FILE2                 
DDD 234567 KLM     FILE2                 
EEE 123456 XYZ     FILE2                 
//OUT1     DD SYSOUT=*                   
//OUT2     DD SYSOUT=*                   
//SYSIN    DD *   
  INREC IFTHEN=(WHEN=(20,5,CH,EQ,C'FILE1'),
       OVERLAY=(81:5,3,3X)),               
        IFTHEN=(WHEN=(20,5,CH,EQ,C'FILE2'),
       OVERLAY=(81:5,6))                   

  SORT FIELDS=(81,6,CH,A)                 

  OUTFIL FNAMES=OUT1,                     
  INCLUDE=(20,5,CH,EQ,C'FILE1')           

  OUTFIL FNAMES=OUT2,                     
  INCLUDE=(20,5,CH,EQ,C'FILE2')           
/*                                       


OUT1:

Code:

AAA 123 X          FILE1
CCC 123 X          FILE1
DDD 135 Y          FILE1
BBB 234 Y          FILE1


OUT2:

Code:

CCC 123456 XYZ     FILE2
EEE 123456 XYZ     FILE2
DDD 234567 KLM     FILE2


Now your first 4 steps are just reduced to 1 step. If you need further help post detailed information about the include conditions to split the files and also lrecl and recfm of the files.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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