Operating System - OpenVMS
1827908 Members
2254 Online
109971 Solutions
New Discussion

How to optimize subroutine placement in DCL

 
Wim Van den Wyngaert
Honored Contributor

Re: How to optimize subroutine placement in DCL

Hein, Labadie

For my part PERL and SDA is on the FORTRAN list : not always to be known be a SM.

And the constant is within the loop because many loops are alike and the code is the same for any loop. And found is initiialized in real life.

And you can even nest the lexicals and remove the spaces. But I prefer it this way for readability.

Wim
Wim
Hein van den Heuvel
Honored Contributor

Re: How to optimize subroutine placement in DCL

fwiw,

If I were to use DCL to code something like the more extensive attachment provided, then I would code it rather differently.
I'd highlight the search targets early on, in the expected order.

Two examples in slight different styles below. Specifically first one will we a very tight loop through the file.

I used numeric labels, but it is easy enough to make them text using something like:
$labels = "|main|proc|bal|non|bus|paged|lock"
:
$label = f$elem(target,"|",labels)
$goto do_23_'label'

fwiw,

Hein.

$ targets = -
"1234567890123| Main Memory| Process Ent| Balance Set|"+-
" Nonpaged Dy| Bus Address| Paged Dynam| Lock Manage|"
$ not_seen = "1 2 3 4 5 6 7 "
$ lt=f$len(targets)
$ close/nolog x
$ open/read x tmp.tmp
$r23:
$ read/end=e23 x x_rcd
$ target = f$loc(f$extr(0,13,x_rcd), targets)
$ if target.eq.lt then goto r23
$ target = target/14
$ not_seen = not_seen - "''target' "
$ goto d_23_'target
$
$d_23_0:
$d_23_1:
$d_23_2:
$d_23_3:
$d_23_4:
$d_23_5:
$d_23_6:
$d_23_7:
$d_23_8:
$d_23_9:
$write sys$output x_rcd
$goto r23
$e23:
$if not_seen.nes."" then write sys$output "did not find: ", -
not_seen, f$elem(f$elem(0," ",not_seen),"|",targets)
$exit


or...

$ targets="|Process Entry Slots|Balance Set Slots|"+-
"Paged Dynamic Memory|Nonpaged Dynamic Memory|"+-
"Bus Addressable Memory|Lock Manager Dynamic Memory|"+-
"Lock Manager Dyn Memory|Main Memory"
$ open/read x tmp.tmp
$r23:
$ read/end=e23 x x_rcd
$ li=f$len(x_rcd)
$ target = 0
$i23:
$ target = target + 1
$ it = f$element(target,"|",targets)
$ if it.eqs."|" then goto r23
$ pos=f$loc(it,x_rcd)
$ if pos .eq. li then goto i23
$ targets = targets - "|''it'"
$ goto d_23_'target
$
$d_23_0:
$d_23_1:
$d_23_2:
$d_23_3:
$d_23_4:
$d_23_5:
$d_23_6:
$d_23_7:
$d_23_8:
$d_23_9:
$write sys$output x_rcd
$goto r23
$e23:
$if targets.nes."" then write sys$output "did not find: ", targets
$exit
Wim Van den Wyngaert
Honored Contributor

Re: How to optimize subroutine placement in DCL

Hein,

Fwiw

My code is dcl_check compliant. So, no "goto depending on" because can not be checked by dcl_check. Hated it in Cobol and hate it in DCL.

Wim
Wim
John Gillings
Honored Contributor

Re: How to optimize subroutine placement in DCL

I'll hand over to Groucho for comment:

http://www.youtube.com/watch?v=0PY7N4iRgLQ
A crucible of informative mistakes
Wim Van den Wyngaert
Honored Contributor

Re: How to optimize subroutine placement in DCL

No youtube over here.

My memory is failing (again, but it has been 11 years I used COBOL). It was not go to depending on but alter.
http://home.swbell.net/mck9/cobol/style/alter.html

Wim
Wim
Jon Pinkley
Honored Contributor

Re: How to optimize subroutine placement in DCL

RE:"No youtube over here."

About This Video Groucho Marx performing "Whatever It Is, I'm Against It!" and "I Always Get My Man" from the Paramount Picture "Horsefeathers" (1932).

it depends
Hein van den Heuvel
Honored Contributor

Re: How to optimize subroutine placement in DCL

>> No youtube over here.

That's too funny! How appropriate. QED.

$value =
$GOTO _'value

IMHO that's a well, perfectly legal, DCL intentially provided, controlled, alternative to a sorely missing CASE or GOTO DEPENDING ON statement.

$IF p1.EQS."" THEN p1 = "start"
$GOTO 'p1

Now that's a different kettle of fish.
(I use it all the time though :-)

It seems time to close this topic.
There seems no no point in seriously worrying about 'stuff' (performance here) if there is no willingness to change anything.

met vriendelijke groetjes,
Hein.
Wim Van den Wyngaert
Honored Contributor

Re: How to optimize subroutine placement in DCL

Hein,

Ok, I'll close it.
FYI : I tried shortening commands. DCL_CHECK didn't support it. So, I can only shorten variables or use dcl_diet and @ a diet version.

Wim

Wim
Wim Van den Wyngaert
Honored Contributor

Re: How to optimize subroutine placement in DCL

This is the end.
Wim