Has anyone successfully been able to transfer binary files from server to client through SBClient (UniData)?
It appeared to be possible to do a PD.LO using B and/or X options, and I tried also via UniBasic with OSREAD, but it does not work. I opened a recent Rocket support case on this and the official answer was, despite some initial success from Rocket's side, ultimately it isn't supported (SBXA-18778). Despite that news, I'm interested if anyone here has managed to get it working with (any version of) SBClient with some combination of luck and skill?
I have heard rumors it is possible if the file is uploaded through the client to the server in the first place, but that is not the case here. The use case is, small Excel files are generated for reporting on the server. The users would like to download these to their desktops. I could arrange alternate delivery, but they prefer saving on their PC. They are used to downloading .CSV files, which are text and transfer through SBClient without a problem. But once I gave them the Excel files, they love them and never want to see a .CSV again. Unfortunately because native Excel files are binary, the transfer fails.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
Page 1 / 1
Has anyone successfully been able to transfer binary files from server to client through SBClient (UniData)?
It appeared to be possible to do a PD.LO using B and/or X options, and I tried also via UniBasic with OSREAD, but it does not work. I opened a recent Rocket support case on this and the official answer was, despite some initial success from Rocket's side, ultimately it isn't supported (SBXA-18778). Despite that news, I'm interested if anyone here has managed to get it working with (any version of) SBClient with some combination of luck and skill?
I have heard rumors it is possible if the file is uploaded through the client to the server in the first place, but that is not the case here. The use case is, small Excel files are generated for reporting on the server. The users would like to download these to their desktops. I could arrange alternate delivery, but they prefer saving on their PC. They are used to downloading .CSV files, which are text and transfer through SBClient without a problem. But once I gave them the Excel files, they love them and never want to see a .CSV again. Unfortunately because native Excel files are binary, the transfer fails.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
It appeared to be possible to do a PD.LO using B and/or X options, and I tried also via UniBasic with OSREAD, but it does not work. I opened a recent Rocket support case on this and the official answer was, despite some initial success from Rocket's side, ultimately it isn't supported (SBXA-18778). Despite that news, I'm interested if anyone here has managed to get it working with (any version of) SBClient with some combination of luck and skill?
I have heard rumors it is possible if the file is uploaded through the client to the server in the first place, but that is not the case here. The use case is, small Excel files are generated for reporting on the server. The users would like to download these to their desktops. I could arrange alternate delivery, but they prefer saving on their PC. They are used to downloading .CSV files, which are text and transfer through SBClient without a problem. But once I gave them the Excel files, they love them and never want to see a .CSV again. Unfortunately because native Excel files are binary, the transfer fails.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
------------------------------
Doug Miller
Strategy 7
------------------------------
Take a look at installing Samba on your server. It will allow you to mount a unix directory path as a network windows share and will probably be a cleaner solution. https://www.samba.org/
------------------------------
Doug Miller
Strategy 7
------------------------------
------------------------------
Doug Miller
Strategy 7
------------------------------
I was hoping someone had figured out a way direct to the client PC from SBClient, because that's what they would prefer in this case.
Long shot, but you never know until you ask.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
Take a look at installing Samba on your server. It will allow you to mount a unix directory path as a network windows share and will probably be a cleaner solution. https://www.samba.org/
------------------------------
Doug Miller
Strategy 7
------------------------------
------------------------------
Doug Miller
Strategy 7
------------------------------
with Universe we do it like this :
B.DOWNLOAD.BIN
SUBROUTINE B.DOWNLOAD.BIN(LOCALPATH,CLIENTPATH,RES)
******************************************************************
* Description of subroutine
* DOWNLOAD A BIN FILE TO CLIENT VIA TU.DOWNLOAD
* localpath ; LOCAL PATH OF BIN FILE
* clientpath ; DESTINATION ON CLIENT SIDE
* RES RESULT
******************************************************************
*
RES = 0; BIN = ''; ERR = ''
OPENSEQ LOCALPATH TO FV ELSE RES=STATUS() ; RETURN
LOOP WHILE READBLK BUF FROM FV,512 DO BIN := BUF; BUF = '' REPEAT
CALL TU.DOWNLOAD(BIN,CLIENTPATH,'BOZ','',ERR)
RES = ERR
RETURN
with udt you must use OSBREAD instead READBLK
I hope this help
------------------------------
Manu Fernandes
------------------------------
Thanks for the suggestion, Doug. That method of transfer (windows share / samba, email, ftp, couple cloud storage providers) is already in place at both Windows and *nix sites.
I was hoping someone had figured out a way direct to the client PC from SBClient, because that's what they would prefer in this case.
Long shot, but you never know until you ask.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
I was hoping someone had figured out a way direct to the client PC from SBClient, because that's what they would prefer in this case.
Long shot, but you never know until you ask.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
TU.DOWNLOAD will do the trick for binary files. With the 'B' option.
--- Excerpt ---
When transferring binary data (for example, bitmaps, help files, and executables) on some host platforms, the data may become corrupt when you read it from the database. In operating environments that support directory type files, such as UniData and UniVerse, you use the B option only to transfer the data and store it in directory type files. If you want to store data in hash files or your system does not support directory type files, you must hex-encode the data.
Kind Regards,
Aaron
hello,
with Universe we do it like this :
with Universe we do it like this :
B.DOWNLOAD.BIN
SUBROUTINE B.DOWNLOAD.BIN(LOCALPATH,CLIENTPATH,RES)
******************************************************************
* Description of subroutine
* DOWNLOAD A BIN FILE TO CLIENT VIA TU.DOWNLOAD
* localpath ; LOCAL PATH OF BIN FILE
* clientpath ; DESTINATION ON CLIENT SIDE
* RES RESULT
******************************************************************
*
RES = 0; BIN = ''; ERR = ''
OPENSEQ LOCALPATH TO FV ELSE RES=STATUS() ; RETURN
LOOP WHILE READBLK BUF FROM FV,512 DO BIN := BUF; BUF = '' REPEAT
CALL TU.DOWNLOAD(BIN,CLIENTPATH,'BOZ','',ERR)
RES = ERR
RETURN
with udt you must use OSBREAD instead READBLK
I hope this help
------------------------------
Manu Fernandes
------------------------------
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
Straight from the Client Programmers Guide.
TU.DOWNLOAD will do the trick for binary files. With the 'B' option.
--- Excerpt ---
When transferring binary data (for example, bitmaps, help files, and executables) on some host platforms, the data may become corrupt when you read it from the database. In operating environments that support directory type files, such as UniData and UniVerse, you use the B option only to transfer the data and store it in directory type files. If you want to store data in hash files or your system does not support directory type files, you must hex-encode the data.
Kind Regards,
Aaron
TU.DOWNLOAD will do the trick for binary files. With the 'B' option.
--- Excerpt ---
When transferring binary data (for example, bitmaps, help files, and executables) on some host platforms, the data may become corrupt when you read it from the database. In operating environments that support directory type files, such as UniData and UniVerse, you use the B option only to transfer the data and store it in directory type files. If you want to store data in hash files or your system does not support directory type files, you must hex-encode the data.
Kind Regards,
Aaron
The documentation is incorrect. SBXA-18778 is actually a documentation request, as Rocket assured me that it may be a significant engineering request to have the software perform per the current documentation.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
Thanks Manu. Funny thing, when I was researching this, I found a very old post of yours -- maybe on the u2 users' group? -- detailing the same method and I had already given that a try. Thanks for always being so helpful. For Unidata it transfers the file, but the resulting file on the client PC is corrupt.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
------------------------------
IMHO, I suppose you have a problem to load your binaries in memory before the TU.DOWNLOAD.
If I do this :
A = ''
FOR I = 0 TO 255
A := CHAR(I)
NEXT I
ERR=''
CALL TU.DOWNLOAD(A,'C:\\datas\\A.BIN','BO','',ERR)
CRT 'ERR=':ERR
I get this on the pc side. The binaries are correct no one are corrupted, included 0xFF.
Same result on uv and on udt.
Can you try it ?
Regards.
------------------------------
Manu Fernandes
------------------------------
Hi Elaine,
IMHO, I suppose you have a problem to load your binaries in memory before the TU.DOWNLOAD.
If I do this :
I get this on the pc side. The binaries are correct no one are corrupted, included 0xFF.
Same result on uv and on udt.
Can you try it ?
Regards.
------------------------------
Manu Fernandes
------------------------------
IMHO, I suppose you have a problem to load your binaries in memory before the TU.DOWNLOAD.
If I do this :
A = ''
FOR I = 0 TO 255
A := CHAR(I)
NEXT I
ERR=''
CALL TU.DOWNLOAD(A,'C:\\datas\\A.BIN','BO','',ERR)
CRT 'ERR=':ERR
I get this on the pc side. The binaries are correct no one are corrupted, included 0xFF.
Same result on uv and on udt.
Can you try it ?
Regards.
------------------------------
Manu Fernandes
------------------------------
Thanks so much for your reply. I ended up doing a web service to download the file, invoked from the client. That and emailing it. I'm sure you are right; I'll look at it again. I don't think we have an equivalent to your byteval but maybe seq will do.
------------------------------
Elaine Litchfield
Owner
Elaine Litchfield Consulting
San Diego CA United States
------------------------------
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.

