- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: C Code Returning Unreadable File ID String
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2008 08:41 AM
11-24-2008 08:41 AM
FILE_IDENTIFICATION
␊_$1$DGA151ú#Md-
Anybody know the code to return it in the (n,n,n) format?
Rob.
C
C Look at the identification of the file being processed. Strip off the
C device name, and get the fileid and directory id values.
C
STREAM(NSTREAM).ENTRY=LONG(MESSAGE(IP:IP+3))
IP=STREAM(NSTREAM).POS(SMBMSG$K_FILE_IDENTIFICATION)
STREAM(NSTREAM).DEVICE_NAME_LEN=BYTE(MESSAGE(IP:IP))
STREAM(NSTREAM).DEVICE_NAME=MESSAGE(IP+1:IP+15)
STREAM(NSTREAM).FID(1)=WORD(MESSAGE(IP+16:IP+17))
STREAM(NSTREAM).FID(2)=WORD(MESSAGE(IP+18:IP+19))
STREAM(NSTREAM).FID(3)=WORD(MESSAGE(IP+20:IP+21))
DID(1)=WORD(MESSAGE(IP+22:IP+23))
DID(2)=WORD(MESSAGE(IP+24:IP+25))
DID(3)=WORD(MESSAGE(IP+26:IP+27))
C
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2008 09:18 AM
11-24-2008 09:18 AM
Re: C Code Returning Unreadable File ID String
printf ("%s(%d,%d,%%)\n", device, did[1], did[2], did[2])
To do this properlyy you need to add the 1st 16 bits to 65536*times 8 bits from the 3rd word and display that as file ID.
See layout in the RMS NAMDEF.
Uage example for that:
i = atoi (argv[1]);
nam.nam$w_fid_num = (short) i;
nam.nam$b_fid_nmx = (unsigned char) (i >> 16);
nam.nam$w_fid_seq = (short) atoi ( argv[2] );
nam.nam$w_fid_rvn = (short) atoi ( argv[3] );
Enjoy,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2008 11:55 AM
11-24-2008 11:55 AM
Re: C Code Returning Unreadable File ID String
I don't see how the listed code lines can return this:
FILE_IDENTIFICATION
â _$1$DGA151⠤⠤⠤⠤⠤ú#M⠤⠤d-⠤⠤
Do you?
Hint...show us the code that produced the lines above.
/Guenther
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2008 01:15 PM
11-24-2008 01:15 PM
Re: C Code Returning Unreadable File ID String
Uh, comments which have a "C" in column one
are not usually described as "C code".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2008 01:45 PM
11-24-2008 01:45 PM
SolutionMaybe you could post an example with your formatting code? Put hardcoded values into the FID fields for illustration.
Here's an example in MACRO32 showing how to format a FID from a NAM block.
.TITLE FormatFid
.PSECT data,RD,WRT,NOEXE
$NAMDEF
MyNAM: $NAM
BinFid: .WORD 14426 ; FID (79962,17,0)
.WORD 17
.BYTE 0
.BYTE 1
outstr: .ASCID /12345678901234567890/
fmtstr: .ASCID /(!UL,!UW,!UB)/
.PSECT code,RD,NOWRT,EXE
.ENTRY start,^M
; first set up the NAM block with our canned FID
MOVC3 #NAM$S_FID,BinFid,MyNAM+NAM$R_FID_FIELDS
; Calculate NUM from FID_NUM and FID_NMX
MOVZBL MyNAM+NAM$B_FID_NMX,R2
ASHL #16,R2,R2
MOVW MyNAM+NAM$W_FID_NUM,R2
$FAO_S ctrstr=fmtstr outlen=outstr outbuf=outstr -
p1=R2 p2=MyNAM+NAM$W_FID_SEQ p3=MyNAM+NAM$B_FID_RVN
; display result
PUSHAB outstr
CALLS #1,G^LIB$PUT_OUTPUT
RET
.END start
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2008 02:03 PM
11-24-2008 02:03 PM
Re: C Code Returning Unreadable File ID String
But look at all those C's!
(You're no fun.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 12:07 AM
11-25-2008 12:07 AM
Re: C Code Returning Unreadable File ID String
Thanks for the good laugh !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 01:25 AM
11-25-2008 01:25 AM
Re: C Code Returning Unreadable File ID String
I've attached the original code, taken from http://vms.process.com/scripts/fileserv/fileserv.com?EXECSYMB
There's actually a section in the code which says :-
C
C Item conversion information
C
C Each item has an item name, the length of the name, and an item
C conversion type, used for converting the item value to ASCII for
C streams requiring ASCII-format item values. The following table
C lists the possible item types:
C type meaning
C ---- -------
C 1 No translation (already ASCII, or item not easily
C translated to ASCII, so left in original form)
C 2 Binary longword, converted to hexadecimal in the
C format "%Xnnnnnnnn"
C 3 Date and time, converted to dd-mmm-yyyy hh:mm:ss.cc
C format (with one space between date and time)
C 4 UIC, converted to [gggggg,mmmmmm] format with octal
C group and member numbers containing leading zeroes.
C 5 Bitstring, converted to a list of which bits are
C set. Up to 16 bytes of data can be included in the
C item (since the CHARACTERISTICS item is 16 bytes long.)
C The list is a series of decimal numbers separated by
C commas (e.g. hex 641 becomes "0,6,9,10")
C
Perhaps it's simply a case of defining FILEID as a type '5'? :-
DATA SMBITEM(SMBMSG$K_FILE_IDENTIFICATION) /'FILE_IDENTIFICATION'/
DATA SMBITEMLEN(SMBMSG$K_FILE_IDENTIFICATION) /19/
DATA SMBITEMTYPE(SMBMSG$K_FILE_IDENTIFICATION) /1/
Rob.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 02:44 AM
11-25-2008 02:44 AM
Re: C Code Returning Unreadable File ID String
the item type of the file specification is probably defaulted to '1', because that binary data can not easily be converted to an ASCII string.
There is a LIB$FID_TO_NAME RTL routine, which could help in this regard. There is a C example of using this routine on the V8 freeware CD.
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 02:51 AM
11-25-2008 02:51 AM
Re: C Code Returning Unreadable File ID String
you would need to improve the ITEMEDIT subroutine to accept a new item type (e.g. 6), which would represent the FILE_IDENTIFICATION binary string and then enhance that routine to convert this type of item to a readable ASCII string.
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 03:34 AM
11-25-2008 03:34 AM
Re: C Code Returning Unreadable File ID String
Nor do I have any compilers, so I'm completely reliant on offers from people to code and compile the changes.
Hunter Goatley has done some of the work on porting some of these utilities to IA64, but as this is a code change, I thought it better to seek out a willing programmer to help.
By the way - you can't imagine how frustrating it is to use these utilities, have the source code, but no be able to change them yourself!
Rob.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 04:00 AM
11-25-2008 04:00 AM
Re: C Code Returning Unreadable File ID String
until someone picks up this 'enhancement request' and provides a solution, what do you try to do with this string ?
Could you read that string from DCL and parse it into the various fields ? Then call F$FID_TO_NAME ?
The FILE_IDENTIFICATION binary string seems to be in NAM$T_DVI format, i.e.
16 byte device name
6 byte FILE-ID
6 byte DIR-ID
See the $NAMDEF definition in SYS$LIBRARY:STARLET.REQ.
Volker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2008 04:34 AM
11-25-2008 04:34 AM
Re: C Code Returning Unreadable File ID String
( http://forums11.itrc.hp.com/service/forums/publicProfile.do?userId=CA1182816&forumId=1 )
The bit representation would be tedious, but more importantly 3 bytes too short.
The first code suggests it is not tightly packed, so you would miss out on 3 critical bytes out of which you can only fake 1 (the rvn).
You may be better of TRYing to tret the umprintable as a bit string in DCL and hope is all glues together nicely.
Somthing LIKE...
$id=0
$seq=0
$rvn=0
$id[0,16] = f$cvui(16*8,16,record)
$id[16,8] = f$cvui(21*8,8,record)
$seq[0,16] = f$cvui(18*8,16,record)
$rvn[0,8] = f$cvui(20*8,8,record)
! I could well be off by one
! I could well have FID(3) swapped
! Some of this can be expressed as string bytes, but I believe bit strings is more clear.
Capture the 'garbage' for a known file in a file and $DUMP it. See if you can make the HEX bytes for the file line up with the HEX represenation for the FID:
$ fid = f$file("login.com","FID") - "(" - ")"
$ show sym fid
FID = "78215,881,0"
$ f_id = 'f$eleme(0,",",fid)
$ f_se = 'f$eleme(1,",",fid)
$ f_rv = 'f$eleme(2,",",fid)
$ show sym f_*
F_ID = 78215 Hex = 00013187 Octal = 00000230607
F_RV = 0 Hex = 00000000 Octal = 00000000000
F_SE = 881 Hex = 00000371 Octal = 00000001561
fwiw,
Hein
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2009 06:35 AM
12-02-2009 06:35 AM