Skip to main content
How can we quickly see if a file (or list of files) are 64bit or 32bit

I can see from analyze.file that a file is 64bit. but that was not picked up by the ACCOUNT.FILE.STATS in the STAT.FILE

Is there an hidden key in FILEINFO() that will get that information






------------------------------
neil richards
dba
Rocket Forum Shared Account
lake Elsinore CA US
------------------------------
How can we quickly see if a file (or list of files) are 64bit or 32bit

I can see from analyze.file that a file is 64bit. but that was not picked up by the ACCOUNT.FILE.STATS in the STAT.FILE

Is there an hidden key in FILEINFO() that will get that information






------------------------------
neil richards
dba
Rocket Forum Shared Account
lake Elsinore CA US
------------------------------
Fields 31 and 32 of the dynamic array returned by the BASIC STATUS statement contain information on the style of the file. An example below using field 32.

>COPYP BP FILETYPE (TSN

FILETYPE
OPEN "32BIT.FILE" TO F.FILE1 ELSE STOP 'CANNOT OPEN 32BIT.FILE'
OPEN "64BIT.FILE" TO F.FILE2 ELSE STOP 'CANNOT OPEN 64BIT.FILE'
STATUS FILE1 FROM F.FILE1 ELSE STOP
STATUS FILE2 FROM F.FILE2 ELSE STOP
CRT FILE1<32>
CRT FILE2<32>
END
>RUN BP FILETYPE
3
5

------------------------------
Neil Morris
Universe Advanced Technical Support
Rocket Software
------------------------------
How can we quickly see if a file (or list of files) are 64bit or 32bit

I can see from analyze.file that a file is 64bit. but that was not picked up by the ACCOUNT.FILE.STATS in the STAT.FILE

Is there an hidden key in FILEINFO() that will get that information






------------------------------
neil richards
dba
Rocket Forum Shared Account
lake Elsinore CA US
------------------------------
We wrote a program where we pass in the filename as an argument and use the STATUS command to extract information.  Here's a snippet of how to get the 64-bit info:
STATUS MOD FROM NEW.FILE ELSE
END
IF MOD<31>[1,6] = 'ACEF02' AND MOD<32> = '5' THEN
   FLAG.64 = 'Y'
END ELSE
   FLAG.64 = 'N'
END

------------------------------
Dara Dickson Fetsch
Programmer
Petrodata Business Systems Inc
Arlington TX US
------------------------------
How can we quickly see if a file (or list of files) are 64bit or 32bit

I can see from analyze.file that a file is 64bit. but that was not picked up by the ACCOUNT.FILE.STATS in the STAT.FILE

Is there an hidden key in FILEINFO() that will get that information






------------------------------
neil richards
dba
Rocket Forum Shared Account
lake Elsinore CA US
------------------------------

If you're using UNIX/Linux then you could configure the /etc/magic file (or rather take a copy of /etc/magic, modify and use the copy)

file -m /etc/magic.uv *
UV-FILE1: UV 32BIT Type:18 Mod:11 Sep:2
UV-FILE2: UV 64BIT Type:18 Mod:13 Sep:2
UV-FILE3: UV 32BIT Type:18 Mod:1823 Sep:1
UV-FILE4: UV 32BIT Type:18 Mod:101 Sep:2
UV-FILE5: UV 64BIT Type:18 Mod:11 Sep:1
UV-FILE6: UV 32BIT Type:18 Mod:29 Sep:4
VOC: UV 32BIT Type:18 Mod:1831 Sep:2
VOCLIB: UV 32BIT Type:2 Mod:7 Sep:4
UV-FILE7: UV 32BIT Type:18 Mod:1001 Sep:1
UV-FILE8: UV 32BIT Type:18 Mod:1001 Sep:1
UV-FILE9: UV 32BIT Type:18 Mod:101 Sep:1
UV-FILE10: UV 64BIT Type:18 Mod:101 Sep:2
UV-FILE11: UV 64BIT Type:18 Mod:101 Sep:2
UV-FILE12: UV 32BIT  Type:18 Mod:223 Sep:1
UV-FILE-TRIGGER: UV 32BIT Type:18 Mod:97 Sep:3 Trigger

Note: this file has been generated to report specific UniVerse file types, you may be running on a different Endian or have other types not correctly identified but should be able to easily adapt.

Mark



------------------------------
Mark Copp
Infrastructure Design
Travis Perkins Trading Company Ltd
Northampton GB
------------------------------

If you're using UNIX/Linux then you could configure the /etc/magic file (or rather take a copy of /etc/magic, modify and use the copy)

file -m /etc/magic.uv *
UV-FILE1: UV 32BIT Type:18 Mod:11 Sep:2
UV-FILE2: UV 64BIT Type:18 Mod:13 Sep:2
UV-FILE3: UV 32BIT Type:18 Mod:1823 Sep:1
UV-FILE4: UV 32BIT Type:18 Mod:101 Sep:2
UV-FILE5: UV 64BIT Type:18 Mod:11 Sep:1
UV-FILE6: UV 32BIT Type:18 Mod:29 Sep:4
VOC: UV 32BIT Type:18 Mod:1831 Sep:2
VOCLIB: UV 32BIT Type:2 Mod:7 Sep:4
UV-FILE7: UV 32BIT Type:18 Mod:1001 Sep:1
UV-FILE8: UV 32BIT Type:18 Mod:1001 Sep:1
UV-FILE9: UV 32BIT Type:18 Mod:101 Sep:1
UV-FILE10: UV 64BIT Type:18 Mod:101 Sep:2
UV-FILE11: UV 64BIT Type:18 Mod:101 Sep:2
UV-FILE12: UV 32BIT  Type:18 Mod:223 Sep:1
UV-FILE-TRIGGER: UV 32BIT Type:18 Mod:97 Sep:3 Trigger

Note: this file has been generated to report specific UniVerse file types, you may be running on a different Endian or have other types not correctly identified but should be able to easily adapt.

Mark



------------------------------
Mark Copp
Infrastructure Design
Travis Perkins Trading Company Ltd
Northampton GB
------------------------------
I really like this approach.
The 2 challenges to implementing it are (1) getting access to the knowledge about the raw file offsets that contain the various settings that identify the full variations of UV file types; (2) understanding how to define the "magic" settings to leverage this info.
It would be good if UV/UD came with this "out-of-the-box".

------------------------------
Gregor Scott
Software Architect
Pentana Solutions Pty Ltd
Mount Waverley VIC AU
------------------------------

If you're using UNIX/Linux then you could configure the /etc/magic file (or rather take a copy of /etc/magic, modify and use the copy)

file -m /etc/magic.uv *
UV-FILE1: UV 32BIT Type:18 Mod:11 Sep:2
UV-FILE2: UV 64BIT Type:18 Mod:13 Sep:2
UV-FILE3: UV 32BIT Type:18 Mod:1823 Sep:1
UV-FILE4: UV 32BIT Type:18 Mod:101 Sep:2
UV-FILE5: UV 64BIT Type:18 Mod:11 Sep:1
UV-FILE6: UV 32BIT Type:18 Mod:29 Sep:4
VOC: UV 32BIT Type:18 Mod:1831 Sep:2
VOCLIB: UV 32BIT Type:2 Mod:7 Sep:4
UV-FILE7: UV 32BIT Type:18 Mod:1001 Sep:1
UV-FILE8: UV 32BIT Type:18 Mod:1001 Sep:1
UV-FILE9: UV 32BIT Type:18 Mod:101 Sep:1
UV-FILE10: UV 64BIT Type:18 Mod:101 Sep:2
UV-FILE11: UV 64BIT Type:18 Mod:101 Sep:2
UV-FILE12: UV 32BIT  Type:18 Mod:223 Sep:1
UV-FILE-TRIGGER: UV 32BIT Type:18 Mod:97 Sep:3 Trigger

Note: this file has been generated to report specific UniVerse file types, you may be running on a different Endian or have other types not correctly identified but should be able to easily adapt.

Mark



------------------------------
Mark Copp
Infrastructure Design
Travis Perkins Trading Company Ltd
Northampton GB
------------------------------
Mark, are you able to share the uv file definitions for the magic.uv that you created?

many thanks

Neil

------------------------------
neil richards
dba
Rocket Forum Shared Account
lake Elsinore CA US
------------------------------
Mark, are you able to share the uv file definitions for the magic.uv that you created?

many thanks

Neil

------------------------------
neil richards
dba
Rocket Forum Shared Account
lake Elsinore CA US
------------------------------
Hi Neil,

This file is for HP-UX Itanium and will need modifying for Intel based platforms, the good news is we have today had approval to re-platform to RHEL so I will be converting at some time in the future in case you struggle doing it yourself.

Let me know how you get on

Kind regards
Mark

------------------------------
Mark Copp
Infrastructure Design
Travis Perkins Trading Company Ltd
Northampton GB
------------------------------
We wrote a program where we pass in the filename as an argument and use the STATUS command to extract information.  Here's a snippet of how to get the 64-bit info:
STATUS MOD FROM NEW.FILE ELSE
END
IF MOD<31>[1,6] = 'ACEF02' AND MOD<32> = '5' THEN
   FLAG.64 = 'Y'
END ELSE
   FLAG.64 = 'N'
END

------------------------------
Dara Dickson Fetsch
Programmer
Petrodata Business Systems Inc
Arlington TX US
------------------------------
I recommend creating a virtual dictionary item based upon the BASIC code as a model. That way you can LIST and SELECT based upon 32/64 bit files if needed.

Regards

JJ

------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------
I recommend creating a virtual dictionary item based upon the BASIC code as a model. That way you can LIST and SELECT based upon 32/64 bit files if needed.

Regards

JJ

------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------
Note that with NLS, the substring operator [] will not match 'ACEF02'  to the first six CHARACTERS, NOT BYTES of the binary file header's magic number. Use BYTEVAL instead to examine a byte, such as the hex digit 0xAC or 0xEF, and even the 0x02. Byte order of the host system will also affect the sequence of the bytes.

If you want something that works on any system, locating the positions of the 0xac and 0xef of the magic number will identify the byte order, and then you can find the 32/64 bit byte. Or you could locate the 0x01 or 0x02 in the "magic number" which can reside in only one of two of the first 4 bytes in current systems.

------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------
Note that with NLS, the substring operator [] will not match 'ACEF02'  to the first six CHARACTERS, NOT BYTES of the binary file header's magic number. Use BYTEVAL instead to examine a byte, such as the hex digit 0xAC or 0xEF, and even the 0x02. Byte order of the host system will also affect the sequence of the bytes.

If you want something that works on any system, locating the positions of the 0xac and 0xef of the magic number will identify the byte order, and then you can find the 32/64 bit byte. Or you could locate the 0x01 or 0x02 in the "magic number" which can reside in only one of two of the first 4 bytes in current systems.

------------------------------
Mark A Baldridge
Principal Consultant
Thought Mirror
Nacogdoches, Texas United States
------------------------------
This is the program from an old tech note is our knowledge base which determines the 32/64 Bit information you may find it useful

*************************************************************************
*
*
* Program to verify file bit setting 32/64 bit
*
* This program will allow you to verify the bit setting for a file ie 32bit or 64bit
* it also returns other information such as the size in bytes, the type, the modulo
* and separation. It could be modified to return any all information returned by
* the STATUS statement used in basic.
*
* It also supports the use of a select list but will not handle a multi level you will
* have to specify the individual part files in order to verify them.
* In order to preserve the look and feel of UniVerse it prompts for file names
* in the same fashion as the editor and uses the same form of error message
* when a file is not in the VOC
*
* To use it just copy this source into a BP file and compile and catalog globally
*
* Module %M% Version %I% Date %H%
*
*************************************************************************
*
** Initialise Variables
*
GOSUB INIT.VAR
*
** Check for presence of select list if not prompt
*
IF NOT(SYSTEM(11)) THEN
FVAR = TRIM(@SENTENCE[4,999])
IF FVAR = '' THEN
GOSUB INP.FVAR
IF FVAR # '' THEN
GOSUB PARSENT
GOSUB HANDLEALL
LOOP
WHILE OPEN.FILE.ERROR DO
GOSUB INP.FVAR
IF FVAR # '' THEN
GOSUB PARSENT
GOSUB HANDLEALL
END ELSE OPEN.FILE.ERROR = 0
REPEAT
END
END ELSE
GOSUB PARSENT
GOSUB HANDLEALL
LOOP
WHILE OPEN.FILE.ERROR DO
GOSUB INP.FVAR
IF FVAR # '' THEN
GOSUB PARSENT
GOSUB HANDLEALL
END ELSE OPEN.FILE.ERROR = 0
REPEAT
END
END ELSE
IF INDEX(@SENTENCE,'ALL',1) THEN ALL = 1 ELSE
IF INDEX(@SENTENCE,'DICT',1) THEN FDICT = 'DICT' ELSE FDICT = ''
END
LOOP
READNEXT FVAR ELSE EOF = 1
UNTIL EOF DO GOSUB HANDLEALL
REPEAT
END
*
** Exit Program
*
STOP
*
HANDLEALL:** Handle All
*
IF ALL THEN
FDICT = 'DICT'
GOSUB OPEN.FILE
FDICT = ''
GOSUB OPEN.FILE
END ELSE GOSUB OPEN.FILE
*
RETURN
*
OPEN.FILE:** Open file and get status
*
OPEN FDICT,FVAR TO FILE THEN
STATUS RECORD FROM FILE THEN
OPEN.FILE.ERROR = 0
BITSET = ''
FILESIZE = OCONV(RECORD<6>,'MR,')
FILETYPE = RECORD<21>
FILEMOD = RECORD<22>
FILESEP = RECORD<23>
BIT = RECORD<31>
BEGIN CASE
CASE FILETYPE = 1 OR FILETYPE = 19
GOSUB DIR.FOUND
CASE BIT[5,2] = 01
BITSET = 32
GOSUB PL
CASE BIT[5,2] = 02
BITSET = 64
GOSUB PL
CASE 1
BITSET = 'Unknown'
END CASE
END
END ELSE
OPEN.FILE.ERROR = 1
IF FDICT = 'DICT' THEN TEXT = 'Unable to open "DICT,' ELSE
TEXT = 'Unable to open "'
END
DISPLAY TEXT:FVAR:TAIL
IF SYSTEM(11) THEN
IF ALL THEN IF FDICT = '' THEN DISPLAY
END
END
*
RETURN
*
PL:** Print Line
*
IF FDICT = 'DICT' THEN TEXT = 'File Name DICT ' ELSE
TEXT = 'File Name '
END
*
DISPLAY TEXT:FVAR:' File type ':FILETYPE:
DISPLAY ' Modulo ':FILEMOD:' Separation ':FILESEP
DISPLAY 'Size ':FILESIZE:' Bytes is ':BITSET:' Bit'
IF SYSTEM(11) THEN
IF ALL THEN
IF FDICT = '' THEN DISPLAY
END ELSE DISPLAY
END
*
RETURN
*
DIR.FOUND:** Print Directory Found
*
DISPLAY 'File Name ':FVAR:' is a directory file, type ':FILETYPE
IF SYSTEM(11) THEN DISPLAY
*
RETURN
*
PARSENT:** Parse Sentence
*
ALL = 0
IF INDEX(FVAR,'ALL',1) THEN ALL = 1
CONVERT SPACE(1) TO @VM IN FVAR
IF FVAR<1,1> = 'DATA' OR FVAR<1,1> = 'DICT' THEN
FDICT = FVAR<1,1>
FVAR = FVAR<1,2>
IF FDICT = 'DATA' THEN FDICT = ''
END ELSE FVAR = FVAR<1,1>
*
RETURN
*
INP.FVAR:** INPUT FILE NAME
*
DISPLAY 'File Name = ':
INPUT FVAR
*
RETURN
*
INIT.VAR:** Initialise variables
*
PROMPT ''
FVAR = ''
FDICT = ''
ALL = 0
EOF = 0
OPEN.FILE.ERROR = 0
TAIL = '", not a file in VOC.'
*
RETURN
*
END

------------------------------
Jonathan Smith
UniData ATS
Rocket Support
------------------------------