Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
Quote:
A REXX will need to be kept in a separate library or have an extra step to write it to a temporary PDS
Huh? And how about the sort control records, they are not kept in a
library, or are they used in-stream.
A batch REXX (REXX being one of your skills) can pre-allocate the input/output.
Then you only need to do some EXECIO for those datasets, and some
formatting of the input. And all that in 1 step, very readable for everyone.
And the REXX statements can be in-stream also.
Huh? And how about the sort control records, they are not kept in a
library, or are they used in-stream.
In-stream
Quote:
A batch REXX (REXX being one of your skills) can pre-allocate the input/output.
Then you only need to do some EXECIO for those datasets, and some
formatting of the input.
The input isn't actually coming from a dataset per-se, it is coming from a query to TWS/OPC
Quote:
And all that in 1 step, very readable for everyone.
And the REXX statements can be in-stream also.
As I said, to use "in-stream" REXX, you need a separate step to write them to a temporary PDS.
Also, "very readable" is one thing. Since the others don't understand it, if I want others to support it, I stick to things that they will support.
Captain Paralytic,
Your given sort card and expected output doesn't match. It doesn't even match the output you believe you are getting now.
For the same input if I run the sortcard you have provided,I am getting below output with 3 records only but you mentioned you are getting all 5 input records.
Did you look at the link Kevin provided earlier. Below is the sort card to get what you want. I am assuming you only want to include, records with A in 18th position. If you do want all records in output, then remove INCLUDE COND line from the second step.
Captain Paralytic,
Your given sort card and expected output doesn't match. It doesn't even match the output you believe you are getting now.
Hi sqlcode1, note that my post started with
"From input records like:"
I just grabbed a few of the input records and a few of the output ones.
Yes I did look at the post. I also came up with another couple of possibilities myself, using ICETOOL's SUBSET and the DISCARD operand, or two SUBSETs and combining their output.
I just grabbed a few of the input records and a few of the output ones.
I understand that you randomly selected few records to show output and this might work for you because you knew the actual/final requirements. For someone who is trying to answer your question, requirements might not be known, so having correct expected output actually does help.
Quote:
Yes I did look at the post. I also came up with another couple of possibilities myself, using ICETOOL's SUBSET and the DISCARD operand, or two SUBSETs and combining their output.
Glad that you came up with another solution. If I am guessing it right, in your solution you are using couple of SUBSET statements, first one to select all the records but last but to add semicolon ';' and then later in the socond SUBSET you select only last record to add period '.'. Something like below.
If this is the case, then I am afraid your solution may not be efficient. Wait until Frank or Kolusu gives you better explanation on why!!! I have learnt this hard way.
I had originally tried OUTREC as in your post, but got the error:
OUTREC STATEMENT FOUND BUT NOT ALLOWED - USE OUTFIL STATEMENT INSTEAD
So changed to OUTFIL, finally using a COPY to perform the SQZ
I've never understood why one needs an OUTFIL FNAMES=xxx statement for a USING CNTL for a SELECT (or SUBSET), when the DDNAME is already coded in the TO() parameter. If anyone can tell me I'd be interested.
However, for completeness, here is the actual solution I managed to make work:
Captain Paralytic,
You had all these errors because you are using solution with SUBSET(s) which I already mentioned may not be efficient. I was referring to the original solution.
Like I mentioned, I have learnt this hard way and I would not use multiple SUBSET. It is unnecessary read for the input records.
Wait until Frank or Kolusu could explain you better on why you DON'T want to use multiple SUBSET(s).
Quote:
The whole block of your code was copied and pasted as you wrote it.
Since earlier you didn't mention your card with multiple subsets, that was what I said I assumed your code might look like. I took your original sortcard and put it in CNTL1 and CNTL2.
Regarding you errors, refer to this link for SUBSET
From DFSort Application Programming,
Quote:
The DFSORT control statements in xxxxCNTL are used if USING(xxxx) is specified. However, you must observe these rules for control statements in the xxxxCNTL data set:
MODS and OUTREC statements should not be present.
SKIPREC and STOPAFT operands, and INCLUDE and OMIT statements, should not be present.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
I've never understood why one needs an OUTFIL FNAMES=xxx statement for a USING CNTL for a SELECT (or SUBSET), when the DDNAME is already coded in the TO() parameter. If anyone can tell me I'd be interested.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Guys - this is the second thread today that has gone "way over the top". I removed all of the "garbage" and will continue to do so if people continue to post more. Let's keep it civil and helpful, please. I have better things to do with my time than edit these threads.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
Wait until Frank or Kolusu could explain you better on why you DON'T want to use multiple SUBSET(s).
I wish people wouldn't put words in my mouth. Multiple SUBSET operators can be "appropriate" in some cases. If you're happy with the performance of your job, then by all means keep using it. Whether a job is efficient enough depends on how many records you are processing, what criteria you use to evaluate efficiency, etc. I try NOT to make blanket statements about performance since it usually depends.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Captain Paralytic,
I guess you are generating the Tivoli work scheduler control cards. Since the action is just a list, would it hurt to generate the last record twice ? If so you can use the following JCL
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
UHY#S P 711231
UHYA1 A 711231
UHYA1AVL P 711231
UHYA2 A 711231
UHYA5 A 711231
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INCLUDE COND=(18,1,CH,EQ,C'A')
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,
BUILD=(C'ACTION=LIST,RESOURCE=ADCOM,STATUS=A,VALTO=',
20,6,C',ADID=',1,17,C';',80:X)),
IFTHEN=(WHEN=INIT,BUILD=(1,80,SQZ=(SHIFT=LEFT))),
IFTHEN=(WHEN=INIT,OVERLAY=(81:1,80)),
IFTHEN=(WHEN=INIT,FINDREP=(INOUT=(C';',C'.'),STARTPOS=81))
OUTFIL REMOVECC,BUILD=(1,80),TRAILER1=(81,80)
//*
Frank,
My comments for not using multiple subsets in this situation was relating to the fact that SUBSET may have to invoke SORT routine twice in performing TRAILER operations. Also the solution which I was referring to OP about ,was provided by you in some other thread and hence I asked OP to seek your feedback/comments.
From DFSort Application Programming
Quote:
If the criteria includes the last n records, ICETOOL may call DFSORT twice. For the first pass, ICETOOL counts the indd records without opening the output data sets. For the second pass, ICETOOL opens the output data sets and does SUBSET processing against the indd data set using the count obtained in the first pass.
Since this topic went little sidetracked, I decided to share only little information which was relevant.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Yes, it may invoke DFSORT twice, but for two copy operations which is usually pretty fast and in the case of SUBSET, it's a special copy operation which is even faster.
The other solution I gave is actually similar to the SUBSET solution and may or may not perform better. The only way to know would be to try them both with the specific data of interest. But I wouldn't make a blanket statement that one is necessarily more efficient than the other without testing them.
What I'm really trying to say here is: I would advise against making blanket statements about what is more efficient than what. YMMV.