I know I can "read" through the dataset (member) being edited with
"ISREDIT (var) = LINE label", and process each line with REXX functions,
and the rewrite each line. However, I'd really like to do it using EDIT
commands but I just can't figure out how. My problem is that "$" in an
EDIT picture string means "special character" rather than the character
"$". I've tried various combinations of EXCLUDE, FIND, CHANGE, FLIP,
etc. with various picture strings, and nothing seems to do what I want.
Here's one attempt:
ADDRESS ISREDIT
"PROCESS RANGE C"
"X ALL"
"F P'$===$' 1 5 .ZFRANGE .ZLRANGE ALL"
And then my plan was to just "CHANGE string1 string2 NX ALL", but of
course the above displays lines that have *any* special character in
columns 1 and 5.
Is this just impossible, or am I just missing something obvious? Is
there some way to concatenate operands for the string, like
C'$'||P'==='||C'$'?
Jeff
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
Mike Giaquinto
AVP/CICS Technical Lead - Wells Fargo
This message may contain confidential and/or privileged information. If
you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based on
this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation
HTH,
Dave Salt
SimpList(tm) - try it; you'll get it!
http://www.mackinney.com/products/SIM/simplist.htm
> Date: Thu, 14 Aug 2008 13:19:38 -0400
> From: Jeff....@ASG.COM
> Subject: Edit Macro Question
> To: TSO-...@VM.MARIST.EDU
_________________________________________________________________
Jeff
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Parse var string col1 2 fill 4 col5 6 fill2 ;
If col1 = '$' and col2 = '$' then whatever
Maybe I'm missing something. . .
bobh
Can anyone tell me that what is the error in the below code. The control
is goes to ELSE step (line 14) even though the condition is false on
line 6. The control have to go to line 24 which the TRUE condition.
1 GETMSG_EMAIL:
2 IF GET_EMAIL_SENT \= 'Y' THEN DO
3 GET_EMAIL_SENT = 'Y'
4 SAY 'GET EMAIL SENT....'
5 ERR_FNAME_COUNT = 0
6 IF FUNCTION_CODE = 'T' THEN DO --> It is
false.
7 DO I = 1 TO OUTPUT.0
8 PARSE VAR OUTPUT.I MSGID DIRLINE
9 DIRLINE = STRIP(DIRLINE)
10 IF STRIP(MSGID) = '550' THEN DO
11 IF ERR_FNAME_COUNT > 1 THEN
12 ERR_FNAME = ERR_FNAME || ',' ||
13 SUBSTR(DIRLINE,1,POS(':',DIRLINE)-1)
14 ELSE
----------------> control is coming to here.
15 ERR_FNAME = SUBSTR(DIRLINE,1,POS(':',DIRLINE)-1)
16 END
17 END
18 J = I + 1
19 RC1 = SUBSTR(STRIP(OUTPUT.J),27,POS(','STRIP(OUTPUT.J))-1)
20 RC1 = STRIP(RC1)
21 IF DATATYPE(TC1,'W') = 0 THEN RC = 12
22 END
23 END
24 IF FUNCTION_CODE = 'F' | FUNCTION_CODE = 'C' THEN DO
---> control have to come here.
25 DO I = 2 TO GETCMDQ.0
26 IF TRANSLATE(STRIP(GETCMDQ.I)) \= 'CD ' &
27 TRANSLATE(STRIP(GETCMDQ.I)) \= 'QUIT' THEN DO
28 IF ERR_FNAME_COUNT > 1 & GETCMDQ.I \= ' ' THEN
29 ERR_FNAME = ERR_FNAME || ',' || GETCMDQ.I
30 ELSE
31 ERR_FNAME = GETCMDQ.I
32 END
33 ERR_FNAME_COUNT = ERR_FNAME_COUNT + 1
34 END
35 IF FUNCTION_CODE = 'F' THEN RC1 = 166
36 IF FUNCTION_CODE = 'C' THEN RC1 = 12
37 END
38 SAY 'ERR_FNAME = ' ERR_FNAME
39 CALL SEND_EMAIL
40 END
41 RETURN
Thanks and Regards,
Gangireddy Siva Pratap Reddy
at a first glance try a continuation character (,) here:
> 12 ERR_FNAME = ERR_FNAME || ',' ||
> 13 SUBSTR(DIRLINE,1,POS(':',DIRLINE)-1)
Regards
Heinz-Bernd Leifeld
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Hi,
1 GETMSG_EMAIL:
3 GET_EMAIL_SENT = 'Y'
5 ERR_FNAME_COUNT = 0
16 END
17 END
----------------------------------------------------------------------
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Gangireddy, Siva Pratap Reddy
Thanks! MPD
Martin Dunkel
National City Corporation
Turnover Support / ChangeMan ZMF
(w) 216-257-5354
(p) 80053...@archwireless.net
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Gangireddy, Siva Pratap Reddy
Sent: Friday, August 15, 2008 3:42 AM
To: TSO-...@VM.MARIST.EDU
Subject: [TSO-REXX] REXX - IF condition
Hi,
1 GETMSG_EMAIL:
3 GET_EMAIL_SENT = 'Y'
5 ERR_FNAME_COUNT = 0
16 END
17 END
20 RC1 = STRIP(RC1)
22 END
23 END
30 ELSE
31 ERR_FNAME = GETCMDQ.I
32 END
34 END
37 END
-------------------------------------------------------------------------------------------
***National City made the following annotations
-------------------------------------------------------------------------------------------
This communication is a confidential and proprietary business communication.
It is intended solely for the use of the designated recipient(s). If this
communication is received in error, please contact the sender and delete
this communication.
===========================================================================================
Thanks! MPD
Martin Dunkel
National City Corporation
Turnover Support / ChangeMan ZMF
(w) 216-257-5354
(p) 80053...@archwireless.net
-----Original Message-----
From: Dunkel, Martin
Sent: Friday, August 15, 2008 8:48 AM
To: 'TSO REXX Discussion List'
Subject: RE: [TSO-REXX] REXX - IF condition
In your edit session, type "HILITE LOGIC REXX" up at the top in the
command line. This will color code your DO / END pairings. You might
be missing an END statement somewhere. Also, if you have a literal
string across multiple lines and you forgot a comma, this will become
very obvious with the highlighting and color coding.
Thanks! MPD
Martin Dunkel
National City Corporation
Turnover Support / ChangeMan ZMF
(w) 216-257-5354
(p) 80053...@archwireless.net
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Gangireddy, Siva Pratap Reddy
Sent: Friday, August 15, 2008 3:42 AM
To: TSO-...@VM.MARIST.EDU
Subject: [TSO-REXX] REXX - IF condition
Hi,
1 GETMSG_EMAIL:
3 GET_EMAIL_SENT = 'Y'
5 ERR_FNAME_COUNT = 0
16 END
17 END
20 RC1 = STRIP(RC1)
22 END
23 END
30 ELSE
31 ERR_FNAME = GETCMDQ.I
32 END
34 END
37 END
-------------------------------------------------------------------------------------------
***National City made the following annotations
-------------------------------------------------------------------------------------------
This communication is a confidential and proprietary business communication.
It is intended solely for the use of the designated recipient(s). If this
communication is received in error, please contact the sender and delete
this communication.
===========================================================================================
----------------------------------------------------------------------
if i understand your problem right, i think you can do eat in an easier way:
first, exlude all lines that contain $ on column 1
second, exclude all lines that contain $ on column 5
then use the change command with the parameters ALL and X.
if you're afraid that lines might be excluded before you start the edit macro, use the reset command first.
bye,
andi
bobh
On Fri, 15 Aug 2008 13:11:34 +0530
"Gangireddy, Siva Pratap Reddy"
That won't work; it would exclude lines that have a '$' in *either* column.
Dave Salt
_________________________________________________________________
If you like crossword puzzles, then you'll love Flexicon, a game which combines four overlapping crossword puzzles into one!
http://g.msn.ca/ca55/208
You also have an unmatched END statement on line 16. You either need to
delete line 16 or add a matching DO preceding it.
Bill Bass
Senior Applications Developer
United Health Care
Greenville, SC
> -----Original Message-----
> From: TSO REXX Discussion List
> [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Gangireddy, Siva
> Pratap Reddy
> Sent: Friday, August 15, 2008 3:42 AM
> To: TSO-...@VM.MARIST.EDU
> Subject: [TSO-REXX] REXX - IF condition
>
>
> 25 DO I = 2 TO GETCMDQ.0
> 26 IF TRANSLATE(STRIP(GETCMDQ.I)) \= 'CD ' &
> 27 TRANSLATE(STRIP(GETCMDQ.I)) \= 'QUIT' THEN DO
> 28 IF ERR_FNAME_COUNT > 1 & GETCMDQ.I \= ' ' THEN
> 29 ERR_FNAME = ERR_FNAME || ',' || GETCMDQ.I
> 30 ELSE
> 31 ERR_FNAME = GETCMDQ.I
> 32 END
> 33 ERR_FNAME_COUNT = ERR_FNAME_COUNT + 1
> 34 END
> 35 IF FUNCTION_CODE = 'F' THEN RC1 = 166
> 36 IF FUNCTION_CODE = 'C' THEN RC1 = 12
> 37 END
> 38 SAY 'ERR_FNAME = ' ERR_FNAME
> 39 CALL SEND_EMAIL
> 40 END
> 41 RETURN
>
>
> Thanks and Regards,
> Gangireddy Siva Pratap Reddy
>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions,
> send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
>
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
<snip>
> >>> Date: Thu, 14 Aug 2008 13:19:38 -0400
> >>> From: Jeff....@ASG.COM
> >>> Subject: Edit Macro Question
> >>> To: TSO-...@VM.MARIST.EDU
> >>>
> >>> I'm trying to write an edit macro in REXX to make a change to all
> >> lines
> >>> that have a "$" in columns 1 and 5.
> >>>
<snip>
Try this:
RESET
X ALL
F '$' 1 ALL
XNOT '$' 5 ALL
Now you can change the data all NX lines.
Oh yeah, WTF is XNOT???
I all too often needed to be able to do just that type of thing, so I
Wrote an edit macro that works like the exclude command except that it
Does it's excludes where the string is NOT found. It accepts all of
the same parameters as the exclude command such as bounds, labels, etc.
Here's the code for XNOT:
/* REXX EXEC - EDIT MACRO XNOT *****************************/
/* excludes lines that do NOT contain the specified string */
ADDRESS ISREDIT
"MACRO (PARMIN)"
"(USERSTAT) = USER_STATE"
call check_parms
call process_lines
zedsmsg = xtot" lines excluded"
zedlmsg = xtot" lines did NOT contain the specified string."
ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
"CURSOR = "csrlno" "csrcol
exit 0
check_parms:
"(LRECL) = LRECL"
lrecl = lrecl + 0
"(CSRLNO CSRCOL) = CURSOR"
parmdir = "NEXT"
seekstr = ""
seekopt = ""
colcnt = 0
lblcnt = 0
lbl1 = ""
lbl2 = ""
minlno = 1
"(MAXLNO) = LINENUM .ZLAST"
p1 = ""
do while parmin <> ""
splitpos = dlmpos(parmin," ","""'")
if splitpos > 0
then do
ckword = substr(parmin,1,splitpos - 1)
parmin = substr(parmin,splitpos + 1)
end
else do
ckword = parmin
parmin = ""
end
upword = ckword
upper upword
select
when upword = "ALL" then parmdir = "ALL"
when upword = "FIRST" then parmdir = "FIRST"
when upword = "NEXT" then parmdir = "NEXT"
when upword = "LAST" then parmdir = "LAST"
when upword = "PREV" then parmdir = "PREV"
when upword = "CHARS" then call add_seekopt
when upword = "PREFIX" then call add_seekopt
when upword = "SUFFIX" then call add_seekopt
when upword = "WORD" then call add_seekopt
when datatype(upword) = "NUM" then call add_seekcol
when substr(upword,1,1) = "." then call add_seeklbl
otherwise do
if seekstr = ""
then seekstr = ckword
else do
zedsmsg = "Invalid Parameter"
zedlmsg = "Check for misspelled keywords",
"or too many bounds or range parameters."
ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
exit 12
end
end
end
end
if seekstr = ""
then do
zedsmsg = "Put string in quotes"
zedlmsg = "Put quotes (' ') around the string",
"of characters to search for."
ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
exit 12
end
if lblcnt = 1
then do
zedsmsg = "Label missing"
zedlmsg = "You must specify two labels to define",
"a search range."
ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
exit 12
end
parmin = strip(p1)
if parmdir = "NEXT",
& csrlno > minlno
then minlno = csrlno
if parmdir = "PREV",
& csrlno < maxlno
then do
if csrcol = 0
then maxlno = csrlno - 1
else maxlno = csrlno
end
return
add_seekopt:
if seekopt = ""
then do
seekopt = ckword
p1 = p1" "ckword
end
else do
zedsmsg = "Parameter conflict"
zedlmsg = "Only one of CHARS, WORD, PREFIX or SUFFIX",
"can be specified at a time."
ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
exit 12
end
return
add_seekcol:
if colcnt < 2
then do
colcnt = colcnt + 1
p1 = p1" "ckword
end
else do
zedsmsg = "Bounds conflict"
zedlmsg = "You must specify one or two column numbers",
"as search boundaries."
ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
exit 12
end
return
add_seeklbl:
"(LBLLNO) = LINENUM "ckword
lrc = rc
if lrc = 8
then do
zedsmsg = "Probable label error"
zedlmsg = '"'ckword'" recognized as invalid',
'or undefined label in "XNOT" cmd.'
ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
exit 12
end
if lblcnt < 2
then do
lblcnt = lblcnt + 1
p1 = p1" "ckword
if lbl1 = ""
then do
lbl1 = ckword
minlno = lbllno
end
else do
if lbllno > minlno
then do
lbl2 = ckword
maxlno = lbllno
end
else do
lbl2 = lbl1
maxlno = minlno
lbl1 = ckword
minlno = lbllno
end
end
end
else do
zedsmsg = "Label conflict"
zedlmsg = "You must specify two labels to define",
"a search range."
ADDRESS ISPEXEC "SETMSG MSG(ISRZ001)"
exit 12
end
return
process_lines:
xtot = 0
beglno = minlno
endlno = maxlno
if parmdir = "LAST",
| parmdir = "PREV"
then seekdir = "PREV"
else seekdir = "NEXT"
if parmdir = "ALL",
| parmdir = "FIRST"
then "CURSOR = "minlno" 0"
if parmdir = "LAST"
then "CURSOR = "maxlno" "lrecl
if parmdir = "ALL"
then "SEEK "seekstr" "parmin" FIRST NX"
else "SEEK "seekstr" "parmin" "parmdir" NX"
frc = rc
do while frc = 0
"(CURRLNO) = LINENUM .ZCSR"
if seekdir = "NEXT"
then endlno = currlno - 1
else beglno = currlno + 1
call exclude_lines
if seekdir = "NEXT"
then beglno = endlno + 2
else endlno = beglno - 2
if parmdir = "ALL" | xtot = 0
then do
"SEEK "seekstr" "parmin" "seekdir" NX"
frc = rc
end
else frc = 4
end
if parmdir = "ALL" | xtot = 0
then do
if seekdir = "NEXT"
then endlno = maxlno
else beglno = minlno
call exclude_lines
end
return
exclude_lines:
xcnt = 0
if beglno <= endlno
then do
if seekdir = "NEXT"
then do
begxx = beglno
endxx = endlno
incrxx = 1
end
else do
begxx = endlno
endxx = beglno
incrxx = -1
end
do xx = begxx to endxx by incrxx
"(XSTAT) = XSTATUS "xx
if xstat = "NX"
then do
"XSTATUS "xx" = X"
xcnt = xcnt + 1
if parmdir <> "ALL"
then do
beglno = xx
endlno = xx
leave xx
end
end
end
if xtot = 0
then do
csrlno = beglno
csrcol = 0
end
xtot = xtot + xcnt
end
return
/***********************************************************/
Have fun!
Bill Bass
Senior Applications Developer
United Health Care
Greenville, SC
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
----------------------------------------------------------------------
<snip>
<snip>
Try this:
call process_lines
parmin = strip(p1)
Have fun!
--------------------------------------------------------
The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. The McGraw-Hill Companies, Inc. reserves the right, subject to applicable local law, to monitor and review the content of any electronic message or information sent to or from McGraw-Hill employee e-mail addresses without informing the sender or recipient of the message.
--------------------------------------------------------
> -----Original Message-----
> From: TSO REXX Discussion List
> [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Cruz, Robert
> Sent: Friday, August 15, 2008 4:25 PM
> To: TSO-...@VM.MARIST.EDU
> Subject: Re: [TSO-REXX] Antwort: Re: [TSO-REXX] Edit Macro Question
>
> Unfortunately, XNOT is not a standard, IBM-supplied TSO EDIT command.
> If you are able to furnish source, I would love to have a copy!
>
<snip>
The source code for XNOT is included in my previous post as well as in
your reply to it.
-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
<snip>
--------------------------------------------------------
The information contained in this message is intended only for the recipient, and may be a confidential attorney-client communication or may otherwise be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, please be aware that any dissemination or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us by replying to the message and deleting it from your computer. The McGraw-Hill Companies, Inc. reserves the right, subject to applicable local law, to monitor and review the content of any electronic message or information sent to or from McGraw-Hill employee e-mail addresses without informing the sender or recipient of the message.
--------------------------------------------------------
----------------------------------------------------------------------
<snip>
<snip>
Try this:
call process_lines
parmin = strip(p1)
Have fun!
Disclaimer: This e-mail message is intended only for the personal use of
the recipient(s) named above. If you are not an intended recipient, you
may not review, copy or distribute this message. If you have received this
communication in error, please notify us immediately by e-mail and delete
the original message.
This e-mail expresses views only of the sender, which are not to be
attributed to Rite Aid Corporation and may not be copied or distributed
without this statement.
Why not use the normal exclude function and then issue the flip
command? Must be a lot easier than all that code.
You may not like it, but you can change all the dollar signs to non-
printable characters; do whatever you wanted to do and when finished
change them back. Cannot of course be used in a non text file.
Adrian
Here is the DLMPOS function. You can save it as another member in the
same library as XNOT or uncomment the "dlmpos: procedure" statement
and add it to the XNOT member.
/* REXX - DLMPOS - function returns delimiter position or zero */
/*********************************************************************/
/* Parses a string to find a specified delimiter character. */
/* Delimiter chars that are between quotes are NOT delimiters. */
/*********************************************************************/
/* Execute like this: split_pos = dlmpos(STRING,DELIMITERS,QUOTES) */
/* or this: split_pos = dlmpos(STRING,DELIMITERS) */
/* or this: split_pos = dlmpos(STRING,,QUOTES) */
/* or this: split_pos = dlmpos(STRING) */
/* */
/* Returns position of first character in DELIMITERS that is in */
/* STRING but is not contained within matching QUOTES. Returns */
/* zero if no character satisfies this criteria. */
/* */
/* The default for DELIMITERS is blank or comma (" ,") */
/* The default for QUOTES is quote or apostrophe ("""'") */
/* */
/* execute like this: split_pos = dlmpos(string_in) */
/* or this: split_pos = dlmpos(string_in," ","'") */
/*********************************************************************/
/*dlmpos: procedure */
parse arg str_in, delimit, quotes
if delimit = ""
then delimit = " ,"
if quotes = ""
then quotes = """'"
dlm_pos = verify(str_in,delimit,"MATCH")
if dlm_pos = 0
then dlm_pos = length(str_in) + 1
qpos = verify(str_in,quotes,"MATCH")
if qpos = 0
then qpos = dlm_pos + 1
qchar = substr(str_in,qpos,1)
startpos = qpos + 1
/* if quote closer than delimit find endquote then next delimit */
/* repeat until delimit is closer than quote */
do while qpos < dlm_pos
q2pos = pos(qchar,str_in,startpos)
/* if no matching close quote, take remaining string */
if q2pos = 0
then do
dlm_pos = length(str_in) + 1
leave
end
wklen = (q2pos - startpos) + 1
/* if two consecutive quotes, find another endquote */
if substr(str_in,q2pos + 1,1) = qchar
then do
startpos = q2pos + 2
iterate
end
/* matching endquote located, find next delimit and quote */
startpos = q2pos + 1
dlm_pos = verify(str_in,delimit,"MATCH",startpos)
if dlm_pos = 0
then dlm_pos = length(str_in) + 1
qpos = verify(str_in,quotes,"MATCH",startpos)
if qpos = 0
then qpos = dlm_pos + 1
if qpos < dlm_pos
then wklen = (qpos - startpos) + 1
else wklen = dlm_pos - startpos
qchar = substr(str_in,qpos,1)
startpos = qpos + 1
end
if dlm_pos > length(str_in)
then dlm_pos = 0
return(dlm_pos)
/*********************************************************************/
Bill Bass
Senior Applications Developer
United Health Care
Greenville, SC