Thanks heaps.  

Firstly, the inline 'no op' which is handy but needs care.

STDPARM:
SH (                                                   
 set -o verbose      ;                                 
 set -o errexit      ;                                 
 set -x              ;                                 
 for jarname in `ls &BCDHOME.batch/*.jar 2>/dev/null` ;
 do                                                    
 : 'any old comment' ;                                 
   if  [ -z "$(echo $jarname | grep Doc\.jar)" ] ;     
   then                                                
       echo adding to ClassPath ;                      
       CLASSPATH="$CLASSPATH":"$jarname" ;             
   fi                                                  
 done ;                                                
 echo CLASSPATH is $CLASSPATH ;                        
 )                                                     
 > &E.bcd-write.out 2>&E.bcd-write.err                 

STDERR is empty for this one.  Works as expected.  This next one fails, 
probably reasonably as it's in the middle of a 'for'.

STDPARM:
SH (                                                   
 set -o verbose      ;                                 
 set -o errexit      ;                                 
 set -x              ;                                 
 for jarname in `ls &BCDHOME.batch/*.jar 2>/dev/null` ;
 : 'any old comment' ;                                 
 do                                                    
   if  [ -z "$(echo $jarname | grep Doc\.jar)" ] ;     
   then                                                
       echo adding to ClassPath ;                      
       CLASSPATH="$CLASSPATH":"$jarname" ;             
   fi                                                  
 done ;                                                
 echo CLASSPATH is $CLASSPATH ;                        
 )                                                     
 > &E.bcd-write.out 2>&E.bcd-write.err                 

STDERR

FSUM7332 syntax error: got Word, expecting do


The JCL concatenation worked, and I'm going to use it as it's foolproof.  As 
long as the comment and the resumption of SYSIN are moved together, they can go 
pretty much anywhere.  If you need the symbols, remember to keep the SYMBOLS 
keyword on the resumed SYSIN.

//    EXPORT SYMLIST=*                                           
//      SET BCDHOME='/usr/lpp/bcp/'        home directory for BCP
//      SET E='/u/bhpprq/'                 error messages here   
//*                                                              
//*  multiline shell script with complex control structures      
//*                                                              
//*                                                              
//BPXBATCH EXEC PGM=BPXBATCH                                     
//OUT      DD SYSOUT=*                                           
//STDERR   DD SYSOUT=*                                           
//STDOUT   DD SYSOUT=*                                           
//STDPARM  DD *,SYMBOLS=(EXECSYS,OUT)                            
SH (                                                             
 set -o verbose      ;                                           
 set -o errexit      ;                                           
 set -x              ;                                           
 for jarname in `ls &BCDHOME.batch/*.jar 2>/dev/null` ;          
 do                                                              
//* any old comment                                              
//         DD *,SYMBOLS=(EXECSYS,OUT)                            
   if  [ -z "$(echo $jarname | grep Doc\.jar)" ] ;               
   then                                                          
       echo adding to ClassPath ;                                
       CLASSPATH="$CLASSPATH":"$jarname" ;                       
   fi                                                            
 done ;                                                          
 echo CLASSPATH is $CLASSPATH ;                                  
 )                                                               
 > &E.bcd-write.out 2>&E.bcd-write.err                           
//                                                               

cheers,
Peter


On Tue, 1 Oct 2019 21:42:24 -0500, Paul Gilmartin <[email protected]> wrote:

>On Tue, 1 Oct 2019 20:31:39 -0500, Peter Bishop wrote:
>>
>>in case anyone wants it, after much trial and error I finally found this 
>>working example of a multi-line STDPARM shell script for BPXBATCH.  I still 
>>haven't found a way to have #comment lines, which seem to generate syntax 
>>errors, but if I accept that limitation, I am happy enough ...
>>
>Depends on what you need:
>
>#! /bin/sh -x
>
>uname -a; 
>: '
>This is a no-op
>    masquerading
>        as a comment';
>date;   
>exit;
>
>Or, use JCL concatenation:
>//STDPARM  DD  *
>uname -a;  
>//* This
>//*     an embeddfed
>//*         JCL comment.
>//         DD  *
>date;      
>exit;
>
>-- gil
>
>----------------------------------------------------------------------
>For IBM-MAIN subscribe / signoff / archive access instructions,
>send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to