Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using RTL SMG$ routines

356 views
Skip to first unread message

Paul Richards

unread,
Jul 5, 2016, 11:53:17 PM7/5/16
to
When I program in COBOL I usually use the Screen Section to display
'forms' for input. I have been looking at the RTL SMG$ facilities as an
interesting alternative which has some advantages over the Screen
Section.

Unfortunately I have found only one short exemplar program in COBOL
with which I have been playing around. All of the examples in the HP
documentation appear to be in Fortran or some other language I don't
recognise. I have googled extensively trying to find other COBOL
examples but to no avail.

Can any of the experienced VMS-ers in this group point me in the right
direction please?

--
Paul
Melbourne, Australia

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Paul Sture

unread,
Jul 6, 2016, 1:38:33 AM7/6/16
to
On 2016-07-06, Paul Richards <paulri...@iinet.net.au> wrote:
> When I program in COBOL I usually use the Screen Section to display
> 'forms' for input. I have been looking at the RTL SMG$ facilities as an
> interesting alternative which has some advantages over the Screen
> Section.
>
> Unfortunately I have found only one short exemplar program in COBOL
> with which I have been playing around. All of the examples in the HP
> documentation appear to be in Fortran or some other language I don't
> recognise. I have googled extensively trying to find other COBOL
> examples but to no avail.
>
> Can any of the experienced VMS-ers in this group point me in the right
> direction please?

Alas, there's a real dearth of COBOL examples for this kind of thing.

Can you please tell us what you are trying to do. Pointing us at
one of the Fortran examples would be useful.

--
A sure cure for sea-sickness is to sit under a tree.
-- Spike Milligan

Paul Richards

unread,
Jul 6, 2016, 2:24:24 AM7/6/16
to
Paul: there examples in a number of languages, including COBOL at
http://www.s-and-b.ru/syshlp/vms_html/5935/5935pro_007.html#smgada

I have restructured the COBOL program more to my liking. I've been
trying to find out, for example, how precisely to position output in a
virtual display using something like line - col, and how to use a
rendition set to turn on/off blinking/reverse video etc.

I have been able to position stuff but largely by including spaces in
pic x fields and using line-advance, which is not ideal. As far as
using something like smg$m_blink I am unsure how to define this and use
it in a COBOL program.

These are all very basic but I've only just started and I'm scratching
around in the dark just trying stuff and seeing what the outcome is. :-(

There's also a call to "ots$cvt_l_ti" - I can't find any documentation
on this. It may be related to the lexical function f$cvi.

For what it's worth I have attached my reworked COBOL program with a
number of lines commented out as they did not do what I was hoping.

--
Paul
Melbourne, Australia



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
begin 444 smgtrial.txt
N:61E;G1I9FEC871I;VX@9&EV:7-I;VXN#0IP<F]G<F%M+6ED+B`@:V5Y<W1R
N;VME+@T**@T**B`@=&AI<R!R;W5T:6YE(&-R96%T97,@82!V:7)T=6%L(&1I
N<W!L87D@86YD('=R:71E<R!I="!T;R!T:&4@<&%S=&5B;V%R9"X-"BH@(&1A
N=&$@:7,@<&QA8V5D(&EN('1H92!V:7)T=6%L(&1I<W!L87D@=7-I;F<@=&AE
N(')O=71I;F4@<VUG)'!U=%]L:6YE+@T**B`@<VUG)')E861?:V5Y<W1R;VME
N(&ES(&-A;&QE9"!T;R!R96%D(&$@:V5Y<W1R;VME(&9R;VT@=&AE('9I<G1U
N86P@:V5Y8F]A<F0N#0HJ#0IE;G9I<F]N;65N="!D:79I<VEO;BX-"F1A=&$@
N9&EV:7-I;VXN#0IW;W)K:6YG+7-T;W)A9V4@<V5C=&EO;BX-"C`Q("!D:7-P
N;"UI9#$@("`@("`@("`@('!I8R`Y*#DI("!C;VUP+@T*,#$@('!A<W1E+6ED
N,2`@("`@("`@("`@<&EC(#DH.2D@(&-O;7`N#0HP,2`@:V5Y8BUI9#$@("`@
N("`@("`@("!P:6,@.2@Y*2`@8V]M<"X-"C`Q("!D:7-P;"UI9#$M<F]W<R`@
N("`@('!I8R!S.2@Y*2!C;VUP("`@('9A;'5E(#,P+@T*,#$@(&1I<W!L+6ED
N,2UC;VQS("`@("`@<&EC(',Y*#DI(&-O;7`@("`@=F%L=64@-C4N#0HP,2`@
N9&ES<&PM:60Q+6YA;64@("`@("!P:6,@>"@Q."D@=F%L=64@(B`@("!$25-0
N3$%9(#$@("`@(BX-"C`Q("!I;G!U="UC:"`@("`@("`@("`@('!I8R`Y*#0I
N("!C;VUP+@T*,#$@(&]U='!U="UM97-S86=E<RX-"B`@("`P,R`@:6YP=70M
N8VAA<B`@("`@('!I8R!X*#8I+@T*("`@(#`S("!T97AT7V]U='!U="`@("`@
N<&EC('@H,C0I('9A;'5E("(@5&5R;6EN86P@8VAA<F%C=&5R(&ES.B`B+@T*
N("`@(#`S("!P<F]M<'0@("`@("`@("`@<&EC('@H,BD@('9A;'5E("(^/B(N
N#0HP,2`@:6YP=70M;65S<V%G97,N#0H@("`@,#,@(&US9RUL:6YE+3`@("`@
N("!P:6,@>`T*("`@("`@("`@("`@("`@("`@("`@("`@=F%L=64@(B`B+@T*
N("`@(#`S("!M<V<M;&EN92TQ("`@("`@<&EC('@H,3@I('9A;'5E#0H@("`@
N("`@("`@("`@("`@("`@("`@("`B("TM+2T@2&ET(&%N>2!K97DN(BX-"B`@
N("`P,R`@;7-G+6QI;F4M,B`@("`@('!I8R!X*#0P*2!V86QU90T*("`@("`@
N("`@("`@("`@("`@("`@("`@(B`@("!4:&ES(&-H87)A8W1E<B!W:6QL(&YO
N="!B92!E8VAO960N(BX-"B`@("`P,R`@;7-G+6QI;F4M,R`@("`@('!I8R!X
N*#4Q*2!V86QU90T*("`@("`@("`@("`@("`@("`@("`@("`@(B`@("!4:&4@
N=&5R;6EN86P@8VAA<F%C=&5R(&5Q=6EV86QE;G0@:7,@9&ES<&QA>65D+B(N
N#0H@("`@,#,@(&US9RUL:6YE+30@("`@("!P:6,@>"`@("`@=F%L=64@(B`B
N+@T*,#$@('!O<VET:6]N<RX-"B`@("`P,R`@<V-R;BUT:')E92`@("`@('!I
N8R!S.2@Y*2!C;VUP("`@=F%L=64@,RX-"B`@("`P,R`@<V-R;BUN:6YE("`@
N("`@('!I8R!S.2@Y*2!C;VUP("`@=F%L=64@.2X-"B`@("`P,R`@;&EN92TT
N("`@("`@("`@('!I8R!S.2@Y*2!C;VUP("`@=F%L=64@-"X-"B`@("`P,R`@
N8V]L+34@("`@("`@("`@('!I8R!S.2@Y*2!C;VUP("`@=F%L=64@-2X-"B`@
N("`P,R`@;&EN92UF:69T965N("`@('!I8R!S.2@Y*2!C;VUP("`@=F%L=64@
N,34N#0H@("`@,#,@(&-O;"UT=V5N='DM9FEV92!P:6,@<SDH.2D@8V]M<"`@
N('9A;'5E(#(U+@T*("`@(#`S("!L:6YE+6%D=F%N8V4@("`@<&EC(',Y*#DI
N(&-O;7`@("!V86QU92`S+@T*("`@(#`S("!C;VPM9FEV92`@("`@("`@<&EC
N(',Y*#DI(&-O;7`@("!V86QU92`U+@T*<')O8V5D=7)E(&1I=FES:6]N+@T*
N;6%I;G!A<F$N#0H@("`@("`@('!E<F9O<FT@8W)E871E7W9I<G1U86QS#0H@
N("`@("`@('!E<F9O<FT@<&%S=&4M=FER='5A;',-"B`@("`@("`@<&5R9F]R
N;2!P;&%C92UD871A#0H@("`@("`@('!E<F9O<FT@<F5A9"UK97ES=')O:V4-
N"B`@("`@("`@<&5R9F]R;2!C;VYV97)T+6%N9"UP<FEN=`T*("`@("`@("`@
N('-T;W`@<G5N+@T*#0IC<F5A=&4M=FER='5A;',N#0HJ(&-R96%T92!T:&4@
N=FER='5A;"!D:7-P;&%Y('=I=&@@82!B;W)D97(N#0H@("`@("`@(&-A;&P@
N(G-M9R1C<F5A=&5?=FER='5A;%]D:7-P;&%Y(B!U<VEN9PT*("`@("`@("`@
N("`@("!D:7-P;"UI9#$M<F]W<R!D:7-P;"UI9#$M8V]L<R!D:7-P;"UI9#$-
N"BH@8W)E871E('1H92!P87-T96)O87)D#0H@("`@("`@(&-A;&P@(G-M9R1C
N<F5A=&5?<&%S=&5B;V%R9"(@=7-I;F<-"B`@("`@("`@("`@("`@<&%S=&4M
N:60Q#0HJ(&-R96%T92!A('9I<G1U86P@:V5Y8F]A<F0-"B`@("`@("`@8V%L
N;"`B<VUG)&-R96%T95]V:7)T=6%L7VME>6)O87)D(B!U<VEN9PT*("`@("`@
N("`@("`@("!K97EB+6ED,2X-"@T*<&%S=&4M=FER='5A;',N#0HJ('!A<W1E
N('1H92!V:7)T=6%L(&1I<W!L87D@870@<V-R965N(')O=R`S+"!S8W)E96X@
N8V]L=6UN(#DN#0H@("`@("`@(&-A;&P@(G-M9R1L86)E;%]B;W)D97(B('5S
N:6YG#0H@("`@("`@("`@("`@(&1I<W!L+6ED,0T*("`@("`@("`@("`@("!B
N>2!D97-C<FEP=&]R(&1I<W!L+6ED,2UN86UE#0H@("`@("`@(&-A;&P@(G-M
N9R1P87-T95]V:7)T=6%L7V1I<W!L87DB('5S:6YG#0H@("`@("`@("`@("`@
N(&1I<W!L+6ED,2!P87-T92UI9#$@<V-R;BUT:')E92!S8W)N+6YI;F4N#0IP
N;&%C92UD871A+@T**B!P;&%C92!D871A(&EN('1H92!V:7)T=6%L(&1I<W!L
N87D-"B`@("`@("`@8V%L;"`B<VUG)'!U=%]L:6YE(B!U<VEN9R!D:7-P;"UI
N9#$-"B`@("`@("`@("`@("`@8GD@9&5S8W)I<'1O<B!M<V<M;&EN92TP#0H@
N("`@("`@(&-A;&P@(G-M9R1P=71?;&EN92(@=7-I;F<@9&ES<&PM:60Q#0HJ
N("`@("`@("!C86QL(")S;6<D<'5T7V-H87)S(B!U<VEN9PT*("`@("`@("`@
N("`@("!B>2!D97-C<FEP=&]R(&US9RUL:6YE+3$-"B`@("`@("`@("`@("`@
N8GD@<F5F97)E;F-E(&QI;F4M861V86YC90T*("`@("`@("!C86QL(")S;6<D
N<'5T7VQI;F4B('5S:6YG(&1I<W!L+6ED,0T**B`@("`@("`@8V%L;"`B<VUG
N)'!U=%]C:&%R<R(@=7-I;F<@9&ES<&PM:60Q#0H@("`@("`@("`@("`@(&)Y
N(&1E<V-R:7!T;W(@;7-G+6QI;F4M,@T*("`@("`@("`@("`@("!B>2!R969E
N<F5N8V4@;&EN92UA9'9A;F-E#0H@("`@("`@(&-A;&P@(G-M9R1P=71?;&EN
N92(@=7-I;F<@9&ES<&PM:60Q#0HJ("`@("`@("!C86QL(")S;6<D<'5T7V-H
N87)S(B!U<VEN9R!D:7-P;"UI9#$-"B`@("`@("`@("`@("`@8GD@9&5S8W)I
N<'1O<B!M<V<M;&EN92TS#0H@("`@("`@(&-A;&P@(G-M9R1P=71?;&EN92(@
N=7-I;F<@9&ES<&PM:60Q#0HJ("`@("`@("!C86QL(")S;6<D<'5T7V-H87)S
N(B!U<VEN9R!D:7-P;"UI9#$-"B`@("`@("`@("`@("`@8GD@9&5S8W)I<'1O
N<B!M<V<M;&EN92TT+@T*#0IR96%D+6ME>7-T<F]K92X-"BH@<F5A9"!A(&ME
N>7-T<F]K92!F<F]M('1H92!V:7)T=6%L('!A<W1E8F]A<F0N#0H@("`@("`@
N(&-A;&P@(G-M9R1R96%D7VME>7-T<F]K92(@=7-I;F<-"B`@("`@("`@("`@
N("`@:V5Y8BUI9#$@:6YP=70M8V@-"B`@("`@("`@("`@("`@8GD@9&5S8W)I
N<'1O<B!P<F]M<'0@;VUI='1E9"!B>2!R969E<F5N8V4@9&ES<&PM:60Q#0H@
N("`@("`@(&-A;&P@(G-M9R1P=71?;&EN92(@=7-I;F<-"B`@("`@("`@("`@
N("`@9&ES<&PM:60Q#0H@("`@("`@("`@("`@(&)Y(&1E<V-R:7!T;W(@;7-G
N+6QI;F4M-"X-"@T*8V]N=F5R="UA;F0M<')I;G0N#0HJ(&-O;G9E<G0@=&AE
N(&1E8VEM86P@=F%L=64@;V8@:6YP=70M8VAA<B!T;R!A(&1E8VEM86P@87-C
N:6D@=&5X="!S=')I;F<N#0H@("`@("`@(&-A;&P@(F]T<R1C=G1?;%]T:2(@
N=7-I;F<-"B`@("`@("`@("`@("`@:6YP=70M8V@-"B`@("`@("`@("`@("`@
N8GD@9&5S8W)I<'1O<B!I;G!U="UC:&%R#0HJ('!R:6YT(&]U="!T:&4@9&5C
N:6UA;"!A<V-I:2!T97AT('-T<FEN9RX-"BH@("`@("`@(&-A;&P@(G-M9R1P
N=71?;&EN92(@=7-I;F<-"B`@("`@("`@8V%L;"`B<VUG)'!U=%]C:&%R<R(@
N=7-I;F<-"B`@("`@("`@("`@("`@9&ES<&PM:60Q#0H@("`@("`@("`@("`@
N(&)Y(&1E<V-R:7!T;W(@=&5X=%]O=71P=70-"B`@("`@("`@("`@("`@8GD@
N<F5F97)E;F-E(&QI;F4M9FEF=&5E;B!C;VPM9FEV90T*("`@("`@(&-A;&P@
N(G-M9R1P=71?8VAA<G,B('5S:6YG#0H@("`@("`@("`@("`@(&1I<W!L+6ED
N,0T*("`@("`@("`@("`@("!B>2!D97-C<FEP=&]R(&EN<'5T+6-H87(-"B`@
N("`@("`@("`@("`@8GD@<F5F97)E;F-E(&QI;F4M9FEF=&5E;B!C;VPM='=E
,;G1Y+69I=F4N#0H`
end

VAXman-

unread,
Jul 6, 2016, 6:59:19 AM7/6/16
to
In article <IYGdnSMyi4WPOeHK...@westnet.com.au>, "Paul Richards" <paulri...@iinet.net.au> writes:
>Paul Sture wrote:
>
>> On 2016-07-06, Paul Richards <paulri...@iinet.net.au> wrote:
>> > When I program in COBOL I usually use the Screen Section to display
>> > 'forms' for input. I have been looking at the RTL SMG$ facilities
>> > as an interesting alternative which has some advantages over the
>> > Screen Section.
>> >
>> > Unfortunately I have found only one short exemplar program in COBOL
>> > with which I have been playing around. All of the examples in the HP
>> > documentation appear to be in Fortran or some other language I don't
>> > recognise. I have googled extensively trying to find other COBOL
>> > examples but to no avail.
>> >
>> > Can any of the experienced VMS-ers in this group point me in the
>> > right direction please?
>>
>> Alas, there's a real dearth of COBOL examples for this kind of thing.
>>
>> Can you please tell us what you are trying to do. Pointing us at
>> one of the Fortran examples would be useful.
>
>Paul: there examples in a number of languages, including COBOL at
>http://www.s-and-b.ru/syshlp/vms_html/5935/5935pro_007.html#smgada

It's sad that VMS users can no longer reference the HP pages which once held
the OpenVMS documentation.



>I have restructured the COBOL program more to my liking. I've been
>trying to find out, for example, how precisely to position output in a
>virtual display using something like line - col, and how to use a
>rendition set to turn on/off blinking/reverse video etc.
>
>I have been able to position stuff but largely by including spaces in
>pic x fields and using line-advance, which is not ideal. As far as
>using something like smg$m_blink I am unsure how to define this and use
>it in a COBOL program.

This is a problem with the language. AFAICT, there's no equivalents for the
other languages' ways to include files containing predefined constants which
is what SMG$M_BLINK would be.



>These are all very basic but I've only just started and I'm scratching
>around in the dark just trying stuff and seeing what the outcome is. :-(
>
>There's also a call to "ots$cvt_l_ti" - I can't find any documentation
>on this. It may be related to the lexical function f$cvi.

Convert longword to text integer. See: $ HELP RTL OTS OTS$CVT_L_TI


>For what it's worth I have attached my reworked COBOL program with a
>number of lines commented out as they did not do what I was hoping.

???
--
VAXman- A Bored Certified VMS Kernel Mode Hacker VAXman(at)TMESIS(dot)ORG

I speak to machines with the voice of humanity.

Jan-Erik Soderholm

unread,
Jul 6, 2016, 7:31:49 AM7/6/16
to
> other languages' ways to include files containing predefined constants...

Are we still talkning about Cobol here? That is what COPY does.

Paul Sture

unread,
Jul 6, 2016, 7:44:04 AM7/6/16
to
On 2016-07-06, VAXman- @SendSpamHere.ORG <VAX...@SendSpamHere.ORG> wrote:

That post hasn't appeared (yet?) on my news provider; maybe it's junking
posts with attachments?

> In article <IYGdnSMyi4WPOeHK...@westnet.com.au>, "Paul Richards" <paulri...@iinet.net.au> writes:

<snip>

>>For what it's worth I have attached my reworked COBOL program with a
>>number of lines commented out as they did not do what I was hoping.
>

I can see the encode blob in the thread at

<https://groups.google.com/forum/?hl=de#!topic/comp.os.vms/fVC97mV-Vrk>

Unfortunately the version of uudecode I have on OS X is behaving
in a demented fashion, and I can only see the first line and part of
the second.

Paul, can you please email me your example?
(the nospam address does work)

Kerry Main

unread,
Jul 6, 2016, 8:25:05 AM7/6/16
to comp.os.vms to email gateway
[snip...]

The OpenVMS docs are still there, but impossible to find starting at the

top of the HP OpenVMS web site links. Likely due to a "standardization"
push by the HPE web types.

Fortunately, a few of my older bookmarks still work:
http://h71000.www7.hp.com/doc/os84_index.html

The Cobol OpenVMS doc's are part of the drill down here:
http://h71000.www7.hp.com/doc/cobol.html

Other formal HP doc links: (not the core docs)

http://www8.hp.com/us/en/products/servers/openvms/documents.html


Regards,

Kerry Main
Kerry dot main at starkgaming dot com






Jan-Erik Soderholm

unread,
Jul 6, 2016, 8:46:02 AM7/6/16
to
I can not find the "OpenVMS RTL Screen Management (SMG$) Manual"
no matter what I do at the HP site...

*I* have a local copy downloaded 2008...

Jan-Erik.

Johnny Billquist

unread,
Jul 6, 2016, 8:59:57 AM7/6/16
to

VAXman-

unread,
Jul 6, 2016, 9:35:02 AM7/6/16
to
And what does one "COPY" to provide these constants???

Jan-Erik Soderholm

unread,
Jul 6, 2016, 10:06:17 AM7/6/16
to
COPY in Cobol is the way "to include files containing predefined
constants" which was what you asked for.

You need to have some file to COPY also, of course...

Maybe you ment some specific file with some specific constants.




VAXman-

unread,
Jul 6, 2016, 10:29:34 AM7/6/16
to

John Reagan

unread,
Jul 6, 2016, 11:02:35 AM7/6/16
to
On Wednesday, July 6, 2016 at 10:06:17 AM UTC-4, Jan-Erik Soderholm wrote:
> Den 2016-07-06 kl. 15:34, skrev VAXman:
> > In article <nliq73$et>, Jan-Erik Soderholm <jan-om> writes:
> >> Den 2016-07-06 kl. 12:59, skrev VAXmare.ORG:
What Brian was trying to cleverly say is that COBOL doesn't have constants. A few COBOL vendors have added them as extensions, but COBOL 85 (which is what the OpenVMS COBOL compiler conforms to) does not have constants or even record type definitions. That makes is very hard to create ANY include file for COBOL for system programming.

Stephen Hoffman

unread,
Jul 6, 2016, 11:19:59 AM7/6/16
to
On 2016-07-06 12:23:24 +0000, Kerry Main said:

>>
>> -----Original Message-----
>> From: Info-vax [mailto:info-vax...@rbnsn.com] On Behalf Of
>> VAXman---- via Info-vax
>> Sent: 06-Jul-16 6:59 AM
>> To: info...@rbnsn.com
>> Cc: VAX...@SendSpamHere.ORG
>> Subject: Re: [Info-vax] Using RTL SMG$ routines
>> ...
>> It's sad that VMS users can no longer reference the HP pages which once
>> held the OpenVMS documentation.

It's sad that the OpenVMS documentation and tools and support has
moldered as much as it has, too.

> The OpenVMS docs are still there, but impossible to find starting at
> the top of the HP OpenVMS web site links. Likely due to a
> "standardization" push by the HPE web types.

Nah, the documentation on point for this question was removed at least
a dozen years ago. What's posted and available now — once you find
where HPE has moved it to http://www.hp,com/go/openvms/doc — and VSI
seemingly hasn't posted docs yet — is popular with the experienced
folks and the established and familiar users, but it's increasingly
downright rude to new and inexperienced folks that want to get work
done without having to read and memorize large chunks or the whole wall
of manuals. There's certainly more than a little good content in the
existing OpenVMS and COBOL documentation, but what's included is
variously very old and there are more than a few cases where the
release notes or patch notes are also necessary, and with more than a
few cases where the manuals themselves are simply not updated for
changes. It's a mess.

Unfortunately, "RTFM" is the classic OpenVMS answer, which for
questions such as this, too — I mean, this is a very basic question,
around how to use the compilers and features of the platform — and this
is an awful approach for new and inexperienced users. Yet worse —
this being OpenVMS and the development tools for the platform are still
stuck seemingly back around 1995 or so — there are no modern IDE-based
tools with source code example libraries integrated as is increasingly
common on other platforms, nor is there any OpenVMS integration with
documentation tools such as Dash.app on macOS or with whatever Windows
is using these days. The old support databases that once contained
examples of most everything calling most everything else — Compaq AskQ
or DEC TIMA/STARS — are long gone from the 'net, There are a few
user-maintained archives of code examples and those primarily for the
more popular languages such as Jim Duff's eight-cubed examples, but
COBOL is not among these example archives. Philippe Vouters's example
site is long gone, too.

FWIW and from another similar question from ~five years ago, here are
the names of some of the old support articles for system services with
APIs similar to sys$trnlnm and sys$crelnm and related (that was the
example that other poster was looking for), and the HPE support center
folks may (will?) be able to get you copies of these articles and other
calls:
 
    Example-COBOL Using $SNDJBCW To Enter A File In A Print Queue
    Example-COBOL Using $SNDJBCW To Start And Stop A Batch Queue
    Example-COBOL Using $SNDJBCW To Submit A Batch Job With Parameters
    Example-COBOL Using SYS$SNDJBCW To Alter A Print Queue
    Example-COBOL Putting >1 Wildcard Files Into Single Print Job

These examples aren't posted anywhere AFAIK.
 
Published COBOL examples include these:
 
http://h71000.www7.hp.com/wizard/wiz_1091.html
http://h71000.www7.hp.com/wizard/wiz_8309.html
http://h71000.www7.hp.com/wizard/wiz_3061.html


Now as to the OP and the question and particularly this approach, you
might get lucky and somebody has an example they're willing to share,
but that's unlikely. Somebody else is asking the same question for
Pascal, over in another OpenVMS-related discussion forum, too.
You're just not going to find modern approaches and modern libraries
for OpenVMS and for using OpenVMS APIs from many of its supported
languages, nor will you find particularly much on Stack Overflow or
other such sites, and web search engines will find little. As you've
undoubtedly discovered. You will find some examples of some calls on
the old OpenVMS freeware – last update to that was over a decade ago,
but there are still repositories posted including digiater.nl and
decuslib.com sites — and using targeted searches (with Google or DDG,
use site:digiater.nl to limit the search — or whatever syntax your
search engine uses), and using Google Groups search of the comp.os.vms
newsgroup archives, you'll be able to turn up a few examples of COBOL
calling some system services or RTL calls. Also remember to look in
SYS$EXAMPLES: and see if COBOL loads any examples there. Searching
the PDFs of the OpenVMS and COBOL documentation will find a few more.
You will not find a whole lot of these examples, though. Yes, this
stinks.

Now as for the specific call of interest for these sorts of requests,
also look for calls in other languages to the system service or RTL
call of interest. There are usually a few calls to these services
posted around the network.

With the language-specific and wrong-language examples and with the
calling standard documentation and with the debugger — using assembler
or C or such as the language in the debugger, this to allow you to
examine memory more easily — you'll then examine the passing
conventions and figure out how to map the calls to what COBOL expects
and provides. This is a slog, unfortunately. You can end up writing
some assembler or C or other calls and having a look at the innards of
the calls, and comparing that with the documentation for the call — SMG
in this case — and for the calling standard documentation — for
learning the descriptor, Yes, this stinks large.

So... Find examples in other languages, and use the Calling Standard
manual and maybe the Programming Concepts manual. Yes, RTFM,
unfortunately. Yes, with the debugger. You're going to learn a lot
about OpenVMS and the debugger and the calling standard and COBOL and
SMG, unfortunately. This is the proverbial deep end of the pool, and
something where most of us would prefer there to be an easier way than
RTFM and the manuals... Maybe VSI gets enough traction and gets
enough staff and schedule time to post up some examples?

Now as for calling SMG from COBOL in general? COBOL is a reasonable
choice for a back-end and related processing particularly where there's
already COBOL in use, but — for user interface tasks — I'd suggest
figuring out how to connect that to a web interface or to a network
interface to your client, and going remote. Doing new work using
character cell user interfaces and doing new applications with SMG
is... exceedingly unusual, and probably not the best path, even if
you're going to be using COBOL as your back-end. Use CGI or maybe use
a purpose-built remote client, and pass the data over the network into
your COBOL back end; use something other than terminal emulation.
This is also more portable, if (when?) you need to port your code away
from OpenVMS and/or away from SMG. (Downside of all of this is that
COBOL — like most other OpenVMS languages — doesn't mix well with the
available network encryption and distributed authentication calls in
OpenVMS.)

Posting attachments here? Post those examples or samples to pastebin
or such, or use Dropbox or Spideroak some other site where you can host
files. Post pointers. Attachments tend to get filtered in many of
the newsgroups and particularly the text groups, and for at least a
couple of reasons.

Welcome to OpenVMS.



--
Pure Personal Opinion | HoffmanLabs LLC

Stephen Hoffman

unread,
Jul 6, 2016, 11:34:17 AM7/6/16
to
On 2016-07-06 12:46:02 +0000, Jan-Erik Soderholm said:

> I can not find the "OpenVMS RTL Screen Management (SMG$) Manual" no
> matter what I do at the HP site...

I'd expect the following URLs to change as the HPE rolling continuity
corruption continues, and the folks at VSI didn't have docs posted when
last I checked.

OpenVMS V8.4 docs:
http://h71000.www7.hp.com/doc/os84_index.html

HTML and PDF SMG docs:
http://h71000.www7.hp.com/doc/73final/5935/5935pro.html
http://h20565.www2.hpe.com/hpsc/doc/public/display?docId=emr_na-c04623137

Paul Sture

unread,
Jul 6, 2016, 3:28:34 PM7/6/16
to
On 2016-07-06, VAXman- @SendSpamHere.ORG <VAX...@SendSpamHere.ORG> wrote:
> In article <IYGdnSMyi4WPOeHK...@westnet.com.au>, "Paul
> Richards" <paulri...@iinet.net.au> writes:
>
>
>>I have restructured the COBOL program more to my liking. I've been
>>trying to find out, for example, how precisely to position output in a
>>virtual display using something like line - col, and how to use a
>>rendition set to turn on/off blinking/reverse video etc.
>>
>>I have been able to position stuff but largely by including spaces in
>>pic x fields and using line-advance, which is not ideal. As far as
>>using something like smg$m_blink I am unsure how to define this and
>>use it in a COBOL program.
>
> This is a problem with the language. AFAICT, there's no equivalents
> for the other languages' ways to include files containing predefined
> constants which is what SMG$M_BLINK would be.

Yep. In Fortran for example, one can do

include '($smgdef)'

and here's a couple of bits of the listing

Command: FORTRAM TEST1 /LIST /SHOW=INCLUDE (the default is that INCLUDEd stuff
is omitted from the listing)

00007 include '($smgdef)'
00008 1 !*** MODULE $SMGDEF ***
00009 1 CDEC$ OPTIONS /NOALIGN
00010 1 ! Definitions for RTL Screen Management Facility
00011 1 !
00012 1 ! Input terminator codes
00013 1 !
00014 1 PARAMETER SMG$K_TRM_NULL_CHAR = '00000000'X ! NUL
00015 1 PARAMETER SMG$K_TRM_CTRLA = '00000001'X ! SOH

...

00552 1 ! The following defines bits used with the FLAGS parameter for
00553 1 ! SMG$READ_xxxx.
00554 1 !
00555 1 PARAMETER SMG$M_FUNC_KEYS = '00000001'X
00556 1 PARAMETER SMG$M_NOKEEP = '00000002'X
00557 1 PARAMETER SMG$M_NORECALL = '00000004'X
00558 1 PARAMETER SMG$m_spare8 = 'FFFFFFF8'X
00559 1 STRUCTURE /SMG$R_READ_FLAGS/
00560 1 PARAMETER SMG$S_FUNC_KEYS = 1
00561 1 PARAMETER SMG$V_FUNC_KEYS = 0 ! Disable line-editting.
00562 1 PARAMETER SMG$S_NOKEEP = 1
00563 1 PARAMETER SMG$V_NOKEEP = 1 ! Don't save input in recall buffer
00564 1 PARAMETER SMG$S_NORECALL = 1
00565 1 PARAMETER SMG$V_NORECALL = 2 ! Disable input recall for this call
00566 1 PARAMETER SMG$S_spare8 = 29
00567 1 PARAMETER SMG$V_spare8 = 3
00568 1 BYTE %FILL (4) ! extra bits
00569 1 END STRUCTURE ! SMG$R_READ_FLAGS

etc etc

The example for BASIC contains a clue with the use of a bit of Macro

<http://www.s-and-b.ru/syshlp/vms_html/5935/5935pro_007.html#smgbasic>

! Build this program using the following commands.
!
!$ BASIC READ_KEY
!$ CREATE SMGDEF.MAR
! .TITLE SMGDEF - Define SMG$ constants
! .Ident /1-000/
!
! $SMGDEF GLOBAL
!
! .END
!$ MACRO SMGDEF
!$ LINK READ_KEY,SMGDEF

I have adopted the same approach for COBOL in the past, but of course
you have to define the item lists yourself.

For example, here's the definition I wrote for the Owner field of the UAF

03 uai_owner.
05 uai_owner_len pic 9(4) comp value 32.
05 uai_owner_item pic 9(4) comp
value is external uai$_owner.
05 uai_owner_addr usage is pointer
value is reference uai_owner_buf.
05 uai_owner_lenadr usage is pointer

where the external value of uai$owner is that brought in by assembling
and linking in $UAIDEF.MAR:

; UAIDEF.MAR

$uaidef GLOBAL ; define it as global
.end

Paul Sture

unread,
Jul 6, 2016, 3:38:03 PM7/6/16
to
On 2016-07-06, VAXman- @SendSpamHere.ORG <VAX...@SendSpamHere.ORG> wrote:
> In article <IYGdnSMyi4WPOeHK...@westnet.com.au>, "Paul
> Richards" <paulri...@iinet.net.au> writes:
>>
>>There's also a call to "ots$cvt_l_ti" - I can't find any documentation
>>on this. It may be related to the lexical function f$cvi.
>
> Convert longword to text integer. See: $ HELP RTL OTS OTS$CVT_L_TI

I'd use the numeric editing capabilities of COBOL there instead.

Paul has kindly mailed me the source of his test program.

Where he currently has:

----
01 input-ch pic 9(4) comp.
01 output-messages.
03 input-char pic x(6).

...

* convert the decimal value of input-char to a decimal ascii text string.
call "ots$cvt_l_ti" using
input-ch
by descriptor input-char
----

I've modified that to:

01 input-ch pic 9(4) comp.
01 output-messages.
03 input-char pic z(5)9.

...

move input-ch to input-char.

Stephen Hoffman

unread,
Jul 6, 2016, 4:44:24 PM7/6/16
to
On 2016-07-06 15:02:33 +0000, John Reagan said:

> What Brian was trying to cleverly say is that COBOL doesn't have
> constants. A few COBOL vendors have added them as extensions, but
> COBOL 85 (which is what the OpenVMS COBOL compiler conforms to) does
> not have constants or even record type definitions. That makes is very
> hard to create ANY include file for COBOL for system programming.

COBOL does have CDD/Repository support, FWIW.

I wrote a back-end for SDL for COBOL for a customer, though that was
for the entry point declarations, and didn't go after the constants.

The OpenVMS COBOL implementation is older than more than a few
developers, unfortunately.

Paul Richards

unread,
Jul 6, 2016, 8:59:10 PM7/6/16
to
Stephen: thanks for your comprehensive reply. Regarding your comments
re the appropriateness of character based interfaces, I am a hobbyist
and my interest in this case - being familiar with COBOL's Screen
Section - is in exploring the OpenVMS-specific facilities for screen
display provided by the RTL SMG$ routines. Obviously not very
successfully so far. I assume that previous HP screen design facilities
(DECForms?) are no longer available or, if they were, would not be
available to me as a hobbyist.

Paul Richards

unread,
Jul 6, 2016, 10:36:35 PM7/6/16
to

>
> Convert longword to text integer. See: $ HELP RTL OTS OTS$CVT_L_TI
>
Thanks. I have now found the OTS$ and LIB$ documentation.

Hans Vlems

unread,
Jul 7, 2016, 7:46:57 AM7/7/16
to
IIRC there still are products available like TDMS and FMS.
An alternative may be to write wrapper functions in pascal and call these from cobol.

Stephen Hoffman

unread,
Jul 7, 2016, 10:38:38 AM7/7/16
to
On 2016-07-07 00:59:03 +0000, Paul Richards said:

> Stephen: thanks for your comprehensive reply. Regarding your comments
> re the appropriateness of character based interfaces, I am a hobbyist
> and my interest in this case - being familiar with COBOL's Screen
> Section - is in exploring the OpenVMS-specific facilities for screen
> display provided by the RTL SMG$ routines. Obviously not very
> successfully so far.

You're seemingly imagining what might have been done (but AFAIK usually
wasn't), and by stringing together some comparatively difficult tools.

Folks in COBOL didn't call outside of COBOL all that often, much like
Java now — calling out from COBOL is analogous to going through the
JNI, and both involve writing more than a little glue code.

On OpenVMS, calling most system services from COBOL is tedious, and
requires familiarity with the calling standard. Calling the RTL calls
here is somewhat easier as those calls tend to avoid pointers, but
still tends to require lots of glue code.

SMG was and is one of the more complex APIs in OpenVMS and with one or
two of the calls being my own benchmarks for the most complex calls
available in OpenVMS in any language. SMG unfortunately offers
comparatively limited capabilities, even against contemporary DEC
products. (Some folks have suggested that there were financial reasons
for this delta; that DEC didn't want the integrated screen management
package to more directly compete with the available commercial screen
management packages. IDK. But I digress.)

> I assume that previous HP screen design facilities (DECForms?) are no
> longer available or, if they were, would not be available to me as a
> hobbyist.

Look through the PAKs you received. At least FMS used to be in the
list of screen management packages. TDMS and DECforms are two of the
other packages. VUIT was the X Window System UI package.

As for COBOL, use the language itself for screen management. The
language RTL uses SMG for its screen functions. If you want to
parallel what was usually done.

If you want to learn how OpenVMS itself was implemented with screen
management, that was usually SMG calls made from Bliss, Macro32
assembler (or Macro32 compiler on Alpha or Itanium) or C. COBOL
wasn't used within OpenVMS itself. More than a few user applications
used COBOL, but they were fairly limited around what they called within
OpenVMS itself. Most developers either learned the calling standard,
or they used jackets written in a language that dealt with pointers or
such and called those jackets from COBOL, or they wrote out the
necessary control sequences from their own code, or they kept their
applications in COBOL.

In more recent years, all of this stuff has fallen out of favor in the
wider community, with Qt or GTK+ or other libraries or frameworks being
used where character cell was still required, and with GUI front ends
becoming the standard for most things. As I've repeatedly commented,
the command line and character cell interfaces just aren't the path
forward for end-user user interfaces. (Unfortunately, OpenVMS didn't
have current Qt or GTK+ ports, when last I checked.)

TL;DR: Calling SMG from COBOL is the deep end of the pool. Learn the
calling standard. Unfortunately. that's the only way I know how to do
this, and I don't know of any repositories of anything-to-anything code
samples in general beyond what was mentioned in my earlier reply, nor
particularly much of anything for COBOL on OpenVMS.

David Froble

unread,
Jul 7, 2016, 10:42:40 AM7/7/16
to
And here I thought everyone had downloaded the stuff, long ago.

HP is not to be trusted, unless they are trusted to find every way possible to
mess things up.

I still got the "gray wall" too ....

David Froble

unread,
Jul 7, 2016, 10:55:41 AM7/7/16
to
John Reagan wrote:

> What Brian was trying to cleverly say is that COBOL doesn't have constants.
> A few COBOL vendors have added them as extensions, but COBOL 85 (which is
> what the OpenVMS COBOL compiler conforms to) does not have constants or even
> record type definitions. That makes is very hard to create ANY include file
> for COBOL for system programming.

I've got a friend who gets irritated when I do some of the following:

%Include "$SSDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
%Include "$IODEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
%Include "SYS$SHARE:TCPIP$INETDEF.BAS"

He'll go and find out the declared constant values, and then hard code just
those required in his programs. He actually had reasons, but not valid reasons.
Something about not having the files on every customer system. My heated
reply was to "well then put them there".

:-)

However, the practice does point out that one could build a file with variables
declared and initialized to some value, and then included in a COBOL program.

Definitely not optimum, but could get the job done ....

Paul Sture

unread,
Jul 7, 2016, 12:24:11 PM7/7/16
to
In essence yes, and I did something like that in the late 1980s.
However I got to thinking "What happens if some of these constants
change?" and decided to protect myself from that by using assembler to
define 'em as global variables.

Hey ho... :-)

> Definitely not optimum, but could get the job done ....

The tricky bit now I'm looking at it again will be the data structures
which don't have an equivalent in COBOL. There are ways around that,
but whether it's worth the slog...

VAXman-

unread,
Jul 7, 2016, 1:24:29 PM7/7/16
to
In article <nllqhb$n1s$1...@dont-email.me>, David Froble <da...@tsoft-inc.com> writes:
>John Reagan wrote:
>
>> What Brian was trying to cleverly say is that COBOL doesn't have constants.
>> A few COBOL vendors have added them as extensions, but COBOL 85 (which is
>> what the OpenVMS COBOL compiler conforms to) does not have constants or even
>> record type definitions. That makes is very hard to create ANY include file
>> for COBOL for system programming.
>
>I've got a friend who gets irritated when I do some of the following:
>
> %Include "$SSDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
> %Include "$IODEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
> %Include "SYS$SHARE:TCPIP$INETDEF.BAS"
>
>He'll go and find out the declared constant values, and then hard code just
>those required in his programs. He actually had reasons, but not valid reasons.
> Something about not having the files on every customer system. My heated
>reply was to "well then put them there".
>
>:-)
>
>However, the practice does point out that one could build a file with variables
>declared and initialized to some value, and then included in a COBOL program.
>
>Definitely not optimum, but could get the job done ....

You can do that in COBOL?

IanD

unread,
Jul 7, 2016, 1:50:25 PM7/7/16
to
On Thursday, July 7, 2016 at 1:34:17 AM UTC+10, Stephen Hoffman wrote:

<snip>

> and the folks at VSI didn't have docs posted when
> last I checked.
>

We are approaching the 2 year mark now (only a few weeks ago) and we have had two releases out the door and still VMS has no centralised place from where it can hang it's hat for documentation purposes.

If it's going to take much longer, then why not outsource it say Hoffman labs or http://www.openvms.org/ :-)

Then when VSI give VMS documentation a home, it can be transferred then.

'Something' is better than 'nothing' as all we have now is an array of broken Google links that are getting worse by the day

I lament the day I threw out a VMS doco disk I had acquired many years ago, I never thought I'd be scratching around Google trying to find documentation when I tossed it.

No one minds people being busy but they do mind there being no actual public announcement as to when this sorry state of affairs with documentation will be fixed. Even a ballpark figure might be nice.

abrsvc

unread,
Jul 7, 2016, 1:58:01 PM7/7/16
to
The link below still works for me:

http://h71000.www7.hp.com/doc/tcpip56.html


Select operating system from the left side list and the OpenVMS docs are there. You get redirected to the HPE site for the individual doc.

HTH

Dan

VAXman-

unread,
Jul 7, 2016, 2:09:05 PM7/7/16
to
And that lead me to:

http://www8.hp.com/us/en/products/servers/openvms/documents.html

which I've now bookmarked until it's no longer valid. ;)

Paul Sture

unread,
Jul 7, 2016, 3:42:11 PM7/7/16
to
On 2016-07-07, VAXman- @SendSpamHere.ORG <VAX...@SendSpamHere.ORG> wrote:
> In article <ac10f1f4-edd4-4e96...@googlegroups.com>,
abrsvc <dansabr...@yahoo.com> writes:
>>The link below still works for me:
>>
>>http://h71000.www7.hp.com/doc/tcpip56.html
>>
>>
>>Select operating system from the left side list and the OpenVMS docs
>>are there. You get redirected to the HPE site for the individual doc.
>>
>>HTH
>>
>>Dan
>
> And that lead me to:
>
> http://www8.hp.com/us/en/products/servers/openvms/documents.html
>
> which I've now bookmarked until it's no longer valid. ;)

The documentation zipfiles which were announced roughly a year ago
appear to be still in the same place, with a few additions.

Some VSI manuals have appeared there too. Links here:

<http://openvms.sture.ch/odl_docsets-2016-07-07.html>

David Froble

unread,
Jul 7, 2016, 3:47:04 PM7/7/16
to
How should I know? I avoid COBOL almost as much as C, though, C haunts me more
often.

:-)

Actually, from Jan Erik's post, I guess the COPY command in COBOL will include
an external file. But what do I know?

Paul Richards

unread,
Jul 7, 2016, 9:08:14 PM7/7/16
to
Stephen Hoffman wrote:

> Look through the PAKs you received. At least FMS used to be in the
> list of screen management packages. TDMS and DECforms are two of the
> other packages. VUIT was the X Window System UI package.
>

Well according to my Hobbyist Licence I have a PAK for FMS (but not
TDMS or DECForms). However typing FMS/EDIT gives "%DCL-W-IVVERB,
unrecognized command verb ..." so I guess it was not installed when I
installed OpenVMS.

> TL;DR: Calling SMG from COBOL is the deep end of the pool. Learn the
> calling standard. Unfortunately. that's the only way I know how to
> do this, and I don't know of any repositories of anything-to-anything
> code samples in general beyond what was mentioned in my earlier
> reply, nor particularly much of anything for COBOL on OpenVMS.

I now realise that, given yours and others' comments!

As I said, I am a hobbyist. I can write Micro Focus COBOL on Windows
PCs and use the Screen Section whenever I want. The fascination for me
with 'legacy' OSs is using the 'native' facilities. COBOL and SMG$
clearly are not a good fit. I have done some programming in Borland
Pascal so I might try PASCAL and SMG$.

Thanks for your comments.

John Reagan

unread,
Jul 7, 2016, 9:47:04 PM7/7/16
to
On Thursday, July 7, 2016 at 9:08:14 PM UTC-4, Paul Richards wrote:
> Stephen Hoffman wrote:
>
> > Look through the PAKs you received. At least FMS used to be in the
> > list of screen management packages. TDMS and DECforms are two of the
> > other packages. VUIT was the X Window System UI package.
> >
>
> Well according to my Hobbyist Licence I have a PAK for FMS (but not
> TDMS or DECForms). However typing FMS/EDIT gives "%DCL-W-IVVERB,
> unrecognized command verb ..." so I guess it was not installed when I
> installed OpenVMS.
>
> > TL;DR: Calling SMG from COBOL is the deep end of the pool. Learn the
> > calling standard. Unfortunately. that's the only way I know how to
> > do this, and I don't know of any repositories of anything-to-anything
> > code samples in general beyond what was mentioned in my earlier
> > reply, nor particularly much of anything for COBOL on OpenVMS.
>
> I now realise that, given yours and others' comments!
>
> As I said, I am a hobbyist. I can write Micro Focus COBOL on Windows
> PCs and use the Screen Section whenever I want. The fascination for me
> with 'legacy' OSs is using the 'native' facilities. COBOL and SMG$
> clearly are not a good fit. I have done some programming in Borland
> Pascal so I might try PASCAL and SMG$.
>

OpenVMS COBOL has a SCREEN SECTION. Check the docset.

You can easily use Pascal with SMG$.

I'm happy to help with either.

Paul Richards

unread,
Jul 7, 2016, 10:41:12 PM7/7/16
to
John: I know that OpenVMS COBOL has a Screen Section - I have used it.
I wanted to explore other screen/form building avenues. As I said,
COBOL and SMG$ don't seem to be a good fit - although it's ironic that
HP COBOL's screen handling facilities are based on SMG$.

Thanks for the offer re Pascal and SMG$. I'll see how I go.

Jan-Erik Soderholm

unread,
Jul 8, 2016, 8:39:36 AM7/8/16
to
Yes, COPY does what %Include does.

I think the Cobol syntax is a bit cleaner also:

COPY $SDDEF.TXT ! Include a plain text file
COPY $SSDEF IN SYS$LIBRARY:COB$STARLET.TLB ! Include a member in a TLB.
COPY <record-name> FROM DICTIONARY ! Include from the CDD.

The issue is of course that COB$STARLET.TLB doesn't exist... :-)




VAXman-

unread,
Jul 8, 2016, 9:35:16 AM7/8/16
to
In article <nlo6u5$5ge$1...@news.albasani.net>, Jan-Erik Soderholm <jan-erik....@telia.com> writes:
>Den 2016-07-07 kl. 21:47, skrev David Froble:
>> VAXman- @SendSpamHere.ORG wrote:
>>> In article <nllqhb$n1s$1...@dont-email.me>, David Froble
>>> <da...@tsoft-inc.com> writes:
>>>> John Reagan wrote:
>>>>
>>>>> What Brian was trying to cleverly say is that COBOL doesn't have
>>>>> constants.
>>>>> A few COBOL vendors have added them as extensions, but COBOL 85 (which is
>>>>> what the OpenVMS COBOL compiler conforms to) does not have constants or
>>>>> even
>>>>> record type definitions. That makes is very hard to create ANY include
>>>>> file
>>>>> for COBOL for system programming.
>>>> I've got a friend who gets irritated when I do some of the following:
>>>>
>>>> %Include "$SSDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
>>>> %Include "$IODEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
>>>> %Include "SYS$SHARE:TCPIP$INETDEF.BAS"

-------------^^^^^^^^^ THE ABOVE IS BASIC (LANGUAGE) SYNTAX ^^^^^^^^^^^^^^^^

The discussion is/was about COBOL!!!




>>>>
>>>> He'll go and find out the declared constant values, and then hard code
>>>> just those required in his programs. He actually had reasons, but not
>>>> valid reasons. Something about not having the files on every customer
>>>> system. My heated reply was to "well then put them there".
>>>>
>>>> :-)
>>>>
>>>> However, the practice does point out that one could build a file with
>>>> variables declared and initialized to some value, and then included in a
>>>> COBOL program.
>>>>
>>>> Definitely not optimum, but could get the job done ....
>>>
>>> You can do that in COBOL?
>>>
>>
>> How should I know? I avoid COBOL almost as much as C, though, C haunts me
>> more often.
>>
>> :-)
>>
>> Actually, from Jan Erik's post, I guess the COPY command in COBOL will
>> include an external file. But what do I know?
>
>Yes, COPY does what %Include does.
>
>I think the Cobol syntax is a bit cleaner also:
>
>COPY $SDDEF.TXT ! Include a plain text file
>COPY $SSDEF IN SYS$LIBRARY:COB$STARLET.TLB ! Include a member in a TLB.
>COPY <record-name> FROM DICTIONARY ! Include from the CDD.
>
>The issue is of course that COB$STARLET.TLB doesn't exist... :-)

https://miscellany101.files.wordpress.com/2011/11/nail.jpg

John Reagan

unread,
Jul 8, 2016, 9:38:59 AM7/8/16
to
Why would you find that ironic? I'm sure MF COBOL on Linux uses curses or termcap under the hood. You'd have a heck of a time calling them directly from MF COBOL.

David Froble

unread,
Jul 8, 2016, 11:34:51 AM7/8/16
to
VAXman- @SendSpamHere.ORG wrote:

>>>>> %Include "$SSDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
>>>>> %Include "$IODEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
>>>>> %Include "SYS$SHARE:TCPIP$INETDEF.BAS"
>
> -------------^^^^^^^^^ THE ABOVE IS BASIC (LANGUAGE) SYNTAX ^^^^^^^^^^^^^^^^
>
> The discussion is/was about COBOL!!!

The discussion was/is about including constants in a COBOL program, which uses
the COPY command there. All I did was show an example of including external
stuff, but not for COBOL. I did it to discuss custom external file(s).

Paul Sture

unread,
Jul 8, 2016, 11:43:38 AM7/8/16
to
$ libr/create SYS$LIBRARY:COB$STARLET.TLB

It does now.

Granted, it's empty at the moment :-)

VAXman-

unread,
Jul 8, 2016, 11:50:14 AM7/8/16
to
In article <nloh6o$beb$1...@dont-email.me>, David Froble <da...@tsoft-inc.com> writes:
>VAXman- @SendSpamHere.ORG wrote:
>
>>>>>> %Include "$SSDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
>>>>>> %Include "$IODEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB"
>>>>>> %Include "SYS$SHARE:TCPIP$INETDEF.BAS"
>>
>> -------------^^^^^^^^^ THE ABOVE IS BASIC (LANGUAGE) SYNTAX ^^^^^^^^^^^^^^^^
>>
>> The discussion is/was about COBOL!!!
>
>The discussion was/is about including constants in a COBOL program, which uses
>the COPY command there. All I did was show an example of including external
>stuff, but not for COBOL. I did it to discuss custom external file(s).

;)

I realised that but things seemed to drift into brackish waters.

Stephen Hoffman

unread,
Jul 8, 2016, 12:22:51 PM7/8/16
to
On 2016-07-08 01:08:07 +0000, Paul Richards said:

> Stephen Hoffman wrote:
>
>> Look through the PAKs you received. At least FMS used to be in the
>> list of screen management packages. TDMS and DECforms are two of the
>> other packages. VUIT was the X Window System UI package.
>
> Well according to my Hobbyist Licence I have a PAK for FMS (but not
> TDMS or DECForms). However typing FMS/EDIT gives "%DCL-W-IVVERB,
> unrecognized command verb ..." so I guess it was not installed when I
> installed OpenVMS.

FMS is — like most parts of OpenVMS — a "layered product" (add-on, and
usually separately installed), though a few products are
"system-integrated products (SIPs, installed as part of OpenVMS itself,
but separately licensed).

Here? You're going to want to see the FMS documentation. You are
likely going to get nowhere by just trying stuff without becoming
familiar with the documentation. Other than confused and frustrated.
OpenVMS itself and the command line in general is the deep end of the
pool. Short of training classes or preternatural skills with arcane
software platforms, the OpenVMS and layered product documentation is
the only path forward with learning and using OpenVMS. Unfortunately.
Most of the layered products have an installation manual, a reference
manual and a user guide. Sometimes the three are combined.

I really despise the OpenVMS documentation. Yes, it's good, in terms
of its content and detail and its consistency, but the navigation and
document design and HELP tools and the lack of task guides and sample
programs and the rest are just ancient, and the investment to read the
necessary manuals is not a small one.

>> TL;DR: Calling SMG from COBOL is the deep end of the pool. Learn the
>> calling standard. Unfortunately. that's the only way I know how to do
>> this, and I don't know of any repositories of anything-to-anything code
>> samples in general beyond what was mentioned in my earlier reply, nor
>> particularly much of anything for COBOL on OpenVMS.
>
> I now realise that, given yours and others' comments!
>
> As I said, I am a hobbyist. I can write Micro Focus COBOL on Windows
> PCs and use the Screen Section whenever I want. The fascination for me
> with 'legacy' OSs is using the 'native' facilities. COBOL and SMG$
> clearly are not a good fit. I have done some programming in Borland
> Pascal so I might try PASCAL and SMG$.

Which will be of little or no service with learning OpenVMS and its
implementation and APIs, unfortunately. More than a few folks have
tried to apply knowledge of Windows or Unix to OpenVMS, and have gotten
confused. OpenVMS is... different. The manuals are the path
forward for most OpenVMS questions — frustratingly, and there are no
IDEs and no tools that provide code examples or other resources, and
there are no short or task guides. It's a wall of reading, and with
few (no) cross-references or other sorts of navigation. Which means
that if the answer to your questions or confusions are not in the
manuals (somewhere), not previously in the comp.os.vms newsgroup
archives (with OpenVMS, most questions have been asked already), not on
the Freeware distros or the old DECUS distros or the ancient OpenVMS
FAQ, or discussed in topics posted on the few active OpenVMS web sites
or forums or maybe on the decuserve.org site, or in SYS$EXAMPLES (and
some of what's in the examples areas for OpenVMS and the layered
products can be old or crufty source code), then whatever you're
wondering about probably either doesn't exist or is an unusual
configuration or it's a very new bug you've found (unlikely), or you're
going to end up discussing this with either VSI or HPE or somebody that
specializes in the arcana.

Paul Richards

unread,
Jul 8, 2016, 8:41:23 PM7/8/16
to
I've never used MF COBOL on Linux.

Paul Richards

unread,
Jul 8, 2016, 8:54:36 PM7/8/16
to
Well, I've downloaded all the FMS PDFs. Now I just need the product.
I've got two LP disks but, looking at their directories, I can't see
anything that looks like FMS.

I hear what you say about Pascal.

Thanks.

Kerry Main

unread,
Jul 8, 2016, 9:20:13 PM7/8/16
to comp.os.vms to email gateway
> -----Original Message-----
> From: Info-vax [mailto:info-vax...@rbnsn.com] On Behalf Of Paul
> Richards via Info-vax
> Sent: 08-Jul-16 8:54 PM
> To: info...@rbnsn.com
> Cc: Paul Richards <paulri...@iinet.net.au>
> Subject: Re: [Info-vax] Using RTL SMG$ routines
>
[snip]

>
> Well, I've downloaded all the FMS PDFs. Now I just need the product.
> I've got two LP disks but, looking at their directories, I can't see
> anything that looks like FMS.
>
> I hear what you say about Pascal.
>
> Thanks.
>

See online LP directory: DECFDV025

Online index:
http://h30266.www3.hpe.com/masterindex/final_spl_vmsaxp_q316/final_spl_vmsaxp_q316.shtml

FMS Directory
http://h30266.www3.hpe.com/masterindex/final_spl_vmsaxp_q316/SPLVAQ316_MVTAA_2_5_SSB.shtml

Paul Richards

unread,
Jul 8, 2016, 10:18:59 PM7/8/16
to
Kerry: thanks. I wasn't aware of that site. However I need a user name
and password to download the relevant files.

Paul Sture

unread,
Jul 9, 2016, 3:52:14 AM7/9/16
to
On 2016-07-06, John Reagan <xyzz...@gmail.com> wrote:
> On Wednesday, July 6, 2016 at 10:06:17 AM UTC-4, Jan-Erik Soderholm wrote:
>>
>> COPY in Cobol is the way "to include files containing predefined
>> constants" which was what you asked for.
>>
>> You need to have some file to COPY also, of course...
>>
>> Maybe you ment some specific file with some specific constants.
>
> What Brian was trying to cleverly say is that COBOL doesn't have
> constants. A few COBOL vendors have added them as extensions, but
> COBOL 85 (which is what the OpenVMS COBOL compiler conforms to) does
> not have constants or even record type definitions. That makes is
> very hard to create ANY include file for COBOL for system programming.

The plot thickens.

I've just discovered that the SMG$_ (and other RTL subsystem) constants
are available from VAX (V7.3) and Alpha (V8.3) COBOL as global
variables, without needing the equivalent of a FORTRAN

include '($smgdef)'

or creating and compiling smgdef.mar, and including it at link time, as
per the BASIC example from the documentation here:

<http://www.s-and-b.ru/syshlp/vms_html/5935/5935pro_007.html#smgbasic>

Instead, it's as easy as this:

01 smg$_wronumarg pic s9(9) comp
value external smg$_wronumarg.

The COBOL sources I have from the V6.2 / V7.1 era indicate that these had to
be included by other means. Not now.

Sanity check for the correct value:

display "smg$_wronumarg = " smg$_wronumarg with conversion.

results in:

smg$_wronumarg = 1212996

$ search basicstarlet.bas smg$_wronumarg
DECLARE LONG CONSTANT SMG$_WRONUMARG = 1212996

and

$ search FORSYSDEF.FOR smg$_wronumarg
PARAMETER SMG$_WRONUMARG = '00128244'X
$ d = %x00128244
$ sh sym d
D = 1212996 Hex = 00128244 Octal = 00004501104

With COBOL you still have to create your own itemlist definitions
where needed.

John Reagan

unread,
Jul 9, 2016, 8:13:09 AM7/9/16
to
On Saturday, July 9, 2016 at 3:52:14 AM UTC-4, Paul Sture wrote:
Using external symbol values was already discussed. The downside for COBOL is that you end up with allocated storage for EVERY symbol you create. That is why we would not create a COPY file with ALL symbols ... every program that needs just one would end up with thousands of bytes of extra storage and thousands of extra linker relocations.

Kerry Main

unread,
Jul 9, 2016, 12:25:06 PM7/9/16
to comp.os.vms to email gateway
The kits for FMS are likely the same (V2.5) as the version you have on
the LP disks you already have. The disks you have should have the
DECFDV025 directory.

Paul Sture

unread,
Jul 9, 2016, 1:36:36 PM7/9/16
to
> Using external symbol values was already discussed. The downside for
> COBOL is that you end up with allocated storage for EVERY symbol you
> create. That is why we would not create a COPY file with ALL symbols
> ... every program that needs just one would end up with thousands of
> bytes of extra storage and thousands of extra linker relocations.

What I am saying is that because the variables are already available to
COBOL as globals, there's a relatively painless way to incorporate only
those which are required for the program you are developing.

--
When you have eliminated the JavaScript, whatever remains must be an
empty page. Enable JavaScript to see Google Maps. -- Google Maps

Uh? -- me

Paul Sture

unread,
Jul 9, 2016, 2:03:54 PM7/9/16
to
That last paragraph applies to the SMG$ constants. For SYSUAF access
from COBOL via sys$getuai for example, you still need to get the UAI$
variable definitions in by e.g. assembling

; UAIDEF.MAR

$uaidef GLOBAL ; define it as global
.end

and linking against that.

VAXman-

unread,
Jul 9, 2016, 4:28:17 PM7/9/16
to
In article <72n65d-...@news.chingola.ch>, Paul Sture <nos...@sture.ch> writes:
The only reason that works is because DEC$COBRTL calls out SMGSHR in its list
of shareable images:

Shareable Image List

0) "LIBRTL"
1) "DECC$SHR"
2) "DPML$SHR"
3) "LIBOTS"
4) "LIBOTS2"
5) "SMGSHR"
6) "SYS$PUBLIC_VECTORS"

Paul Sture

unread,
Jul 9, 2016, 4:33:42 PM7/9/16
to
Got it thanks.

VAXman-

unread,
Jul 9, 2016, 5:26:40 PM7/9/16
to
In article <il385d-...@news.chingola.ch>, Paul Sture <nos...@sture.ch> writes:
>On 2016-07-09, VAXman- @SendSpamHere.ORG <VAX...@SendSpamHere.ORG> wrote:
>Got it thanks.
>
>--
>When you have eliminated the JavaScript, whatever remains must be an
>empty page. Enable JavaScript to see Google Maps. -- Google Maps
>
>Uh? -- me

On second look, no it's not. It's because of linking against STARLET.OLB.
I was able to define some the the SMG$K_TRM_* constants too and those are
found in SMG$SMGDEF in STARLET.OLB. You can probably create synbols for a
great many of the RTL constants because of this. OK. I've now done more
COBOL than a care to. FWIW, it's installed on Eisner.

hb

unread,
Jul 9, 2016, 7:33:03 PM7/9/16
to
On 07/09/2016 10:28 PM, VAX...@SendSpamHere.ORG wrote:

> The only reason that works is because DEC$COBRTL calls out SMGSHR in its list
> of shareable images:
>
> Shareable Image List
>
> 0) "LIBRTL"
> 1) "DECC$SHR"
> 2) "DPML$SHR"
> 3) "LIBOTS"
> 4) "LIBOTS2"
> 5) "SMGSHR"
> 6) "SYS$PUBLIC_VECTORS"
>
Those were the VAX days, when the linker implicitly processed the
shareable images from that list, too.

Paul Richards

unread,
Jul 10, 2016, 1:55:51 AM7/10/16
to
Kerry: I can't see that directory. Here's a DIR listing of both LP
disks I have:

Directory DKA0:[000000]

000000.DIR;1 ANT_ALPHA0107.DIR;1 AVAILMAN_ALPHA031.DIR;1
BACKUP.SYS;1 BADBLK.SYS;1 BADLOG.SYS;1 BITMAP.SYS;1
CONTIN.SYS;1 CORIMG.SYS;1 DCPS_ALPHA027.DIR;1
DEBUG_CLIENTS011.DIR;1 DECDFS_024B.DIR;1
ENTERPRISE_DIR_ALPHA056.DIR;1 INDEXF.SYS;1
SECURITY.SYS;1
VOLSET.SYS;1

Directory DKA0:[000000]

000000.DIR;1 AXIS2_ALPHA010.DIR;1 BACKUP.SYS;1
BADBLK.SYS;1 BADLOG.SYS;1 BITMAP.SYS;1 CONTIN.SYS;1
CORIMG.SYS;1 INDEXF.SYS;1 JAVA_ALPHA015.DIR;1
OVPA_ALPHA040.DIR;1
RAID_030B_ALPHA.DIR;1 SECURITY.SYS;1
VMSI18N_ALPHA084.DIR;1 VOLSET.SYS;1
WSIT_ALPHA030.DIR;1

VAXman-

unread,
Jul 10, 2016, 8:17:22 AM7/10/16
to
In article <nls1ja$bvi$1...@gioia.aioe.org>, hb <end...@inter.net> writes:
>On 07/09/2016 10:28 PM, VAX...@SendSpamHere.ORG wrote:
>
>> The only reason that works is because DEC$COBRTL calls out SMGSHR in its list
>> of shareable images:
>>
>> Shareable Image List
>>
>> 0) "LIBRTL"
>> 1) "DECC$SHR"
>> 2) "DPML$SHR"
>> 3) "LIBOTS"
>> 4) "LIBOTS2"
>> 5) "SMGSHR"
>> 6) "SYS$PUBLIC_VECTORS"
>>
>Those were the VAX days, when the linker implicitly processed the
>shareable images from that list, too.

Yeah, I amended my post. It's the EXTERNAL getting resolved from STARLET.OLB
when linked. In which case, there are many symbols COBOL can/could reference
in excess of SMG error codes and constants. But, as, I believe, John pointed
out, they wouldn't want to include (COPY) definitions for everything because
it'll allocate storage for symbols that could very likely never be referenced.

hb

unread,
Jul 10, 2016, 12:05:01 PM7/10/16
to
On 07/10/2016 02:17 PM, VAX...@SendSpamHere.ORG wrote:
> In article <nls1ja$bvi$1...@gioia.aioe.org>, hb <end...@inter.net> writes:
>> On 07/09/2016 10:28 PM, VAX...@SendSpamHere.ORG wrote:
>>
>>> The only reason that works is because DEC$COBRTL calls out SMGSHR in its list
>>> of shareable images:
>>>
>>> Shareable Image List
>>>
>>> 0) "LIBRTL"
>>> 1) "DECC$SHR"
>>> 2) "DPML$SHR"
>>> 3) "LIBOTS"
>>> 4) "LIBOTS2"
>>> 5) "SMGSHR"
>>> 6) "SYS$PUBLIC_VECTORS"
>>>
>> Those were the VAX days, when the linker implicitly processed the
>> shareable images from that list, too.
>
> Yeah, I amended my post. It's the EXTERNAL getting resolved from STARLET.OLB
> when linked. In which case, there are many symbols COBOL can/could reference
> in excess of SMG error codes and constants. But, as, I believe, John pointed
> out, they wouldn't want to include (COPY) definitions for everything because
> it'll allocate storage for symbols that could very likely never be referenced.
>

So I need to amend my post, too. I pointed out - or wanted to point out-
that linking on VAX against shareable images is different from that on
Alpha and I64. Which means it would have worked on VAX if there was a
shareable which itself was linked against another shareable which
defined the wanted symbol: processing shareable images was kind of
recursive. And yes, I known, DEC$COBRTL is an Alpha image and COBRTL on
VAX isn't linked against SMGSHR - no matter whether the latter defines
constant symbols like smg$_wronumarg or not.

Stephen Hoffman

unread,
Jul 10, 2016, 12:10:21 PM7/10/16
to
On 2016-07-10 12:17:20 +0000, VAXman- @SendSpamHere.ORG said:

> But, as, I believe, John pointed out, they wouldn't want to include
> (COPY) definitions for everything because it'll allocate storage for
> symbols that could very likely never be referenced.

Yeah; but now imagine a compiler and/or a linker that conspire to
detect and prevent that happening.

Paul Sture

unread,
Jul 10, 2016, 2:38:57 PM7/10/16
to
On 2016-07-09, VAXman- @SendSpamHere.ORG <VAX...@SendSpamHere.ORG> wrote:
> In article <il385d-...@news.chingola.ch>, Paul Sture <nos...@sture.ch> writes:
>>>
>>> The only reason that works is because DEC$COBRTL calls out SMGSHR in its list
>>> of shareable images:
>>>
>>> Shareable Image List
>>>
>>> 0) "LIBRTL"
>>> 1) "DECC$SHR"
>>> 2) "DPML$SHR"
>>> 3) "LIBOTS"
>>> 4) "LIBOTS2"
>>> 5) "SMGSHR"
>>> 6) "SYS$PUBLIC_VECTORS"
>>
>>Got it thanks.
>>
> On second look, no it's not. It's because of linking against STARLET.OLB.
> I was able to define some the the SMG$K_TRM_* constants too and those are
> found in SMG$SMGDEF in STARLET.OLB.

Yes, I'm seeing that now. It appears that if I omit all references to SMG,
including anything likely to call SMG in the resulting program, SMG$SMGDEF
doesn't come in at all.

> You can probably create synbols for a great many of the RTL constants
> because of this. OK. I've now done more COBOL than a care to.

Yes, RMS$_FNF, RMS$_RNF, SS$_ABORT, SS$_NORMAL come in by similar routes.

> FWIW, it's installed on Eisner.

Ayup. I been using EISNER to as a sanity check against what I'm seeing on
VAX/SimH.

Paul Sture

unread,
Jul 10, 2016, 3:04:21 PM7/10/16
to
On 2016-07-10, Stephen Hoffman <seao...@hoffmanlabs.invalid> wrote:
> On 2016-07-10 12:17:20 +0000, VAXman- @SendSpamHere.ORG said:
>
>> But, as, I believe, John pointed out, they wouldn't want to include
>> (COPY) definitions for everything because it'll allocate storage for
>> symbols that could very likely never be referenced.
>
> Yeah; but now imagine a compiler and/or a linker that conspire to
> detect and prevent that happening.

COBOL is quite good[1] at optimising out variables that are unreferenced
(e.g. stuff that would otherwise end up in $LOCAL), but it leaves those
defined as "value external..." in place.

[1] sometimes "too good" if what you are trying to do is pad stuff out
to the next page boundary, but that's another discussion.

mah...@googlemail.com

unread,
Jul 24, 2016, 1:41:35 AM7/24/16
to
Sorry it took so long. It took forever to get a new PAK list and then I struggle with all the commands these days :-(

In a nutshell FMS is by far the best Character-cell screen handler available for VMS! DECForms heralded the demise of Digital.

I will reply with a couple of examples that might help.

For the rest of you who think you know COBOL and what it "can't" do - SHUT UP!

Cheers Richard Maher

mah...@googlemail.com

unread,
Jul 24, 2016, 1:44:36 AM7/24/16
to
identification division.
program-id. pull_down_menu.
data division.
working-storage section.
01 array_desc.
03 element_len pic 9(4) comp value 16.
03 dtype pic x value x"0e".
03 dclass pic x value x"04".
03 data_pointer pointer value reference choices.
03 pic 9(4) comp.
03 flags pic x value low-value.
03 dimct pic x value x"01".
03 total_bytes pic 9(9) comp value 320.
03 element_zero pic 9(9) comp.
03 stride pic 9(9) comp value 20.
03 lwr_b pic 9(9) comp value 1.
03 upr_b pic 9(9) comp value 20.
01 choices.
03 pic x(16) value "one".
03 pic x(16) value "two".
03 pic x(16) value "three".
03 pic x(16) value "four".
03 pic x(16) value "five".
03 pic x(16) value "six".
03 pic x(16) value "seven".
03 pic x(16) value "eight".
03 pic x(16) value "nine".
03 pic x(16) value "ten".
03 pic x(16) value "eleven".
03 pic x(16) value "twelve".
03 pic x(16) value "thirteen".
03 pic x(16) value "fourteen".
03 pic x(16) value "fifteen".
03 pic x(16) value "sixteen".
03 pic x(16) value "seventeen".
03 pic x(16) value "eighteen".
03 pic x(16) value "nineteen".
03 pic x(16) value "twenty".
*
01 tm_desc.
03 pic 9(9) comp value 32.
03 pointer value reference terminator_mask.
01 terminator_mask.
03 pic 9(9) comp occurs 8.
*+
* COBOL is a bit untidy when it comes to byte data
*_
01 cvt_num pic 9(4) comp.
01 cvt_char redefines cvt_num.
03 active_byte pic x.
03 pic x.
*_
01 pasteboard_id pic 9(9) comp.
01 keyboard_id pic 9(9) comp.
01 menu_display pic 9(9) comp.
01 screen_display pic 9(9) comp.
01 row_cnt pic 9(9) comp.
01 col_cnt pic 9(9) comp.
01 menu_rows pic 9(9) comp.
01 menu_cols pic 9(9) comp.
01 option pic 9(4) comp.
01 option_string pic x(16).
01 default_choice pic 9(4) comp value 15.
01 terminator pic 9(4) comp.
01 sys_status pic 9(9) comp.
01 ss$_normal pic 9(9) comp value external ss$_normal.
01 lib$_strtru pic 9(9) comp value external lib$_strtru.
01 smg$_eof pic 9(9) comp value external smg$_eof.
01 smg$_invarg pic 9(9) comp value external smg$_invarg.
01 smg$m_keep_contents pic 9(9) comp value external smg$m_keep_contents.
01 smg$m_remove_item pic 9(9) comp value external smg$m_return_immed.
01 smg$m_bold pic 9(9) comp value external smg$m_bold.
01 smg$m_reverse pic 9(9) comp value external smg$m_reverse.
01 smg$m_border pic 9(9) comp value external smg$m_border.
01 smg$m_fixed_format pic 9(9) comp value external smg$m_fixed_format.
01 smg$k_vertical pic 9(9) comp value external smg$k_vertical.
01 smg$m_cursor_on pic 9(9) comp value external smg$m_cursor_on.
01 smg$m_cursor_off pic 9(9) comp value external smg$m_cursor_off.
01 ctrl_key pic x(4).
procedure division.
00.
subtract element_len from data_pointer giving element_zero.
call "smg$create_pasteboard"
using pasteboard_id, omitted, row_cnt,
col_cnt, smg$m_keep_contents
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$create_virtual_keyboard" using keyboard_id giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$create_virtual_display"
using row_cnt, col_cnt, screen_display
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move 1 to row_cnt, col_cnt.
call "smg$paste_virtual_display"
using screen_display, pasteboard_id,
row_cnt, col_cnt
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move 20 to menu_cols.
move 10 to menu_rows.
call "smg$create_virtual_display"
using menu_rows, menu_cols,
menu_display, smg$m_border, smg$m_bold
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$label_border"
using by reference menu_display
by descriptor "selection window"
by value 0, 0
by reference smg$m_reverse, smg$m_bold
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move 2 to menu_rows.
call "smg$create_menu"
using menu_display, array_desc, smg$k_vertical, smg$m_fixed_format, menu_rows
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move 10 to menu_cols.
call "smg$paste_virtual_display"
using menu_display, pasteboard_id,
menu_rows, menu_cols
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$set_cursor_mode" using pasteboard_id, smg$m_cursor_off giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

perform with test after until sys_status not = ss$_normal
call "smg$select_from_menu"
using by reference keyboard_id, menu_display, option,
by reference default_choice, smg$m_remove_item
by value 0, 0
by reference terminator
by descriptor option_string
by reference smg$m_reverse, smg$m_bold
giving sys_status
display "term = " terminator with conversion
end-perform.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
* if sys_status not = smg$_eof and smg$_invarg call "lib$stop" using by value sys_status.

call "smg$set_cursor_mode" using pasteboard_id, smg$m_cursor_on giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$delete_virtual_display" using menu_display giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$delete_virtual_display" using screen_display giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

stop run.

end program pull_down_menu.

mah...@googlemail.com

unread,
Jul 24, 2016, 1:47:00 AM7/24/16
to
identification division.
program-id. emp_client.
author. Richard Maher.
data division.
working-storage section.
01 get_names pointer value external get_names.
01 io$_setmode pic 9(9) comp value external io$_setmode.
01 io$_writevblk pic 9(9) comp value external io$_writevblk.
01 io$_readvblk pic 9(9) comp value external io$_readvblk.
01 io$_access pic 9(9) comp value external io$_access.
01 smg$_eof pic 9(9) comp value external smg$_eof.
01 smg$_notpasted pic 9(9) comp value external smg$_notpasted.
01 smg$m_return_immed pic 9(9) comp value external smg$m_return_immed.
01 smg$m_bold pic 9(9) comp value external smg$m_bold.
01 smg$m_reverse pic 9(9) comp value external smg$m_reverse.
01 smg$m_border pic 9(9) comp value external smg$m_border.
01 smg$m_cursor_on pic 9(9) comp value external smg$m_cursor_on.
01 smg$m_cursor_off pic 9(9) comp value external smg$m_cursor_off.
01 smg$k_trm_ctrlr pic 9(9) comp value external smg$k_trm_ctrlr.
01 smg$k_trm_ctrlw pic 9(9) comp value external smg$k_trm_ctrlw.
01 smg$k_trm_ctrlz pic 9(9) comp value external smg$k_trm_ctrlz.
01 smg$k_trm_space pic 9(9) comp value external smg$k_trm_space.
01 smg$k_trm_delete pic 9(9) comp value external smg$k_trm_delete.
01 smg$k_trm_left pic 9(9) comp value external smg$k_trm_left.
01 smg$k_trm_right pic 9(9) comp value external smg$k_trm_right.
01 smg$k_trm_bs pic 9(9) comp value external smg$k_trm_bs.
01 smg$k_trm_uppercase_a pic 9(9) comp value external smg$k_trm_uppercase_a.
01 smg$k_trm_uppercase_z pic 9(9) comp value external smg$k_trm_uppercase_z.
01 smg$k_trm_lowercase_a pic 9(9) comp value external smg$k_trm_lowercase_a.
01 smg$k_trm_lowercase_z pic 9(9) comp value external smg$k_trm_lowercase_z.
01 smg$k_trm_zero pic 9(9) comp value external smg$k_trm_zero.
01 smg$k_trm_nine pic 9(9) comp value external smg$k_trm_nine.
01 smg$k_trm_percent_sign pic 9(9) comp value external smg$k_trm_percent_sign.
01 smg$k_trm_underline pic 9(9) comp value external smg$k_trm_underline.
01 smg$k_trm_minus pic 9(9) comp value external smg$k_trm_minus.
01 smg$k_trm_enter pic 9(9) comp value external smg$k_trm_enter.
01 smg$k_trm_cr pic 9(9) comp value external smg$k_trm_cr.
01 smg$k_trm_select pic 9(9) comp value external smg$k_trm_select.
01 ss$_abort pic 9(9) comp value external ss$_abort.
01 ss$_reject pic 9(9) comp value external ss$_reject.
01 ss$_nopriv pic 9(9) comp value external ss$_nopriv.
01 ss$_wasset pic 9(9) comp value external ss$_wasset.
01 ss$_wasclr pic 9(9) comp value external ss$_wasclr.
01 ss$_normal pic 9(9) comp value external ss$_normal.
01 sys_status pic 9(9) comp.
*
01 ast_ctx.
03 pasteboard_id pic 9(9) comp.
03 menu_display pic 9(9) comp.
03 running_len pic 9(9) comp.
03 net_chan pic 9(4) comp.
03 pic 9(4) comp.
03 argus_sleeping pic 9(9) comp.
03 ast_iosb.
05 ast_cond_val pic 9(4) comp.
05 ast_byte_count pic 9(4) comp.
05 pic 9(9) comp.
03 running_name pic x(20).
03 reply_buffer pic x(512).
*
01 iosb.
03 cond_val pic 9(4) comp.
03 byte_count pic 9(4) comp.
03 pic 9(9) comp.
*
01 create_socket.
03 pic s9(4) comp value external ucx$c_tcp.
03 pic s9(4) comp value external inet_protyp$c_stream.
*
01 local_sock_desc.
03 pic s9(9) comp value 16.
03 pointer value reference local_addr.
01 local_addr.
03 pic s9(4) comp value external ucx$c_af_inet.
03 local_port_number.
05 low_byte pic x value low-values.
05 high_byte pic x value low-values.
03 pic s9(9) comp value external ucx$c_inaddr_any.
03 pic x(8).
*
01 rem_sock_desc.
03 pic s9(9) comp value 16.
03 pointer value reference rem_addr.
*+
* In this example the JAVA_EMP server is listening on port 3333 at node address 1.2.3.6
* NB: The port number is specified in network byte order.
*-
01 rem_addr.
03 pic s9(4) comp value external ucx$c_af_inet.
03 rem_port_number.
05 low_byte pic x value x"0D".
05 high_byte pic x value x"05".
03 rem_node_addr.
05 pic x value x"01".
05 pic x value x"02".
05 pic x value x"03".
05 pic x value x"06".
03 pic x(8).
*
01 sock_opt_desc.
03 sock_opt_len pic s9(4) comp value 24.
03 pic s9(4) comp value external ucx$c_sockopt.
03 pointer value reference sock_opt.
01 sock_opt.
03 pic s9(4) comp value 4.
03 pic s9(4) comp value external ucx$c_reuseaddr.
03 pointer value reference opt_on.
03 pic s9(4) comp value 4.
03 pic s9(4) comp value external ucx$c_full_duplex_close.
03 pointer value reference opt_on.
03 pic s9(4) comp value 4.
03 pic s9(4) comp value external ucx$c_keepalive.
03 pointer value reference opt_on.
*
01 tcp_opt_desc.
03 pic s9(4) comp value 8.
03 pic s9(4) comp value external ucx$c_tcpopt.
03 pointer value reference tcp_opt.
01 tcp_opt.
03 pic s9(4) comp value 4.
03 pic s9(4) comp value external ucx$c_tcp_probe_idle.
03 pointer value reference connect_timeout.
*
01 opt_on pic s9(9) comp value 1.
01 opt_off pic s9(9) comp value 0.
01 connect_timeout pic s9(9) comp value 10.
*
01 user_exit pic x value "N".
*
01 menu_desc external.
03 cell_size pic 9(4) comp.
03 dtype pic x(1).
03 dclass pic x(1).
03 base_addr pointer.
03 pic 9(4) comp.
03 flags pic x(1).
03 dimct pic x(1).
03 bytes_allocated pic 9(9) comp.
03 element_zero pic 9(9) comp.
03 stride pic 9(9) comp.
03 lwr_b pic 9(9) comp.
03 line_count pic 9(9) comp.
*
01 out_len pic 9(4) comp.
01 keyboard_id pic 9(9) comp.
01 screen_display pic 9(9) comp.
01 row_cnt pic 9(9) comp.
01 col_cnt pic 9(9) comp.
01 menu_rows pic 9(9) comp.
01 menu_cols pic 9(9) comp.
01 option pic 9(4) comp.
01 option_string pic x(20).
01 terminator pic 9(4) comp.
01 in_byte redefines
terminator pic x(1).
*
01 eof_msg.
03 pic x(2) value "99".
03 pic x(2) value x"0d0a".
*
procedure division.
kick_off section.
00.
perform socket_and_connect.
if sys_status not = ss$_normal go to fini.

perform screen_setup.
if sys_status not = ss$_normal go to fini.

perform get_input until user_exit not = "N" or sys_status not = ss$_normal.
if sys_status not = ss$_normal go to fini.

if user_exit = "S" perform employee_lookup.
if sys_status not = ss$_normal go to fini.

perform socket_close.
*
fini.
call "smg$set_cursor_mode" using pasteboard_id, smg$m_cursor_on.

if argus_sleeping not = zeros
call "sys$waitfr" using by value argus_sleeping.

call "smg$unpaste_virtual_display" using menu_display, pasteboard_id.
call "sys$exit" using by value sys_status.
*
get_input section.
00.
call "smg$read_keystroke" using keyboard_id, terminator giving sys_status.
if sys_status = smg$_eof
move ss$_normal to sys_status
move "Y" to user_exit
go to fini
else
if sys_status not = ss$_normal
call "lib$stop" using by value sys_status.

evaluate terminator
when smg$k_trm_ctrlz move "Y" to user_exit
go to fini
when smg$k_trm_delete
when smg$k_trm_left
when smg$k_trm_bs perform delete_char
when smg$k_trm_right move smg$k_trm_space to terminator
perform insert_char
when smg$k_trm_uppercase_a thru
smg$k_trm_uppercase_z perform insert_char
when smg$k_trm_lowercase_a thru
smg$k_trm_lowercase_z perform insert_char
when smg$k_trm_percent_sign
when smg$k_trm_underline
when smg$k_trm_space
when smg$k_trm_minus perform insert_char
when smg$k_trm_zero thru
smg$k_trm_nine perform insert_char
when smg$k_trm_enter
when smg$k_trm_cr move "S" to user_exit
go to fini
when smg$k_trm_select perform menu_choice
when smg$k_trm_ctrlr
when smg$k_trm_ctrlw call "smg$repaint_screen" using pasteboard_id
when other call "smg$ring_bell" using screen_display
end-evaluate

go to fini.
*
delete_char.
if running_len = zeros
call "smg$ring_bell" using screen_display
else
move space to running_name(running_len:1)
subtract 1 from running_len
perform repaint_name.
*
insert_char.
if running_len = 20
call "smg$ring_bell" using screen_display
else
add 1 to running_len
move in_byte to running_name(running_len:1)
perform repaint_name.
*
repaint_name.
move 1 to row_cnt.
move 38 to col_cnt.
call "smg$put_chars"
using by reference screen_display
by descriptor running_name
by reference row_cnt, col_cnt, omitted, smg$m_reverse
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "sys$dclast"
using by value get_names
by reference ast_ctx
by value 0
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
fini.
*
menu_choice section.
00.
*+
* Wait for array quiet-point
*-
call "sys$waitfr" using by value argus_sleeping giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

if line_count = zeros
call "smg$ring_bell" using screen_display
go to fini.

move spaces to option_string.
call "smg$select_from_menu"
using by reference keyboard_id, menu_display, option,
by value 0
by reference smg$m_return_immed
by value 0, 0
by reference terminator
by descriptor option_string
by reference smg$m_reverse, smg$m_bold
giving sys_status
if sys_status not = ss$_normal and smg$_eof
call "lib$stop" using by value sys_status.

if sys_status = smg$_eof move "Y" to user_exit.

call "smg$unpaste_virtual_display" using menu_display, pasteboard_id giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

if user_exit = "Y" go to fini.

call "str$trim"
using by descriptor running_name, option_string
by reference running_len
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move 1 to row_cnt.
move 38 to col_cnt.
call "smg$put_chars"
using by reference screen_display
by descriptor running_name
by reference row_cnt, col_cnt, omitted, smg$m_reverse
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
fini.
*
socket_and_connect section.
00.
call "sys$assign"
using by descriptor "_BG:"
by reference net_chan
by value 0, 0, 0
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
call "sys$qiow"
using by value 0, net_chan, io$_setmode
by reference iosb
by value 0, 0
by reference create_socket, omitted, local_sock_desc
by value 0
by reference sock_opt_desc
by value 0
giving sys_status.
if sys_status = ss$_normal move cond_val to sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*+
* Set the connect timeout to 10 secs. TCPWARE requires privilege to do this.
*-
call "sys$qiow"
using by value 0, net_chan, io$_setmode
by reference iosb
by value 0, 0, 0, 0, 0, 0
by reference tcp_opt_desc
by value 0
giving sys_status.
if sys_status = ss$_normal move cond_val to sys_status.
if sys_status not = ss$_normal and ss$_nopriv
call "lib$stop" using by value sys_status.
*+
* Request a logical link connection to the Java_Emp server.
*-
call "sys$qiow"
using by value 0, net_chan, io$_access
by reference iosb
by value 0, 0, 0, 0
by reference rem_sock_desc
by value 0, 0, 0
giving sys_status.
if sys_status = ss$_normal move cond_val to sys_status.
if sys_status = ss$_reject
display "Java_Emp is not running on remote node."
else
if sys_status not = ss$_normal
call "lib$stop" using by value sys_status.
*
fini.
*
socket_close section.
00.
if argus_sleeping not = zeros
call "sys$waitfr" using by value argus_sleeping.

move function length (eof_msg) to out_len.
call "sys$qiow"
using by value 0, net_chan, io$_writevblk
by reference iosb
by value 0, 0
by reference eof_msg
by value out_len, 0, 0, 0, 0
giving sys_status.
if sys_status = ss$_normal move cond_val to sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "sys$dassgn" using by value net_chan giving sys_status.
*
screen_setup section.
00.
call "smg$create_pasteboard"
using pasteboard_id, omitted, row_cnt, col_cnt
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$create_virtual_keyboard" using keyboard_id giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "lib$get_ef" using argus_sleeping giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "sys$setef" using by value argus_sleeping giving sys_status.
if sys_status not = ss$_wasset and ss$_wasclr
call "lib$stop" using by value sys_status.

call "smg$set_cursor_mode" using pasteboard_id, smg$m_cursor_off giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$create_virtual_display"
using row_cnt, col_cnt, screen_display
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$put_chars"
using by reference screen_display
by descriptor "Enter Employee Name (ctrl/z = exit): "
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move 1 to row_cnt.
move 38 to col_cnt.
call "smg$put_chars"
using by reference screen_display
by descriptor running_name
by reference row_cnt, col_cnt, omitted, smg$m_reverse
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move 1 to row_cnt, col_cnt.
call "smg$paste_virtual_display"
using screen_display, pasteboard_id,
row_cnt, col_cnt
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move 20 to menu_cols.
move 5 to menu_rows.
call "smg$create_virtual_display"
using menu_rows, menu_cols,
menu_display, smg$m_border
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
fini.
*
employee_lookup section.
00.
call "smg$unpaste_virtual_display"
using menu_display, pasteboard_id
giving sys_status
if sys_status not = ss$_normal and smg$_notpasted
call "lib$stop" using by value sys_status.

call "smg$erase_display" using screen_display giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

display "Imagine looking up complete employee details here. . .".
*
fini.
*
end program emp_client.
identification division.
program-id. get_names.

environment division.
configuration section.
special-names.
symbolic characters
carriage_return is 14
line_feed is 11.

data division.
working-storage section.
01 load_entry pointer value external load_entry.
01 io$_writevblk pic 9(9) comp value external io$_writevblk.
01 smg$_notpasted pic 9(9) comp value external smg$_notpasted.
01 ss$_abort pic 9(9) comp value external ss$_abort.
01 ss$_wasset pic 9(9) comp value external ss$_wasset.
01 ss$_wasclr pic 9(9) comp value external ss$_wasclr.
01 ss$_normal pic 9(9) comp value external ss$_normal.
01 sys_status pic 9(9) comp.
*
01 all_flags pic 9(9) comp.
01 out_len pic 9(4) comp.
01 last_search pic x(20).
*
01 get_names_buffer.
03 pic xx value "20".
03 in_name pic x(22).
*
01 crlf.
03 pic x(1) value carriage_return.
03 pic x(1) value line_feed.
*
01 menu_desc external.
03 cell_size pic 9(4) comp.
03 dtype pic x(1).
03 dclass pic x(1).
03 base_addr pointer.
03 pic 9(4) comp.
03 flags pic x(1).
03 dimct pic x(1).
03 bytes_allocated pic 9(9) comp.
03 element_zero pic 9(9) comp.
03 stride pic 9(9) comp.
03 lwr_b pic 9(9) comp.
03 line_count pic 9(9) comp.
*
linkage section.
01 ast_ctx.
03 pasteboard_id pic 9(9) comp.
03 menu_display pic 9(9) comp.
03 running_len pic 9(9) comp.
03 net_chan pic 9(4) comp.
03 pic 9(4) comp.
03 argus_sleeping pic 9(9) comp.
03 ast_iosb.
05 ast_cond_val pic 9(4) comp.
05 ast_byte_count pic 9(4) comp.
05 pic 9(9) comp.
03 running_name pic x(20).
03 reply_buffer pic x(512).
*
procedure division using ast_ctx.
kick_off section.
00.
*+
* Are we already running?
*-
call "sys$readef"
using by value argus_sleeping
by reference all_flags
giving sys_status.
if sys_status = ss$_wasclr go to fini.
if sys_status not = ss$_wasset call "lib$stop" using by value sys_status.
*+
* Same old same old?
*-
if running_len = zeros
call "smg$unpaste_virtual_display"
using menu_display, pasteboard_id
giving sys_status
if sys_status not = ss$_normal and smg$_notpasted
call "lib$stop" using by value sys_status
end-if
go to fini.

if running_name = last_search go to fini.
*+
* Clock on, and tell everyone we're awake
*-
call "sys$clref" using by value argus_sleeping giving sys_status.
if sys_status not = ss$_wasset call "lib$stop" using by value sys_status.
*+
* Enlist the server
*-
string running_name(1:running_len),
crlf
delimited by size
into in_name.
add 4 to running_len giving out_len.

call "sys$qiow"
using by value 0, net_chan, io$_writevblk
by reference ast_iosb
by value 0, 0
by reference get_names_buffer
by value out_len, 0, 0, 0, 0
giving sys_status.
if sys_status = ss$_normal move ast_cond_val to sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

move zeros to line_count.
move running_name(1:running_len) to last_search.

call "sys$dclast"
using by value load_entry
by reference ast_ctx
by value 0
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
fini.
exit program.
*
end program get_names.
identification division.
program-id. load_entry.
data division.
working-storage section.
01 msg_handler pointer value external msg_handler.
01 ucx$c_msg_peek pic 9(9) comp value external ucx$c_msg_peek.
01 io$_readvblk pic 9(9) comp value external io$_readvblk.
01 ss$_normal pic 9(9) comp value external ss$_normal.
01 sys_status pic 9(9) comp.
*
01 max_msg_size pic 9(4) comp value 512.
*
linkage section.
01 ast_ctx.
03 pasteboard_id pic 9(9) comp.
03 menu_display pic 9(9) comp.
03 running_len pic 9(9) comp.
03 net_chan pic 9(4) comp.
03 pic 9(4) comp.
03 argus_sleeping pic 9(9) comp.
03 ast_iosb.
05 ast_cond_val pic 9(4) comp.
05 ast_byte_count pic 9(4) comp.
05 pic 9(9) comp.
03 running_name pic x(20).
03 reply_buffer pic x(512).
*
procedure division using ast_ctx.
kick_off section.
00.
call "sys$qio"
using by value 0, net_chan, io$_readvblk
by reference ast_iosb
by value msg_handler
by reference ast_ctx, reply_buffer
by value max_msg_size, 0, ucx$c_msg_peek, 0, 0
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
exit program.
*
end program load_entry.
identification division.
program-id. msg_handler.

environment division.
configuration section.
special-names.
symbolic characters
carriage_return is 14
line_feed is 11.

data division.
working-storage section.
01 get_names pointer value external get_names.
01 io_readnowait pic 9(9) comp value external io_readnowait.
01 smg$_eof pic 9(9) comp value external smg$_eof.
01 smg$_notpasted pic 9(9) comp value external smg$_notpasted.
01 smg$_invdis_id pic 9(9) comp value external smg$_invdis_id.
01 smg$m_remove_item pic 9(9) comp value external smg$m_remove_item.
01 smg$m_bold pic 9(9) comp value external smg$m_bold.
01 smg$m_reverse pic 9(9) comp value external smg$m_reverse.
01 smg$m_fixed_format pic 9(9) comp value external smg$m_fixed_format.
01 smg$k_vertical pic 9(9) comp value external smg$k_vertical.
01 ss$_abort pic 9(9) comp value external ss$_abort.
01 ss$_normal pic 9(9) comp value external ss$_normal.
01 sys_status pic 9(9) comp.
*
01 menu_rows pic 9(9) comp value 3.
01 menu_cols pic 9(9) comp value 38.
*
01 local_buffer.
03 msg_type pic x(2).
88 valid_reply values "21", "99".
88 emp_data value "21".
88 end_of_file value "99".
03 reply_body pic x(510).
*
01 emp_name_buffer redefines local_buffer.
03 pic xx.
03 out_name pic x(20).
*
01 cr pic x(1) value carriage_return.
01 lf pic x(1) value line_feed.
*
01 rec_size pic 9(9) comp.
01 menu_flags pic 9(9) comp.
*
01 menu_desc external.
03 cell_size pic 9(4) comp.
03 dtype pic x(1).
03 dclass pic x(1).
03 base_addr pointer.
03 pic 9(4) comp.
03 flags pic x(1).
03 dimct pic x(1).
03 bytes_allocated pic 9(9) comp.
03 element_zero pic 9(9) comp.
03 stride pic 9(9) comp.
03 lwr_b pic 9(9) comp.
03 line_count pic 9(9) comp.
*
01 bytes_needed pic 9(9) comp.
*
01 target_desc.
03 pic 9(9) comp value external cell_size.
03 target_cell_addr pointer.
*
linkage section.
01 ast_ctx.
03 pasteboard_id pic 9(9) comp.
03 menu_display pic 9(9) comp.
03 running_len pic 9(9) comp.
03 net_chan pic 9(4) comp.
03 pic 9(4) comp.
03 argus_sleeping pic 9(9) comp.
03 ast_iosb.
05 ast_cond_val pic 9(4) comp.
05 ast_byte_count pic 9(4) comp.
05 pic 9(9) comp.
03 running_name pic x(20).
03 reply_buffer pic x(512).
*
procedure division using ast_ctx.
kick_off section.
00.
if ast_cond_val not = ss$_normal call "lib$stop" using by value ast_cond_val.

move reply_buffer to local_buffer.
move zeros to rec_size.
inspect local_buffer(1:ast_byte_count) tallying rec_size for characters before initial lf.
if rec_size = ast_byte_count or < 3
display "Badly formed message (", local_buffer(1:ast_byte_count), ")"
call "lib$stop" using by value ss$_abort.

add 1 to rec_size.
move spaces to local_buffer.
call "sys$qiow"
using by value 0, net_chan, io_readnowait
by reference ast_iosb
by value 0, 0
by reference local_buffer
by value rec_size, 0, 0, 0, 0
giving sys_status.
if sys_status = ss$_normal move ast_cond_val to sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

if ast_byte_count < rec_size
display "READ less than PEEKed"
call "lib$stop" using by value ss$_abort.

if local_buffer((ast_byte_count - 1):1) = cr
subtract 2 from ast_byte_count
else
subtract 1 from ast_byte_count.

if end_of_file
perform clock_off
else
perform load_cell
call "load_entry" using ast_ctx.
*
fini.
exit program.
*
clock_off section.
00.
call "smg$delete_menu" using menu_display giving sys_status.
if sys_status not = ss$_normal and smg$_invdis_id
call "lib$stop" using by value sys_status.

if line_count = zeros
call "smg$unpaste_virtual_display"
using menu_display, pasteboard_id
giving sys_status
if sys_status not = ss$_normal and smg$_notpasted
call "lib$stop" using by value sys_status
end-if
go to fini.

move line_count to stride.
call "smg$create_menu"
using menu_display, menu_desc, smg$k_vertical, smg$m_fixed_format
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

call "smg$get_pasting_info" using menu_display, pasteboard_id, menu_flags giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.

if menu_flags = zeros
call "smg$paste_virtual_display"
using menu_display, pasteboard_id,
menu_rows, menu_cols
giving sys_status
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
fini.
*
call "sys$setef" using by value argus_sleeping giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*+
* Check if anything's changed
*-
call "sys$dclast"
using by value get_names
by reference ast_ctx
by value 0
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value sys_status.
*
load_cell section.
00.
if not valid_reply
display "Unknow reply (", msg_type, ")"
call "lib$stop" using by value ss$_abort.

if line_count = 32767 go to fini.

add 1 to line_count.
multiply line_count by cell_size giving bytes_needed.
if bytes_needed > bytes_allocated
call "lib$vm_realloc"
using by value base_addr, bytes_needed
giving base_addr
if base_addr = zeros
display "Out of memory"
call "lib$stop" using by value ss$_abort
end-if
move bytes_needed to bytes_allocated
subtract cell_size from base_addr giving element_zero.

compute target_cell_addr = cell_size * line_count + element_zero.
call "lib$scopy_dxdx"
using by descriptor out_name(1:(ast_byte_count - 2))
by reference target_desc
giving sys_status.
if sys_status not = ss$_normal call "lib$stop" using by value ss$_abort.
*
fini.
*
end program msg_handler.

Paul Sture

unread,
Jul 24, 2016, 4:18:45 AM7/24/16
to
On 2016-07-24, mah...@googlemail.com <mah...@googlemail.com> wrote:
> Sorry it took so long. It took forever to get a new PAK list and then
> I struggle with all the commands these days :-(

You have my sympathy. I was intending to get some examples done
myself but constant interruptions got in the way.

> In a nutshell FMS is by far the best Character-cell screen handler
> available for VMS! DECForms heralded the demise of Digital.
>
> I will reply with a couple of examples that might help.

Just had a quick shufty. Many thanks for putting in the effort.

One thing I noted with the examples in the documentation is that not
only do they contain the odd syntax error but as is so often the case,
they omit "the thing you really want to see" (the VMS documentation is
*far* from alone here).

Do I have your permission to put your examples online for everyone to
use?

> For the rest of you who think you know COBOL and what it "can't" do -
> SHUT UP!

:-) :-) :-)

--
A software-enabled, network connected, crowd funded, smart toaster is,
when all is said and done, still just a toaster. -- Elad Gil
0 new messages