The easiest way to do what you want is going to be to write a programming script to do this, and utilize that line of SQL to get the data you want.
The basic structure of the program is going to be something like this- you will just need to choose the language and place the language appropriate commands in
Define connection to database (conn)
Define database command (cmd) "SELECT LINK_ID, ID_SCAN FROM BOB.USER_ID"
Set (cmd) to use (conn)
Open (conn)
Execute (cmd) to read the record-set (rs)
Begin For-Next loop to go through rows of (rs)
Declare a string variable (LinkID) and define from (rs)["LINK_ID"]
Declare a byte array variable (IdScan) and define from (rs)["ID_SCAN"]
Create a new file
define file name based on (LinkID)
define file content from (IdScan)
Save the file to your file system
Next Record
Close (rs)
Close (conn)
Cleanup