<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic translate_lnm() example in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114619#M44138</link>
    <description>Hi, VMS users&lt;BR /&gt;&lt;BR /&gt;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:&lt;BR /&gt;&lt;BR /&gt;define/job TEST_COMMAND_COUNT 1000&lt;BR /&gt;&lt;BR /&gt;somehow translate_lnm() always fails. Can someone review my code and give some pointers?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;YE LIU &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#define STR_SS( dsc, carr )        struct dsc$descriptor_s dsc = {sizeof( carr ), DSC$K_DTYPE_T, DSC$K_CLASS_S, carr}&lt;BR /&gt;#define SD_SET_P( dscp, strp )\&lt;BR /&gt;{\&lt;BR /&gt;     *(DESC_t *) (dscp) = c$str_sd;\&lt;BR /&gt;     (dscp)-&amp;gt;dsc$a_pointer = strp; (dscp)-&amp;gt;dsc$w_length = 65535-_LOCC(0,65535,strp );\&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; int     sts;&lt;BR /&gt;    int     test_command_count;&lt;BR /&gt;    char    czLclTestCmdCntName[64];&lt;BR /&gt;    char    czLclTestCmdCntValue[64];&lt;BR /&gt;&lt;BR /&gt; STR_SS (dscLclTestCmdCntName, czLclTestCmdCntName);&lt;BR /&gt;    STR_SS (dscLclTestCmdCntValue, czLclTestCmdCntValue);&lt;BR /&gt;&lt;BR /&gt;    /* translate test_command_count to its value */&lt;BR /&gt;    sprintf(czLclTestCmdCntName, "%s", "test_command_count");&lt;BR /&gt;    SD_SET_P(&amp;amp;dscLclTestCmdCntName, czLclTestCmdCntName);&lt;BR /&gt;    dscLclTestCmdCntValue.dsc$w_length = sizeof(czLclTestCmdCntValue);&lt;BR /&gt;    sts = translate_lnm(&amp;amp;dscLclTestCmdCntName, LNT_ANY, &amp;amp;dscLclTestCmdCntValue);&lt;BR /&gt;    if ( sts == SS$_NORMAL )&lt;BR /&gt;    {&lt;BR /&gt;    czLclTestCmdCntValue[dscLclTestCmdCntValue.dsc$w_length] = '\0';&lt;BR /&gt;    }   /* if sts == SS$_NORMAL */&lt;BR /&gt;    else&lt;BR /&gt;    {&lt;BR /&gt;  printf("translate_lnm failed\n");&lt;BR /&gt;  czLclTestCmdCntValue[0] = '\0';&lt;BR /&gt;    }   /* else sts == SS$_NORMAL */&lt;BR /&gt;    &lt;BR /&gt; test_command_count=atoi(czLclTestCmdCntValue);&lt;BR /&gt; printf("test_command_count=%d", test_command_count);&lt;BR /&gt;}&lt;BR /&gt;</description>
    <pubDate>Wed, 18 Jun 2008 14:29:59 GMT</pubDate>
    <dc:creator>YE LIU_1</dc:creator>
    <dc:date>2008-06-18T14:29:59Z</dc:date>
    <item>
      <title>translate_lnm() example</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114619#M44138</link>
      <description>Hi, VMS users&lt;BR /&gt;&lt;BR /&gt;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:&lt;BR /&gt;&lt;BR /&gt;define/job TEST_COMMAND_COUNT 1000&lt;BR /&gt;&lt;BR /&gt;somehow translate_lnm() always fails. Can someone review my code and give some pointers?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;YE LIU &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#define STR_SS( dsc, carr )        struct dsc$descriptor_s dsc = {sizeof( carr ), DSC$K_DTYPE_T, DSC$K_CLASS_S, carr}&lt;BR /&gt;#define SD_SET_P( dscp, strp )\&lt;BR /&gt;{\&lt;BR /&gt;     *(DESC_t *) (dscp) = c$str_sd;\&lt;BR /&gt;     (dscp)-&amp;gt;dsc$a_pointer = strp; (dscp)-&amp;gt;dsc$w_length = 65535-_LOCC(0,65535,strp );\&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt; int     sts;&lt;BR /&gt;    int     test_command_count;&lt;BR /&gt;    char    czLclTestCmdCntName[64];&lt;BR /&gt;    char    czLclTestCmdCntValue[64];&lt;BR /&gt;&lt;BR /&gt; STR_SS (dscLclTestCmdCntName, czLclTestCmdCntName);&lt;BR /&gt;    STR_SS (dscLclTestCmdCntValue, czLclTestCmdCntValue);&lt;BR /&gt;&lt;BR /&gt;    /* translate test_command_count to its value */&lt;BR /&gt;    sprintf(czLclTestCmdCntName, "%s", "test_command_count");&lt;BR /&gt;    SD_SET_P(&amp;amp;dscLclTestCmdCntName, czLclTestCmdCntName);&lt;BR /&gt;    dscLclTestCmdCntValue.dsc$w_length = sizeof(czLclTestCmdCntValue);&lt;BR /&gt;    sts = translate_lnm(&amp;amp;dscLclTestCmdCntName, LNT_ANY, &amp;amp;dscLclTestCmdCntValue);&lt;BR /&gt;    if ( sts == SS$_NORMAL )&lt;BR /&gt;    {&lt;BR /&gt;    czLclTestCmdCntValue[dscLclTestCmdCntValue.dsc$w_length] = '\0';&lt;BR /&gt;    }   /* if sts == SS$_NORMAL */&lt;BR /&gt;    else&lt;BR /&gt;    {&lt;BR /&gt;  printf("translate_lnm failed\n");&lt;BR /&gt;  czLclTestCmdCntValue[0] = '\0';&lt;BR /&gt;    }   /* else sts == SS$_NORMAL */&lt;BR /&gt;    &lt;BR /&gt; test_command_count=atoi(czLclTestCmdCntValue);&lt;BR /&gt; printf("test_command_count=%d", test_command_count);&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Jun 2008 14:29:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114619#M44138</guid>
      <dc:creator>YE LIU_1</dc:creator>
      <dc:date>2008-06-18T14:29:59Z</dc:date>
    </item>
    <item>
      <title>Re: translate_lnm() example</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114620#M44139</link>
      <description>The length you are setting in the descriptor is wrong. &lt;BR /&gt;&lt;BR /&gt;Try&lt;BR /&gt;&lt;BR /&gt;dscLclTestCmdCntValue.dsc$w_length = strlen(czLclTestCmdCntValue);&lt;BR /&gt;&lt;BR /&gt;What status value does translate_lnm return?</description>
      <pubDate>Wed, 18 Jun 2008 14:49:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114620#M44139</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2008-06-18T14:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: translate_lnm() example</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114621#M44140</link>
      <description>translate_lnm() returns 444.</description>
      <pubDate>Wed, 18 Jun 2008 14:57:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114621#M44140</guid>
      <dc:creator>YE LIU_1</dc:creator>
      <dc:date>2008-06-18T14:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: translate_lnm() example</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114622#M44141</link>
      <description>Ok,  translate_lnm() is not OpenVMS code.  It's local code.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;$ x=f$message(444)&lt;BR /&gt;$ sho symbol x&lt;BR /&gt;  X = "%SYSTEM-F-NOLOGNAM, no logical name match"&lt;BR /&gt;$ &lt;BR /&gt;&lt;BR /&gt;As for the underlying call, there is a library of routines at &lt;A href="http://eight-cubed.com," target="_blank"&gt;http://eight-cubed.com,&lt;/A&gt; and I and many others have posted up examples of sys$trnlnm and of lib$get_logical.&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;And given this is C code and presumably fairly recent OpenVMS version, the C call getenv("logicalname") works nicely.&lt;BR /&gt;&lt;BR /&gt;This is not a valid test for success:&lt;BR /&gt;&lt;BR /&gt;if ( sts == SS$_NORMAL )...&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hoffmanlabs.com/vmsfaq/" target="_blank"&gt;http://www.hoffmanlabs.com/vmsfaq/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;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 &lt;A href="http://64.223.189.234/" target="_blank"&gt;http://64.223.189.234/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Jun 2008 15:12:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114622#M44141</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2008-06-18T15:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: translate_lnm() example</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114623#M44142</link>
      <description>getenv() works great!!!&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;YE LIU</description>
      <pubDate>Wed, 18 Jun 2008 15:34:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114623#M44142</guid>
      <dc:creator>YE LIU_1</dc:creator>
      <dc:date>2008-06-18T15:34:37Z</dc:date>
    </item>
    <item>
      <title>Re: translate_lnm() example</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114624#M44143</link>
      <description>closed</description>
      <pubDate>Wed, 18 Jun 2008 15:35:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114624#M44143</guid>
      <dc:creator>YE LIU_1</dc:creator>
      <dc:date>2008-06-18T15:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: translate_lnm() example</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114625#M44144</link>
      <description>Ye,... please consider saying thanks with "points".&lt;BR /&gt;&lt;BR /&gt;That way we will know later which answers helped a little, and which helped a lot.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/helptips.do?#28" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/helptips.do?#28&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Hein (0 points for that!)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 18 Jun 2008 15:55:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/translate-lnm-example/m-p/5114625#M44144</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-06-18T15:55:50Z</dc:date>
    </item>
  </channel>
</rss>

