Skip to main content
Jan 4, 2021 1:55 PM UTC

32-bit vs 64-bit files - Identify and update

We have converted a number of our files from 32-bit to 64-bit over that last couple of years. Typically, that has been done when we have a write issue and react to the specific problem. Does anyone have a dictionary or programmatic means of identifying the two type of file so that we can target conversion proactively?

Once the files are identified, they can certainly be resized to 64-bit via a script.

------------------------------
Jeff Teter
Woodforest National Bank
------------------------------

    11 replies

    Manu Fernandes
    Inspiring
    Jan 11, 2021 10:13 AM UTC
    hello, 
    you can do it from basic with STATUS/FROM attribute <31> is the magic code of the file:
    31 File revision stamp One of the following:
      ACEF01xx = 32-bit file
      ACEF02xx = 64-bit file
    xx is the file revision level​


    ------------------------------
    Manu Fernandes
    ------------------------------
    here is the sample 
    * UV Get Magic Number for 32 or 64 Bit
    *
    GET (ARG.) FILENAME ELSE PROMPT "" ; CRT "Pathname: " :; INPUT FILENAME
    IF FILENAME = "" THEN STOP
    OPEN FILENAME TO FILEVAR ELSE CRT "Error " : STATUS() : " Opening >" : FILENAME : "<"
    STATUS FILESTATS FROM FILEVAR ELSE STOP "Basic STATUS failed on file >":FILENAME : "<"
    MAGIC = FILESTATS<31>
    CRT "MAGIC = " : MAGIC
    BEGIN CASE
      CASE MAGIC[5,2] = "01" ; CRT "32 Bit File"
      CASE MAGIC[5,2] = "02" ; CRT "64 Bit File"
      CASE 1                 ; CRT "Cannot Determine 32 or 64 Bit >":FILENAME : "<"
    END CASE
    
    END
    ​

    Sample at runtime


    RESIZE FTEST2 * * * 32BIT                 
    RUN INBASIC.UV UV_32OR64BIT FTEST2        
    MAGIC = ACEF010C                             
    32 Bit File                                  
    
    RESIZE FTEST2 * * * 64BIT                 
    RUN INBASIC.UV UV_32OR64BIT FTEST2        
    MAGIC = ACEF020C                             
    64 Bit File                                  
    ​


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