Hi Scot;
Here is some actual code that I wrote in PB 12.1 here at work that does the same basic DC + UB processing as you are trying to do ...
THIS.of_ds_register ( "Repository", "dw_repository", io_tr_repos )
ii_rc = THIS.of_get_ds_cache ( "Repository", lo_ds_repos )
il_rc = lo_ds_repos.Insertrow (0)
ii_rc = lo_ds_repos.SetItem (il_rc, "image_id", ldec_image_id )
ldec_folder_id = lo_ds_worker.GetItemNumber (1, "folder_id")
ii_rc = lo_ds_repos.SetItem (il_rc, "app_form_folder_id", ldec_folder_id )
ls_ersf_id = lo_ds_worker.GetItemString (1, "esrf_id")
ii_rc = lo_ds_repos.SetItem (il_rc, "esrf_id", ls_ersf_id )
ii_rc = lo_ds_repos.SetItem (il_rc, "image_page_nbr", 0 )
ii_rc = lo_ds_repos.Update ( )
IF ii_rc <> 1 THEN
THIS.of_write_log ( "Repository INSERT failed for Image ID: " + as_image_id + &
", Session ID: " + as_session_id )
ii_rc = io_tr_repos.of_rollback ( )
ii_rc = fn_check_db_status ( THIS, io_tr_repos )
ii_rc = -1
else
ii_rc = io_tr_repos.of_commit ( )
ii_rc = fn_check_db_status ( THIS, io_tr_repos )
// ** Lets copy the original image to the DB Repository **
lblb_data = BLOB (" ") // Clear Work Area!
IF Upper (as_table_type) = "A" THEN
SELECTBLOB Image_Blob
INTO:lblb_data
FROM APP_FORM_IMAGE
WHERE image_id = :ldec_image_id
USING io_tr_archive;
else
SELECTBLOB Image_Blob
INTO :lblb_data
FROM SUPPORTING_DOC_IMAGE
WHERE image_id = :ldec_image_id
USING io_tr_archive ;
END IF
ii_rc = fn_check_db_status ( THIS, io_tr_archive )
......
li_file_no = FileOpen (ls_file_name2, StreamMode!, Read!, Shared!, Append!)
IF li_file_no > 0 THEN
lblb_data = Blob (" ")
il_rc = FileReadEX ( li_file_no, lblb_data )
IF il_rc > 0 THEN
IF THIS.of_is_debug_mode ( ) = TRUE THEN
THIS.of_write_log ( "Image ID '" + ls_file_name2 +"' Number of bytes Read: " + String (il_rc))
END IF
ii_rc = +1
else
THIS.of_write_log ( "File READ Failed for file '" + ls_file_name2 +"' - RC: " + String ( il_rc ))
ii_rc = -1
END IF
FileClose (li_file_no)
END IF
.....
IF ii_rc = 1 THEN
IF as_table_type = "A" THEN
UPDATEBLOB APP_FORM_IMAGE
SET Image_Blob = :lblb_data
WHERE image_id = :ldec_image_id USING io_tr_archive ;
else
UPDATEBLOB SUPPORTING_DOC_IMAGE
SET Image_Blob = :lblb_data
WHERE image_id = :ldec_image_id USING io_tr_archive ;
END IF
HTH
Regards ... Chris
Note: Items in BOLD are important.
PS: image size on average is about 50-100K for the TIFF's but can go much higher.
PPS: that takes about 13ms to process