Connect db2 using db2 connect

I want to connect to DB2 database which is mainframes using a unix script and run query and get the result set into the unix box.
Is this acheivable using db2 connect? pls help me with a sample script which can perform the same.

db2 connect to <DATABASE_NAME> user <USER_NAME> using <PASSWD>

use above mentioned command to connect to database (DB2)....
and below mentioned command to execute the SQLs....

db2 -tvf sql_file > out_file