- Community Home
- >
- Servers and Operating Systems
- >
- Operating System - OpenVMS
- >
- translate_lnm() example
-
- Forums
-
Blogs
- Alliances
- Around the Storage Block
- Behind the scenes @ Labs
- HPE Careers
- HPE Storage Tech Insiders
- Infrastructure Insights
- Inspiring Progress
- Internet of Things (IoT)
- My Learning Certification
- OEM Solutions
- Servers: The Right Compute
- Shifting to Software-Defined
- Telecom IQ
- Transforming IT
- Infrastructure Solutions German
- L’Avenir de l’IT
- IT e Trasformazione Digitale
- Enterprise Topics
- ИТ для нового стиля бизнеса
- Blogs
-
Quick Links
- Community
- Getting Started
- FAQ
- Ranking Overview
- Rules of Participation
- Contact
- Email us
- Tell us what you think
- Information Libraries
- Integrated Systems
- Networking
- Servers
- Storage
- Other HPE Sites
- Support Center
- Enterprise.nxt
- Marketplace
- Aruba Airheads Community
-
Forums
-
Blogs
-
InformationEnglish
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-18-2008 07:57 AM
06-18-2008 07:57 AM
Re: translate_lnm() example
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-18-2008 08:35 AM
06-18-2008 08:35 AM
Re: translate_lnm() example
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- 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!)
Hewlett Packard Enterprise International
- Communities
- HPE Blogs and Forum
© Copyright 2019 Hewlett Packard Enterprise Development LP