Concatenate parms in SET command



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Concatenate parms in SET command

Postby LasseH » Fri Sep 29, 2017 1:29 pm

Is there a way to concatenate 2 or more parms in a PROC into 1 parm (thru SET perhaps or...)

example:
//S010     EXEC CONVERT,                                  
// IPATH='/MAP/Anothermap To Use/'
// DSFILE='File To Use.txt'
//*
//CONVERT  PROC DSFILE=,IPATH=      
//*                                  
//A SET DSHR='/FirstPartOfPath'      
//B SET OPATH=&IPATH.CONV/      trying to concatenate IPATH with 'CONV'
//*
//S040     EXEC DATASH,            
// INFILE='&&CONVFILE',            
// OUTFILE=&OPATH.&DSFILE          
   


Result:
3 //S010     EXEC CONVERT,                                                      
  // IPATH='/MAP/Anothermap To Use/',                                          
  // DSFILE='File To Use.txt'                                                  
4 ++CONVERT  PROC DSFILE=,IPATH=          OPATH=                                
  ++*                                                                          
5 ++A SET DSHR='/FirstPartOfPath'                                              
6 ++B SET OPATH=&IPATH.CONV/      trying to concatenate IPATH with 'CONV'                                                    
  ++*                                                                                   
IEFC653I SUBSTITUTION JCL - OPATH=/MAP/Anothermap                            
7 ++S010     EXEC PGM=IKJEFT01                                                  
8 ++USSFILE  DD PATH='&DSHR.&IPATH.&DSFILE',                                    
  ++         PATHOPTS=ORDONLY                                                  
  IEFC653I SUBSTITUTION JCL - PATH='/FirstPartOfPath/MAP/Anothermap To Use/File To Use.txt',PATHOPTS=ORDONLY
9 ++MVSFILE  DD DISP=(NEW,CATLG,DELETE),                                        


And then JCL-error
STMT NO. MESSAGE                                                              
       3 IEFC001I PROCEDURE CONVERT WAS EXPANDED USING INSTREAM PROCEDURE DEFI.....
       6 IEFC620I UNIDENTIFIABLE CHARACTER n ON THE SET STATEMENT            
       6 IEFC620I UNIDENTIFIABLE CHARACTER o ON THE SET STATEMENT            
       6 IEFC620I UNIDENTIFIABLE CHARACTER t ON THE SET STATEMENT            
       6 IEFC620I UNIDENTIFIABLE CHARACTER h ON THE SET STATEMENT            
       6 IEFC620I UNIDENTIFIABLE CHARACTER e ON THE SET STATEMENT            
       6 IEFC620I UNIDENTIFIABLE CHARACTER r ON THE SET STATEMENT            
       6 IEFC620I UNIDENTIFIABLE CHARACTER m ON THE SET STATEMENT            
       6 IEFC620I UNIDENTIFIABLE CHARACTER a ON THE SET STATEMENT            
       6 IEFC620I UNIDENTIFIABLE CHARACTER p ON THE SET STATEMENT            


Then put apostrophe (2 on each side) around it
//B SET OPATH=''&IPATH.CONV/''  trying to concatenate IPATH with 'CONV'


Substitution works fine but thera are 2 apost
IEFC653I SUBSTITUTION JCL - OPATH=''/MAP/Anothermap To Use/CONV/'',PATHOPTS=ORDONLY
 


And JCL-error
STMT NO. MESSAGE                                                              
       3 IEFC001I PROCEDURE CONVERT WAS EXPANDED USING INSTREAM PROCEDURE DEFI....
       6 IEFC629I INCORRECT USE OF APOSTROPHE ON THE SET STATEMENT            
       6 IEFC629I INCORRECT USE OF APOSTROPHE ON THE SET STATEMENT            
       6 IEFC621I EXPECTED CONTINUATION NOT RECEIVED                          


//Lasse
LasseH
 
Posts: 50
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Concatenate parms in SET command

 

Re: Concatenate parms in SET command

Postby steve-myers » Fri Sep 29, 2017 10:47 pm

Evidently, you cannot use symbol substitution in a set command.

//         SET P1='HELLO'              
//         SET P2=' STEVE'              
//         SET P3='&P1..&P2'            
//A       EXEC PGM=IEFBR14,PARM='&P1&P2'
//B       EXEC PGM=IEFBR14,PARM='&P3'  

resulted in
//A       EXEC PGM=IEFBR14,PARM='&P1&P2'                  
IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='HELLO STEVE'
//B       EXEC PGM=IEFBR14,PARM='&P3'                    
IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='&P1..&P2'


However

//CONVERT PROC P1='HELLO',P2=' STEVE'  
//A       EXEC PGM=IEFBR14,PARM='&P1&P2'
//        PEND                          
//TEST    EXEC CONVERT

resulted in
2 //CONVERT PROC P1='HELLO',P2=' STEVE'                    
  //A       EXEC PGM=IEFBR14,PARM='&P1&P2'                  
  //        PEND                                            
3 //TEST    EXEC CONVERT                                    
4 ++CONVERT PROC P1='HELLO',P2=' STEVE'                    
5 ++A       EXEC PGM=IEFBR14,PARM='&P1&P2'                  
  IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='HELLO STEVE'


Now as to your concatenation -
//CONVERT PROC P1='HELLO'                  
//A       EXEC PGM=IEFBR14,PARM='&P1.STEVE'
//        PEND                            
//TEST    EXEC CONVERT

resulted in
2 //CONVERT PROC P1='HELLO'                                
  //A       EXEC PGM=IEFBR14,PARM='&P1.STEVE'              
  //        PEND                                          
3 //TEST    EXEC CONVERT                                  
4 ++CONVERT PROC P1='HELLO'                                
5 ++A       EXEC PGM=IEFBR14,PARM='&P1.STEVE'              
  IEFC653I SUBSTITUTION JCL - PGM=IEFBR14,PARM='HELLOSTEVE'


PARM='&P1STEVE' would not work because it would try non existent symbol &P1STEVE

HTH

These users thanked the author steve-myers for the post:
LasseH (Thu Oct 12, 2017 10:50 pm)
steve-myers
Global moderator
 
Posts: 1875
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 193 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post