<?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 Re: $GETJPI - terminal in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144571#M26179</link>
    <description>Willem,&lt;BR /&gt;&lt;BR /&gt;  As Steven's SPAWN command shows, JPI$_TERMINAL is only defined for the owner of the terminal (ie: the parent process).&lt;BR /&gt;&lt;BR /&gt;  It's not necessary to walk the process tree, JPI$_MASTER_PID will take you directly to the top.&lt;BR /&gt; &lt;BR /&gt;  You need the equivalent of the DCL:&lt;BR /&gt;&lt;BR /&gt;F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;&lt;BR /&gt;  This will work for all processes, including the master itself. Try:&lt;BR /&gt;&lt;BR /&gt;$ WRITE SYS$OUTPUT F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;$ SPAWN WRITE SYS$OUTPUT F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;$ SPAWN SPAWN WRITE SYS$OUTPUT F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;$ SPAWN SPAWN SPAWN WRITE SYS$OUTPUT F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;&lt;BR /&gt;etc...&lt;BR /&gt;</description>
    <pubDate>Wed, 03 Dec 2008 23:03:18 GMT</pubDate>
    <dc:creator>John Gillings</dc:creator>
    <dc:date>2008-12-03T23:03:18Z</dc:date>
    <item>
      <title>$GETJPI - terminal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144568#M26176</link>
      <description>&lt;!--!*#--&gt;Environment: &lt;BR /&gt;&lt;BR /&gt;$ pascal/ver&lt;BR /&gt;HP Pascal Alpha V5.9-95 on OpenVMS Alpha V7.3-2&lt;BR /&gt;&lt;BR /&gt;Given this code snipplet:&lt;BR /&gt;&lt;BR /&gt;ItemList[0].Buflen := SIZEOF  G_Currterminal.BODY) ;&lt;BR /&gt;ItemList[0].ItmCod  := JPI$_TERMINAL ;&lt;BR /&gt;ItemList[0].Buffer  := IADDRESS (G_CurrTerminal.BODY);&lt;BR /&gt;ItemList[0].RetLenAdr := IADDRESS (RetLenTrm) ;&lt;BR /&gt;&lt;BR /&gt;ItemList[4].Terminator  := 0 ;&lt;BR /&gt;&lt;BR /&gt;Retstat := $GETJPIW (,,,ItemList,,,) ;&lt;BR /&gt;&lt;BR /&gt;in which G_CurrTerminal is defined as:&lt;BR /&gt;&lt;BR /&gt;G_CurrTerminal : VARYING [8] OF CHAR ;         &lt;BR /&gt;&lt;BR /&gt;If run from a process when logged in, the terminal will be returned as (for example) OPA0: in G_CurrTerminal.body, and (since not specified) 0 in G_CurrTerminal.LENGTH. This is taken care of later on.&lt;BR /&gt;&lt;BR /&gt;however, in a subprocess (SPAWN and then run the program), G_CurrTermninal is returned empty (all inprintables). My expectation would be the same as teh parent process.&lt;BR /&gt;&lt;BR /&gt;If this is normal behaviour, how would I get the terminal the process is attached to (apart from referring bto SYS$OUTPUT, which may have been redefined) ?</description>
      <pubDate>Wed, 03 Dec 2008 21:54:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144568#M26176</guid>
      <dc:creator>Willem Grooters</dc:creator>
      <dc:date>2008-12-03T21:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: $GETJPI - terminal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144569#M26177</link>
      <description>&lt;A href="http://h71000.www7.hp.com/doc/732FINAL/4527/4527pro_004.html" target="_blank"&gt;http://h71000.www7.hp.com/doc/732FINAL/4527/4527pro_004.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;  JPI$_TERMINAL&lt;BR /&gt;&lt;BR /&gt;  Returns, for interactive users, the process's login terminal name as acharacter string. Because the terminal name can include up&lt;BR /&gt;  to 8characters, the buffer length field in the item descriptor shouldspecify at least 8 bytes. Trailing zeros are written to the&lt;BR /&gt;  outputbuffer if necessary.&lt;BR /&gt;&lt;BR /&gt;[The sub-ideal whatever-to-HTML conversion is&lt;BR /&gt;not my fault.]&lt;BR /&gt;&lt;BR /&gt;Note: "interactive".&lt;BR /&gt;&lt;BR /&gt;If I were looking for a terminal, I'd&lt;BR /&gt;probably ask about SYS$COMMAND.  Otherwise, I&lt;BR /&gt;suppose that one could try to climb up the&lt;BR /&gt;ladder of parent processes, looking for a&lt;BR /&gt;better answer.</description>
      <pubDate>Wed, 03 Dec 2008 22:22:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144569#M26177</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-12-03T22:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: $GETJPI - terminal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144570#M26178</link>
      <description>&lt;!--!*#--&gt;Not proof, but suggestive:&lt;BR /&gt;&lt;BR /&gt;alp $ show logical sys$command&lt;BR /&gt;   "SYS$COMMAND" = "_ALP$RTA2:" (LNM$PROCESS_TABLE)&lt;BR /&gt;&lt;BR /&gt;alp $ spawn show logical sys$command&lt;BR /&gt;%DCL-S-SPAWNED, process SMS_47505 spawned&lt;BR /&gt;%DCL-S-ATTACHED, terminal now attached to process SMS_47505&lt;BR /&gt;   "SYS$COMMAND" = "_ALP$RTA2:" (LNM$PROCESS_TABLE)&lt;BR /&gt;%DCL-S-RETURNED, control returned to process _RTA2:&lt;BR /&gt;&lt;BR /&gt;alp $ write sys$output f$getjpi( "", "terminal")&lt;BR /&gt;RTA2:&lt;BR /&gt;&lt;BR /&gt;alp $ spawn write sys$output f$getjpi( "", "terminal")&lt;BR /&gt;%DCL-S-SPAWNED, process SMS_30276 spawned&lt;BR /&gt;%DCL-S-ATTACHED, terminal now attached to process SMS_30276&lt;BR /&gt;&lt;BR /&gt;%DCL-S-RETURNED, control returned to process _RTA2:</description>
      <pubDate>Wed, 03 Dec 2008 22:26:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144570#M26178</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2008-12-03T22:26:52Z</dc:date>
    </item>
    <item>
      <title>Re: $GETJPI - terminal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144571#M26179</link>
      <description>Willem,&lt;BR /&gt;&lt;BR /&gt;  As Steven's SPAWN command shows, JPI$_TERMINAL is only defined for the owner of the terminal (ie: the parent process).&lt;BR /&gt;&lt;BR /&gt;  It's not necessary to walk the process tree, JPI$_MASTER_PID will take you directly to the top.&lt;BR /&gt; &lt;BR /&gt;  You need the equivalent of the DCL:&lt;BR /&gt;&lt;BR /&gt;F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;&lt;BR /&gt;  This will work for all processes, including the master itself. Try:&lt;BR /&gt;&lt;BR /&gt;$ WRITE SYS$OUTPUT F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;$ SPAWN WRITE SYS$OUTPUT F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;$ SPAWN SPAWN WRITE SYS$OUTPUT F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;$ SPAWN SPAWN SPAWN WRITE SYS$OUTPUT F$GETJPI(F$GETJPI("","MASTER_PID"),"TERMINAL")&lt;BR /&gt;&lt;BR /&gt;etc...&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Dec 2008 23:03:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144571#M26179</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2008-12-03T23:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: $GETJPI - terminal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144572#M26180</link>
      <description>oh, and I just noticed as I hit "SUBMIT"...&lt;BR /&gt;&lt;BR /&gt;your code:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Retstat := $GETJPIW (,,,ItemList,,,) ;&lt;BR /&gt;&lt;BR /&gt;Although the IOSB is documented as "optional", a prudent programmer will never omit it. The return status will only tell you if you have a syntactically correct call. It will not tell you the result of the $GETJPI query.&lt;BR /&gt;&lt;BR /&gt;See $ HELP SYSTEM $GETJPI ARGUMENTS</description>
      <pubDate>Wed, 03 Dec 2008 23:08:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144572#M26180</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2008-12-03T23:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: $GETJPI - terminal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144573#M26181</link>
      <description>What task might you be resolving here, beyond the obvious discussion of retrieving the name behind SYS$COMMAND?&lt;BR /&gt;&lt;BR /&gt;I've been at this OpenVMS coding at least a year or two, and recently discovered I blew a case of this when I was using SMG$, and missed an error sequence.&lt;BR /&gt;&lt;BR /&gt;This whole area is fraught with oddities, FWIW, and the best course depends highly on the particular application requirement(s) in play here.  More than a few applications have (or have had) incorrect decisions around the particular capabilities of the device target, for instance.  &lt;BR /&gt;</description>
      <pubDate>Wed, 03 Dec 2008 23:28:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144573#M26181</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2008-12-03T23:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: $GETJPI - terminal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144574#M26182</link>
      <description>Steven/John,&lt;BR /&gt;That would do the trick, I'll use GETJPI(JPI$K_PARENT_PID) and get the right data from there - including usage (and handling) of IOSB. &lt;BR /&gt;Hoff:&lt;BR /&gt;The program is used to change the process environment: UIC, username and privilege masks, as if the user logs in; a requirement in the way the whole environment is set up. As a result, the terminal will no longer be accessabale unsless it's ACL is changed. I found code that uses $CHANGE_ACL for this, but the only reference I could find on this service was it is obsolete, and an alternate should be used to do this. I used the alternative ;)&lt;BR /&gt;&lt;BR /&gt;FYI: The original is a program, written over 10 years ago, of which the source is lost. By reverse-engineering we could develop code that was functionally equivalent - but due to time constraints, not all possibilities were covered - and usage of the functionality in a SPWANed process was one of them.&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Dec 2008 08:48:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144574#M26182</guid>
      <dc:creator>Willem Grooters</dc:creator>
      <dc:date>2008-12-04T08:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: $GETJPI - terminal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144575#M26183</link>
      <description>HAs been implemented and it works. Drawback: On return, the terminal protection is not fit for that user. But that's another story.</description>
      <pubDate>Fri, 12 Dec 2008 20:32:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/getjpi-terminal/m-p/5144575#M26183</guid>
      <dc:creator>Willem Grooters</dc:creator>
      <dc:date>2008-12-12T20:32:04Z</dc:date>
    </item>
  </channel>
</rss>

