IBMi에 SSH로 접속하고 qsh를 시작하면 실행하여 db2 -S "SELECT * FROM LIB.SOMEPF"
결과를 얻을 수 있습니다. 기본 PASE 화면에서는 할 수 없습니다. 나는 얻다
$ /usr/bin/db2
/usr/bin/db2: cannot execute
QSH를 시작하는 대신 PASE에서 SQL 쿼리를 실행할 수 있습니까?
답변1
내 홈 디렉토리에 db2 쉘 스크립트가 있습니다. 너무 오랫동안 그곳에 있었기 때문에 언제, 어떻게 거기에 이르렀는지 모르겠습니다. 5799-PTL의 일부일 수 있습니다. 도움이 되지 않는다는 것은 알지만 내용은 다음과 같습니다.
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)"
CALL QP2TERM
그런 다음 db2 -S 'select * from datesample'
이 스크립트와 함께 실행되는 것처럼 db2 명령을 실행합니다.