Thanks Rob, that is more along the lines of what I was thinking, and I
suspected there would be a stage already there, capable of meeting my
expectation. Definitely more RTFM for me. An amazing array of available
stages, I lost count!
Re strliteral, here is my code now, which is behaving oddly, saying there is no
delimited string when for the life of me I can't see why.
trace r
arg unit . /* find this unit in the FREE list */
if unit = '' then exit
signal on novalue
say "finding free DASD: " unit ;say
address command /* requires PIPE to be capitalised */
'PIPE cp q dasd free ' , /* list free DASD */
'|split ,' , /* split at commas */
'|strip' , /* strip blanks */
'|locate /' unit '/' , /* find the unit */
'|strliteral ifempty /No data found/ ' ,
'|console ' /* show it */
The REXX trace is below, showing message FPLLIT060E whose help suggests as a
possible cause “an error in specifying a column range caused the column range
to be interpreted as a delimited string.”
If anyone can point out the error I will be most grateful. RTFMing three times
has not helped me ☹ I can’t really see how column ranges come into it.
AFAICT the invocation of strliteral ifempty matches that shown in the Fine
Manual, which I reproduce here from SC24-6252-00 CMS Pipelines User’s Guide and
Ref v6.4:
“To write a line instead of the output:
pipe cp q v da | locate w4 ,(VDSK), | ...
... strliteral ifempty /No V-disk/ | console”
9 *-* arg unit . /* find this unit in the FREE list */
>>> "AFB9"
>.> ""
10 *-* if unit = ''
>>> "0"
11 *-* signal on novalue
12 *-* say "finding free DASD: " unit
>>> "finding free DASD: AFB9"
finding free DASD: AFB9
*-* say
13 *-* address command /* requires PIPE to be capitalised */
14 *-* 'PIPE cp q dasd free ' , /* list free DASD */
'|split ,' , /* split at commas */ '
|strip' , /* strip blanks */ '|locate /' unit '/' ,
/* find the unit */ '|strliteral ifempt
y /No data found/ ' , '|console ' /* show it */
>>> "PIPE cp q dasd free |split , |strip |locate / AFB9 /
|strliteral ifempty /No data found/ |console "
FPLLIT060E Delimiter missing after string "ifempty /No data found/"
FPLSCA003I ... Issued from stage 5 of pipeline 1
FPLSCA001I ... Running "strliteral ifempty /No data found/"
+++ RC(60) +++
Thanks again for everyone’s help, much obliged.
Kind regards,
Peter Bishop
System Programmer – Mainframe
-----Original Message-----
From: CMSTSO Pipelines Discussion List <[email protected]> On Behalf
Of Rob van der Heij
Sent: Wednesday, March 6, 2019 20:14
To: [email protected]
Subject: Re: [CMS-PIPELINES] beginner's question: how can I process an empty
pipe?
On Wed, 6 Mar 2019 at 05:51, Bishop, Peter
<[email protected]<mailto:[email protected]>> wrote:
> Glenn,
>
> Thanks so much. I can see I've a lot to learn! I'll try these out
> when I'm back in the office tomorrow and let you (and the other readers) know.
>
Indeed, there's always something new to learn. While Glenn is right with the
more robust example to avoid code injection, the modern appendage somewhat
closer to what you were doing is is with STRLITERAL IFEMPTY like
| locate ...
| strliteral ifempty /No data found/
| cons
In this case, STRLITERAL passes all input records to its output stream, but if
no records were passed, it writes the specified string to the output instead.
Since you should always learn something more than what you were looking for,
the COND option tells STRLITERAL to produce the string only when there are some
records to pass. That's ideal when you need a header like "These users have
linked the minidisk" and think it is silly to show that when there are no users.
Sir Rob the Plumber
DXC Technology Australia Pty Limited; Registered Office: 26 Talavera Road,
Macquarie Park NSW 2113 Australia; Incorporated in Australia ACN: 008 476 944.
DXC Technology Company -- This message is transmitted to you by or on behalf of
DXC Technology Company or one of its affiliates. It is intended exclusively for
the addressee. The substance of this message, along with any attachments, may
contain proprietary, confidential or privileged information or information that
is otherwise legally exempt from disclosure. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended recipient
of this message, you are not authorized to read, print, retain, copy or
disseminate any part of this message. If you have received this message in
error, please destroy and delete all copies and notify the sender by return
e-mail. Regardless of content, this e-mail shall not operate to bind DXC
Technology Company or any of its affiliates to any order or other contract
unless pursuant to explicit written agreement or government initiative
expressly permitting the use of e-mail for such purpose.