Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need advise in calling DFSORT from REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
ajithajt

New User


Joined: 21 Mar 2016
Posts: 10

PostPosted: Thu Nov 29, 2018 10:50 am    Post subject: Need advise in calling DFSORT from REXX
Reply with quote

Hi,

I am having a Rexx program to split a file into number of files( number will vary depending on data) and create those files dynamically. I achieved it thru Rexx, but since the volume of data is huge its consuming high CPU. So now we were advised to perform the copy operation by invoking the DFSORT utility. I have the below code to perform the operation.

/* SIMPLE REXX CLIST TO EXECUTE DFSORT */
/* ASSUMES DFSORT IS IN SYS1.LPALIB */
"FREE FI(SYSOUT SORTIN SORTOUT SYSIN)"
"ALLOC FI(SYSOUT) DA(*)"
"ALLOC FI(SORTIN) DA('userid.INS1') REUSE"
"ALLOC FI(SORTOUT) DA('userid.OUTS1') REUSE"
"ALLOC FI(SYSIN) DA('userid.SORT.STMTS') SHR REUSE"
ADDRESS LINKMVS ICEMAN

But my issue here is i don't want the SORTIN to be passed with a dataset. I have the data available in my REXX stem variable. I need to pass this data as an input to this DFSORT operation.

What we are looking for is to take the copy operation from REXX plate to DFSORT. Could someone please help me on this.

Regards,
Ajt
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8744
Location: Welsh Wales

PostPosted: Thu Nov 29, 2018 12:30 pm    Post subject:
Reply with quote

You will probably find that you are unlucky in what you want.
Although, as you have given hardly any information at all ...............

So how did the data get into the stem variable - surely not the huge volume of records already mentioned ? Please tell me NO.

What you really need to do is the sit down and analyse what you want to achieve. From scratch seems like a good idea as like so many, it appears that you are looking at only the short term solution.

My first thoughts would be to work out exactly what was needed, then look at the sort solution. Why bother invoking sort via REXX unless this is one of those "Let's lock a terminal for hours" solutions.

Take the time to explain fully and accurately exactly what it is that you want to achieve and then be prepared to accept solutions that are not the ones that you had thought of.

MORE INFORMATION REQUIRED !
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2468
Location: Netherlands, Amstelveen

PostPosted: Thu Nov 29, 2018 1:04 pm    Post subject:
Reply with quote

You can call DFSORT from Rexx by passing a parameterlist.

Read the manuals or do some searching on the internets.
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 248
Location: Denmark

PostPosted: Thu Nov 29, 2018 2:28 pm    Post subject:
Reply with quote

DFSORT must have the input from either SORTIN, or from a SORT exit E15. So unless you are prepared to write a SORT exit, which in my opinion would be overkill, then you need that dataset.
As PeterHolland wrote, you can use a parameter list to change the name of SORTIN, but not eliminate the need for it.
Keep in mind that it could be a temporary dataset. If you have the PIPE command available then that would simplify writing the stem to a dataset. If not, what is the big deal? It takes 2 statements to write a stem to a dataset:
- BPXWDYN ALLOCATE (BPXWDYN can allocate a temporary dataset)
- EXECIO to write the stem
At the end you must BPXWDYN FREE or TSO FREE the dataset.
I too would like to know the reason why you want to avoid the SORTIN dataset.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2123
Location: UK

PostPosted: Thu Nov 29, 2018 2:43 pm    Post subject: Reply to: Need advise in calling DFSORT from REXX
Reply with quote

I believe that what you are being asked to do with sort is to REPLACE your rexx program - not include sort in it. Large number of records and Rexx are not a good combination even if you compile your Rexx. Any thing more than a few (say 30) thousand records then you should be looking at not using Rexx at all.
Back to top
View user's profile Send private message
ajithajt

New User


Joined: 21 Mar 2016
Posts: 10

PostPosted: Thu Nov 29, 2018 3:16 pm    Post subject:
Reply with quote

Hi All,

Thank you for your responses. Below mentioned is my exact requirement.

I have the below two data sets as input.

data set1.test - which is a control card in which the flags are set for stake holders that requires the report.

data set2. Test - which contains the consolidated monthly report of all stake holders.

Each stake holders records will be split using the variable split in pos 1 to 6.

Eg.

Split
Stkhldr1
Stkhldr1
Stkhldr1
Split
Stkhldr2
Stkhldr2
Split
Stkhldr3

Current Rexx Logic.

It will first read the control card and stores all stakeholder ids in a list. Then it will read the consolidated report data set and whenever it finds the identifier split, it will check whether that stake id is available in list and it will allocate a data set which contains the name of that stake holder (eg. Stkhldr1.File) and copies the data to it. If no report is found in consolidated data set for a stake holder then dummy data set will be created.

Issue am facing here is copy operation is taking a lot of cpu. So thought of moving that alone to Dfsort. If the whole operation can be achieved through sort then that is also fine.

Please share your thoughts.

Regards,
Ajt

edited to correct spelling and mis-use of 'file'
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2123
Location: UK

PostPosted: Thu Nov 29, 2018 5:13 pm    Post subject: Reply to: Need advise in calling DFSORT from REXX
Reply with quote

Find, on the internet, the document by the DFSort team describing the various ways of splitting a data set (amongst other topics). The document is "Smart DFSORT Tricks".
Presumably the consolidated report file has a means of identifying which report is for which stake-holder?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2448
Location: @my desk

PostPosted: Fri Nov 30, 2018 1:28 am    Post subject:
Reply with quote

Quote:
Issue am facing here is copy operation is taking a lot of cpu. So thought of moving that alone to Dfsort. If the whole operation can be achieved through sort then that is also fine.
You could consider writing some COBOL code to allocate output data sets dynamically using BPXWDYN, reading both your control input as well as the consolidated input data sets.
This can also be achieved using a sort solution, but you may probably need to build a split job dynamically just reading your control input to create as many output DD statements and OUTFIL control statements as needed. Then the dynamic job would need to be submitted through internal reader. Most shops may not prefer implementing something like this in production though.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2128
Location: Silicon Valley

PostPosted: Fri Nov 30, 2018 10:57 am    Post subject: Reply to: Need advise in calling DFSORT from REXX
Reply with quote

Quote:
"ALLOC FI(SORTIN) DA('userid.INS1') REUSE"
...

But my issue here is i don't want the SORTIN to be passed with a dataset. I have the data available in my REXX stem variable. I need to pass this data as an input to this DFSORT operation.


I think what you want is to:
1. use EXECIO to write your desired SORT control statements based on your rexx stem information,
2. allocate your new data set to SORTIN, then
3. call DFSORT.
Back to top
View user's profile Send private message
sergeyken

Active User


Joined: 29 Apr 2008
Posts: 388
Location: Maryland

PostPosted: Fri Nov 30, 2018 9:43 pm    Post subject: Re: Reply to: Need advise in calling DFSORT from REXX
Reply with quote

Pedro wrote:
Quote:
"ALLOC FI(SORTIN) DA('userid.INS1') REUSE"
...

But my issue here is i don't want the SORTIN to be passed with a dataset. I have the data available in my REXX stem variable. I need to pass this data as an input to this DFSORT operation.


I think what you want is to:
1. use EXECIO to write your desired SORT control statements based on your rexx stem information,
2. allocate your new data set to SORTIN, then
3. call DFSORT.

SYSIN, not SORTIN
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 -> CLIST & REXX 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 process gdg in rexx program wh... pkmurali CLIST & REXX 0 Thu Dec 13, 2018 10:08 am
No new posts calling java code(on mainframe from c... elixir1986 COBOL Programming 1 Fri Nov 30, 2018 1:57 am
No new posts Rexx on amod 24 shahaf CLIST & REXX 19 Thu Nov 29, 2018 1:07 am
No new posts How to handle different file length b... javen777 DFSORT/ICETOOL 15 Mon Nov 26, 2018 12:13 pm
No new posts How to count the number of times key ... vnktrrd DFSORT/ICETOOL 14 Thu Nov 15, 2018 9:19 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us