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

Problem with single quote enclosed within single quotes


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Wed Aug 17, 2011 9:51 pm
Reply with quote

Code:

/*--------------------------- REXX ----------------------------------*/
/*  REXX MACRO : JOB                                                 */
/*  Author : XXX                                                     */
/*  Adds the JOB statement into the JCL member being viewed or       */
/*  edited.                                                          */
/*  Syntax = JOB                                                     */
/*-------------------------------------------------------------------*/
ADDRESS ISREDIT             
"MACRO (JOBPARM)"           
JOBPARM = STRIP(JOBPARM)   
LN = 0                                                                                 
UID = USERID()       
PID = SUBSTR(UID,2,5) || AB                                                           
MSG = "'//"UID"A  JOB (R004,FIB),"PID",CLASS=Z,MSGCLASS=X,'"     
"ISREDIT LINE_AFTER " LN "= DATALINE" MSG                         
LN = LN + 1                                                       
MSG = "'//         REGION=2048K,MSGLEVEL=(1,1),NOTIFY="UID"'"     
"ISREDIT LINE_AFTER " LN "= DATALINE" MSG                         
LN = LN + 1                                                       
IF JOBPARM = 'Y' THEN DO                                           
   MSG = "'/*JOBPARM ROOM=OVER,S=019E'"                             
  "ISREDIT LINE_AFTER " LN "= DATALINE" MSG                         
   LN = LN + 1                                                       
   JOBPARM = ' '                                                     
END                                                           
EXIT                     


Result:
If 'JOB' is typed in command line in the jcl being edited, I get a jobcard as below
//X11421A JOB (R004,FIB),11421AB,CLASS=Z,MSGCLASS=X,
// REGION=2048K,MSGLEVEL=(1,1),NOTIFY=X11421

If 'JOB Y' is typed in command line in the jcl being edited, I get a jobcard as below
//X11421A JOB (R004,FIB),11421AB,CLASS=Z,MSGCLASS=X,
// REGION=2048K,MSGLEVEL=(1,1),NOTIFY=X11421
/*JOBPARM ROOM=OVER,S=019E

I require a Jobcard as below
//X11421A JOB (R004,FIB),'11421AB',CLASS=Z,MSGCLASS=X,
// REGION=2048K,MSGLEVEL=(1,1),NOTIFY=X11421
/*JOBPARM ROOM=OVER,S=019E

Single quotes around Programmer id (11421AB) is required. If I modify the code as follows

MSG = "'//"UID"A JOB (R004,FIB),'"PID"',CLASS=Z,MSGCLASS=X,'"

I get an error,
----------------
Command in error . : ISREDIT LINE_AFTER 0 = DATALINE '//X11421A JOB (R00

Incomplete string
Put an ending quote at the end of the string.

Error message ID . : ISRE060

Last return code . : 20

Macro executing . : JOB

Press ENTER key to terminate the macro.
---------------
same with double single quotes,
MSG = "'//"UID"A JOB (R004,FIB),''"PID"'',CLASS=Z,MSGCLASS=X,'"

******
Please help me resolve this issue.
Back to top
View user's profile Send private message
prino

Senior Member


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

PostPosted: Wed Aug 17, 2011 10:02 pm
Reply with quote

Code:
"ISREDIT LINE_AFTER" LN " = DATALINE (MSG)"
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Aug 17, 2011 10:47 pm
Reply with quote

to get around these kind of problems,
i always maintain a skeleton PDS,
each member has a function.

one is a jobcard
one is parms to load for this or that.

i just do a straight copy of the skel into the current dataset,
(before .zf)
and since I know what the member (that I just copied)
looks like, i make the necessary chgs.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Aug 18, 2011 5:19 pm
Reply with quote

The problem is that:
1. quotes are rexx delimiters
2. quotes are macro statement delimiters
3. you want quotes in your result

In such cases, I use a different character instead of the quote character, such as '~', which is not likely to be used in the file. Then in a final step, change all "~" to "'".
Back to top
View user's profile Send private message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Thu Aug 18, 2011 10:04 pm
Reply with quote

Hi Prino, If I modify my code as mentioned by you, Rexx takes MSG as the line to be inserted and inserts MSG as shown below

Code:

MSG                                                                     
MSG                                                                     
//**********************************************************************
//JOBLIB   DD DSN=PRODPLS.SARE.LOAD,DISP=SHR                           
//         DD DSN=PRODPLS.SARC.LOAD,DISP=SHR                           
Back to top
View user's profile Send private message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Thu Aug 18, 2011 10:11 pm
Reply with quote

Thanks dbzTHEdinosauer for your reply but I was feeling lazy to create skels for this simple requirement. I will try as you mentioned when I get time.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Aug 18, 2011 10:13 pm
Reply with quote

prino,
now you have to explain to him what you meant by 'msg'
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Aug 18, 2011 10:15 pm
Reply with quote

maheshk84 wrote:
Thanks dbzTHEdinosauer for your reply but I was feeling lazy to create skels for this simple requirement. I will try as you mentioned when I get time.


i missused the term skeleton. I did not mean ispf skeletons,
just a member (or dataset) containing what I wanted the jcl to look like,
simple copy and change the required.
Back to top
View user's profile Send private message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Thu Aug 18, 2011 10:19 pm
Reply with quote

Hi Pedro, Your solution worked. The complete code is provided below.

Code:

/*--------------------------- REXX ----------------------------------*/
/*  REXX MACRO : JOB                                                 */
/*  AUTHOR : XXX                                                     */
/*  ADDS THE JOB STATEMENT INTO THE JCL MEMBER BEING VIEWED OR       */
/*  EDITED.                                                          */
/*  SYNTAX = JOB                                                     */
/*-------------------------------------------------------------------*/
ADDRESS ISREDIT                                                       
"MACRO (JOBPARM)"                                                     
JOBPARM = STRIP(JOBPARM)       
UPPER JOBPARM                                       
LN = 0                                                                 
UID = USERID()                                                         
PID = SUBSTR(UID,2,5) || AB                                           
MSG = "'//"UID"A  JOB (R004,FIB),~"PID"~,CLASS=Z,MSGCLASS=X,'"         
"ISREDIT LINE_AFTER " LN "= DATALINE" MSG                             
LN = LN + 1                                                           
MSG = "'//         REGION=2048K,MSGLEVEL=(1,1),NOTIFY="UID"'"         
"ISREDIT LINE_AFTER " LN "= DATALINE" MSG                             
LN = LN + 1                                     
IF JOBPARM = 'Y' THEN DO                         
   MSG = "'/*JOBPARM ROOM=OVER,S=019E'"         
  "ISREDIT LINE_AFTER " LN "= DATALINE" MSG     
   LN = LN + 1                                   
   JOBPARM = ' '                                 
END                                             
"ISREDIT C ALL '~' '''"                         
"RESET"
EXIT                                             


When I enter 'JOB' in my command line, the result is
Code:

//X11421A  JOB (R004,FIB),'11421AB',CLASS=Z,MSGCLASS=X,     
//         REGION=2048K,MSGLEVEL=(1,1),NOTIFY=X11421         


When I enter 'JOB Y' in my command line, the result is
Code:

//X11421A  JOB (R004,FIB),'11421AB',CLASS=Z,MSGCLASS=X,         
//         REGION=2048K,MSGLEVEL=(1,1),NOTIFY=X11421             
/*JOBPARM ROOM=OVER,S=019E                                       
Back to top
View user's profile Send private message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Thu Aug 18, 2011 10:25 pm
Reply with quote

Iam extremely sorry Prino. Your solution also worked fine. I missed to put braces around MSG.

Thanks all for your reply.

Code:

/*--------------------------- REXX ----------------------------------*/
/*  REXX MACRO : JOB                                                 */
/*  AUTHOR : XXX                                                     */
/*  ADDS THE JOB STATEMENT INTO THE JCL MEMBER BEING VIEWED OR       */
/*  EDITED.                                                          */
/*  SYNTAX = JOB                                                     */
/*-------------------------------------------------------------------*/
ADDRESS ISREDIT                                                         
"MACRO (JOBPARM)"                                                       
JOBPARM = STRIP(JOBPARM)                                               
UPPER JOBPARM                                                           
LN = 0                                                                 
UID = USERID()                                                         
PID = SUBSTR(UID,2,5) || AB                                             
MSG = "//"UID"A  JOB (R004,FIB),'"PID"',CLASS=Z,MSGCLASS=X,"           
"ISREDIT LINE_AFTER " LN "= DATALINE (MSG)"                             
LN = LN + 1                                                             
MSG = "//         REGION=2048K,MSGLEVEL=(1,1),NOTIFY="UID""             
"ISREDIT LINE_AFTER " LN "= DATALINE (MSG)"                           
LN = LN + 1                                                           
IF JOBPARM = 'Y' THEN DO                                               
   MSG = "'/*JOBPARM ROOM=OVER,S=019E'"                               
  "ISREDIT LINE_AFTER " LN "= DATALINE (MSG)"                         
   LN = LN + 1                                                         
   JOBPARM = ' '                                                       
END                                                                   
EXIT                                                                   
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Help in extracting data between doubl... DFSORT/ICETOOL 5
No new posts Submit multiple jobs from a library t... JCL & VSAM 14
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
Search our Forums:

Back to Top