- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: translate_lnm() example
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
Discussions
Discussions
Forums
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
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
тАО06-18-2008 07:29 AM
тАО06-18-2008 07:29 AM
translate_lnm() example
I am tweaking some a legacy system and I want to define some logicals as input. I wrote a test_command_count.c to get the value of "TEST_COMMAND_COUNT" which I defined using:
define/job TEST_COMMAND_COUNT 1000
somehow translate_lnm() always fails. Can someone review my code and give some pointers?
Thanks,
YE LIU
#define STR_SS( dsc, carr ) struct dsc$descriptor_s dsc = {sizeof( carr ), DSC$K_DTYPE_T, DSC$K_CLASS_S, carr}
#define SD_SET_P( dscp, strp )\
{\
*(DESC_t *) (dscp) = c$str_sd;\
(dscp)->dsc$a_pointer = strp; (dscp)->dsc$w_length = 65535-_LOCC(0,65535,strp );\
}
int main()
{
int sts;
int test_command_count;
char czLclTestCmdCntName[64];
char czLclTestCmdCntValue[64];
STR_SS (dscLclTestCmdCntName, czLclTestCmdCntName);
STR_SS (dscLclTestCmdCntValue, czLclTestCmdCntValue);
/* translate test_command_count to its value */
sprintf(czLclTestCmdCntName, "%s", "test_command_count");
SD_SET_P(&dscLclTestCmdCntName, czLclTestCmdCntName);
dscLclTestCmdCntValue.dsc$w_length = sizeof(czLclTestCmdCntValue);
sts = translate_lnm(&dscLclTestCmdCntName, LNT_ANY, &dscLclTestCmdCntValue);
if ( sts == SS$_NORMAL )
{
czLclTestCmdCntValue[dscLclTestCmdCntValue.dsc$w_length] = '\0';
} /* if sts == SS$_NORMAL */
else
{
printf("translate_lnm failed\n");
czLclTestCmdCntValue[0] = '\0';
} /* else sts == SS$_NORMAL */
test_command_count=atoi(czLclTestCmdCntValue);
printf("test_command_count=%d", test_command_count);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 07:49 AM
тАО06-18-2008 07:49 AM
Re: translate_lnm() example
Try
dscLclTestCmdCntValue.dsc$w_length = strlen(czLclTestCmdCntValue);
What status value does translate_lnm return?
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 07:57 AM
тАО06-18-2008 07:57 AM
Re: translate_lnm() example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 08:12 AM
тАО06-18-2008 08:12 AM
Re: translate_lnm() example
As for the error, that's a missing or misspelled logical name, or you might conceivably have some case-sensitivity going on here depending on your specific process settings.
$ x=f$message(444)
$ sho symbol x
X = "%SYSTEM-F-NOLOGNAM, no logical name match"
$
As for the underlying call, there is a library of routines at http://eight-cubed.com, and I and many others have posted up examples of sys$trnlnm and of lib$get_logical.
The site:mvb.saic.com keyword added to a Google search can get you directly into a massive collection of OpenVMS source code at that site.
And given this is C code and presumably fairly recent OpenVMS version, the C call getenv("logicalname") works nicely.
This is not a valid test for success:
if ( sts == SS$_NORMAL )...
That statement tests for exactly one successful status, and misses any other successful conditions that might be returned. It treats other successful returns as failures. Details on the stsdef.h include module and on the low-bit tests and other such are in the OpenVMS FAQ at HL, and elsewhere, and in modules elsewhere.
http://www.hoffmanlabs.com/vmsfaq/
If you look at the stuff I have posted over at the HL web site (other than the FAQ), I'm pretty sure I have this same sequence for a debugging logical name. Tere's a big wad of example C code available for download if you search for newuser or such over at http://64.223.189.234/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 08:34 AM
тАО06-18-2008 08:34 AM
Re: translate_lnm() example
Thanks,
YE LIU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 08:35 AM
тАО06-18-2008 08:35 AM
Re: translate_lnm() example
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-18-2008 08:55 AM
тАО06-18-2008 08:55 AM
Re: translate_lnm() example
That way we will know later which answers helped a little, and which helped a lot.
http://forums11.itrc.hp.com/service/forums/helptips.do?#28
Regards,
Hein (0 points for that!)