IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

'&' Character missing in ISREDIT LINE_AFTER


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu May 26, 2011 12:08 am
Reply with quote

I am trying to write a macro for expanding copybooks in COBOL. My cobol copybook contains the comment line -

Code:
*  NNN011 0401 ADDED M&E BAND AND MODEL CODE FOR FUND FILE      *


I am reading the copybook in a stem variable and when I print the stem variable its displaying the &. But when it is inserted by ISREDIT LINE_AFTER in my source code the '&E' are missing. I suspect it is taking it as an AND. I am writing it as a DATALINE. Any suggestions would be of great help.

And output is
Code:
*  NNN011 0401 ADDED M BAND AND MODEL CODE FOR FUND FILE      * 16


Here is the REXX MACRO part doing the same
Code:

CALL ALLOCATE_AND_READCPY_RTN
IF (RC =  0 & ERROR_PRESENT = 0) THEN DO
  DO  I = COPYDATA.0 TO 1 BY -1
   'ISREDIT LINE_AFTER .ZCSR = DATALINE "'COPYDATA.I'"'
  END
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu May 26, 2011 12:19 am
Reply with quote

works for me

Code:
000025 coun   = 2
000026 line.1 = "some normal line"
000027 line.2 = "some not normal &  line"
000028 do i = 1 to coun
000029    work = line.i
000030    Address ISREDIT "LINE_AFTER .ZLAST = DATALINE (WORK)"
000031 End
000032



Code:
000025 coun   = 2
000026 line.1 = "some normal line"
000027 line.2 = "some not normal &  line"
000028 do i = 1 to coun
000029    Address ISREDIT "LINE_AFTER .ZLAST = DATALINE  '"line.i"' "
000030 End


both cases !
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu May 26, 2011 12:40 am
Reply with quote

Can u try the specific "M&E" case because the '&' with spaces around was working for me also. Extremely sorry I should have given that information too.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu May 26, 2011 12:49 am
Reply with quote

use the format I showed int the first snippet
Code:
Address ISREDIT "LINE_AFTER .ZLAST = DATALINE (WORK)"


in my code I never used anything else icon_biggrin.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 26, 2011 1:03 am
Reply with quote

& and other characters are hard to play with

i found that i needed to replace them with other characters (with translate),
do the line_after
and then do a edit macro change against the line inserted.

or simply do a change all with label range after the insertion is done.

apostrophies will also eat your lunch.

not at work now, but i used to have a list of char that could be found in cobol copybooks/source code that needed to be changed before the line_after/line_before, then a global change all when finished.

you can create your own list by creating a dummy copybook containing all char and see which give you a problem.
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu May 26, 2011 1:05 am
Reply with quote

Thanks a lot it worked with the first option you suggested. Though I am unable to understand the reason behind the same.
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu May 26, 2011 1:09 am
Reply with quote

Hi Dick,

You mean I should translate & and all other special characters that appear in my copybook before writing. And then after they are written replace them with the original ones. In this case what would I translate them into since I do not have choice of letters and numbers which would be appearing in the copybook along with these?
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu May 26, 2011 1:14 am
Reply with quote

OK got the answer I think you edited your post later. Still its a major problem I would say. Was just curious to know why REXX language producers never corrected it?
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Thu May 26, 2011 1:19 am
Reply with quote

niks_jude wrote:
OK got the answer I think you edited your post later. Still its a major problem I would say. Was just curious to know why REXX language producers never corrected it?

It's not a REXX issue, it's an ISPF issue.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 26, 2011 1:20 am
Reply with quote

i often used a pound sign: #
the at-sign: @
§ also works.

you can create a macro: called 'chgthis'

/*REXX*/
isredit macro
chg all '@' '&' /* at-sign back to ampersand */
chg all "#" "'" /* pound sign back to apostrophe/quote */
chg all '§' '"' /* § back to double quotes
exit

which you can invoke from your rexx script after you have inserted the lines.

how you go about changing the values in the stem variables is up to you.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 26, 2011 1:27 am
Reply with quote

there are probably escape char that you can use,
but never found them,
did not look for them,
used my own method of substitution.

if you have more than 2 or three chars that give you trouble,
you may have to do each variable before the INSERT and then a change all on the line just inserted.

depends on how much garbage is in your copybooks.

that's the fun with writing these neat little tools, they need to be universal. (originally spelled it univeral - almost left if that way)

at my present site, we use endevor, and have 2 legs,
which means i can have copybooks comming from 7 potential libraries
need to have arguements
such as cobol type - batch, cics,
copybook library - unit, systems, acceptance, from 2 different legs and then prod.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu May 26, 2011 1:39 am
Reply with quote

Quote:
Was just curious to know why REXX language producers never corrected it?

and

It's not a REXX issue, it's an ISPF issue.


It is an ISPF feature! Use the SCAN OFF service to turn off the variable substitution.
Code:
ISREDIT "SCAN OFF"

Though, it is not as 'OFF' as I would have thought.

From the manual:
Quote:
Because the ISPEXEC call interface for REXX EXECs allows you to specify parameters as symbolic variables, a single scan always takes place before the syntax check of a statement. Therefore, the rule of using two ampersands (&) before variable names to avoid substitution of variable names also applies to REXX EXECs.
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu May 26, 2011 1:50 am
Reply with quote

Hi Pedro,

Now I feel I can see the reason - When we pass variable in ISREDIT with brackets around it, its not scanned. Thanks.


Dick,
I think I will continue with what Enrico and Pedro have suggested, if still I encounter any problem I will have to go your way. Thanks a lot anyways.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 26, 2011 10:54 am
Reply with quote

i use instead of line_before/line_after the ISREDIT COPY macro command nowadays inorder to skip the problem.
Back to top
View user's profile Send private message
niks_jude
Warnings : 1

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Thu May 26, 2011 11:16 am
Reply with quote

Thanks can try even that and it is more specific to my need.
Back to top
View user's profile Send private message
ravikanth

New User


Joined: 12 Jan 2006
Posts: 29

PostPosted: Mon Feb 27, 2012 11:29 pm
Reply with quote

Never tried the "SCAN OFF" but does it only work with double ambersand or even single ambersand? Thank you!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Panvalet - 9 Character name - Issue c... CA Products 6
No new posts String has hex character need to conv... COBOL Programming 3
No new posts Output LREC based on specific character DFSORT/ICETOOL 22
No new posts Find missing sequence for every key DFSORT/ICETOOL 3
No new posts Replacing character string in file th... JCL & VSAM 9
Search our Forums:

Back to Top