Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem with single quote enclosed within single quotes

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Problem with single quote enclosed within single quotes
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

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Wed Aug 17, 2011 10:02 pm    Post subject:
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    Post subject:
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

Senior Member


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

PostPosted: Thu Aug 18, 2011 5:19 pm    Post subject: Reply to: Problem with single quote enclosed within single q
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    Post subject: Reply to: Problem with single quote enclosed within single q
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    Post subject: Reply to: Problem with single quote enclosed within single q
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    Post subject:
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    Post subject: Re: Reply to: Problem with single quote enclosed within sing
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    Post subject: Reply to: Problem with single quote enclosed within single q
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    Post subject: Reply to: Problem with single quote enclosed within single q
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us