1

If I ssh into my IBMi, and start qsh, I can run db2 -S "SELECT * FROM LIB.SOMEPF" and get the results. I cannot do it from the default PASE screen. I get

$ /usr/bin/db2
/usr/bin/db2: cannot execute

Is it possible to run sql queries from PASE instead of starting QSH?

1 Answer 1

2

I have a db2 shell script in my home directory. It's been there so long I don't know when or how it got there. It may be part of 5799-PTL. Not helpful, I know, but here are the contents:

 ls -al db2                                                     
 -rwxr-xr-x    1 buck     0               646 Jul 02 2013  db2  
 $                                                              
 cat db2 

 #!/QOpenSys/usr/bin/ksh                                        
 # map base name "qsh_inout" to "qsh" (just run the interpreter)
 basename=${0##*/}                                              
 if [[ "$basename" = qsh_inout ]] ; then                        
        basename=qsh
fi                                                                                   
args=''                                                                              
for temp ; do                                                                        
        args="$args'"                                                                
        # double embedded quotes halved by CL CALL                                   
        while [[ "$temp" = *\'* ]] ; do                                              
                args="$args${temp%%\'*}''"                                           
                temp="${temp#*\'}"                                                   
        done                                                                         
        args="$args$temp' "                                                          
        shift                                                                        
done                                                                                 
# Copy environment variables, call utility in this process,                          
# do not process OS/400 messages or spooled output files                             
exec /QOpenSys/usr/bin/system -eiqs "CALL QSYS/QP0ZCALL ('/usr/bin/$basename' $args)"

When I CALL QP2TERM and then issue db2 commands like db2 -S 'select * from datesample' it runs with this script.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .