MultiValue Tools

 View Only
  • 1.  SBClient host to PC transfer of binary files

    Posted 06-14-2021 13:49
    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
    ------------------------------


  • 2.  RE: SBClient host to PC transfer of binary files

    Posted 06-15-2021 08:53
    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
    ------------------------------



  • 3.  RE: SBClient host to PC transfer of binary files

    Posted 06-16-2021 00:42
    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
    ------------------------------



  • 4.  RE: SBClient host to PC transfer of binary files

    Posted 06-17-2021 08:20
    Straight from the Client Programmers Guide.

    TU.DOWNLOAD will do the trick for binary files. With the 'B' option.

    --- Exce​rp​​​t ---

    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




  • 5.  RE: SBClient host to PC transfer of binary files

    Posted 06-17-2021 14:08
    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
    ------------------------------



  • 6.  RE: SBClient host to PC transfer of binary files

    PARTNER
    Posted 06-16-2021 08:14
    hello,

    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
    ------------------------------



  • 7.  RE: SBClient host to PC transfer of binary files

    Posted 06-17-2021 14:07
    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
    ------------------------------



  • 8.  RE: SBClient host to PC transfer of binary files

    PARTNER
    Posted 07-19-2021 03:31
    Hi Elaine,

    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 
    ​
    sbz result of a.bin to pc

    I get this on the pc side. The binaries are correct no one are corrupted, included 0xFF.  
    hex dump of a.bin file

    Same result on uv and on udt. 
    Can you try it ? 

    Regards.

    ------------------------------
    Manu Fernandes
    ------------------------------



  • 9.  RE: SBClient host to PC transfer of binary files

    Posted 07-26-2021 17:44
    Hi Manu,

    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
    ------------------------------