MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing data with apostrophe

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Jamylady
Beginner


Joined: 04 Nov 2004
Posts: 68
Topics: 22

PostPosted: Fri Aug 11, 2006 1:11 pm    Post subject: Passing data with apostrophe Reply with quote

Hi,
Just wondering if anyone could help me out with this...
I have an SQL executing as part of the PROC and SQL accepts parameters from the JCL. These parameters are actually state codes
Ex:
Code:

//STPROC EXEC XSTCDP,
//              STCD1='CA',STCD2='FL',STCD3='IA',STCD4='GA'
//              STCD5='OR' ,STCD6='OK'

and in the proc, I have the following SQL as SYSIN data
SYSIN DD *
SELECT * FROM XAMSTS
WHERE
STATE_CD IN
('&STCD1', '&STCD2','&STCD3','&ST4','&STCD5')

Now, I need to update the above JCL, so that I can pass pass more state codes in a single parameter.

Basically I should be able to pass the following value using a single parameter (STCD1) to the SQL.

''CA','FL','IA','GA','OR','OK''

But I am not getting a clue how to include the apostrophes while passing value as a parameter. Could any one help?
Thanks
JA
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Aug 11, 2006 2:43 pm    Post subject: Reply with quote

Jamylady,

Try this

Code:

//         SET Q='''',C=',',D='"'                           
//RUN      EXEC XSTCDP,STCD1=&D&Q.CA&Q&C&Q.FL&Q&C&Q.IA&Q&C   
//             &Q.GA&Q&C&Q.OR&Q&C&Q.OK&Q&D                   


this will be substituted as

Code:

//RUN      EXEC XSTCDP,STCD1="'CA','FL','IA',       
//             'GA','OR','OK'"                       


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jamylady
Beginner


Joined: 04 Nov 2004
Posts: 68
Topics: 22

PostPosted: Mon Aug 14, 2006 12:28 pm    Post subject: Reply with quote

kolusu,
Sorry, I wont be able to use that solution, because Operator may not like that complicated coding. I found another work around as follows.
STCD1='PA AL AR AK GA AZ AB AC' as a single string and in the actual sql,
I used substring function as follows
STATE_CD = SUBSTR(''&STCD1'',1,2)
STATE_CD = SUBSTR(''&STCD1'',4,2)
STATE_CD = SUBSTR(''&STCD1'',7,2)
STATE_CD = SUBSTR(''&STCD1'',10,2)
Etc..
Looks like the maximum I can pass is 8 state codes as it exceeds the maximum length.

Thanks many for the suggestion.
JA


IEFC012I JCL STATEMENT MAXIMUM LENGTH EXCEEDED
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Aug 14, 2006 12:58 pm    Post subject: Reply with quote

Jamylady,

Ideally I would pass the parms as 3 different parms

Code:

//SYSIN    DD DSN=80 BYTE PARM1,DISP=SHR
//            DSN=80 BYTE PARM2,DISP=SHR
//            DSN=80 BYTE PARM3,DISP=SHR


PARM 1 will have the following
Code:

  SELECT *                     
    FROM TABLE             
   WHERE COLUMN IN ('start CONSTANT',     


PARM2 will have the actual list of parms you want to pass
Code:

'CA',     
'IL',     
'FL',     
'MN',     
'AZ',     
'NY',     
...


Parm3 will have the closing parenthisis
Code:

'end constant');



when concatenated the 3 parms will be 1 sql and will be treated

Code:

  SELECT *                     
    FROM TABLE             
  WHERE COLUMN IN ('start CONSTANT',
                   'CA',     
                   'IL',     
                   'FL',     
                   'MN',     
                   'AZ',     
                   'NY',     
                   'end constant');


Start constant and end constant can be a value which does not exist in the table. For sql you can pass a total of 32760 bytes in total . So you each line in the sysin is 80 bytes, so you can have a total of 400 lines.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group