HP3000-L Archives

November 1997, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"mdc.com (Joseph Uhrig)" <[log in to unmask]>
Reply To:
mdc.com (Joseph Uhrig)
Date:
Wed, 5 Nov 1997 14:44:27 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (101 lines)
We have a lot of Transact legacy code as well.  Generally we only use
the PROC statement for calling intrinsics and external cobol
subroutines residing in an XL.  I don't know how to create a Transact
subroutine that can be called via the PROC statement, but a cobol
subroutine simply needs the record being passed to be defined in the
linkage section.  For example:

transact

PROC TAT2000(YEAR2000-RCD);

cobol

 LINKAGE SECTION.
01 YEAR000-RCD.
      05...


The key to using the CALL statement is realizing that the calling
program and the called program share all or part of the data
register.  So all you really need to do to pass data is make sure
that the list register in the called program lines up with the data
register from the called program.   The easiest way to insure this is
to make all of your shared or global variables reside at the top of
the list register for both programs.  For example:

System MainProg;

List First,Last, variable1,variable2,...;
Move (First) = "First Name";
Move (Last) = "Last Name";
CALL SwitchParms;

System CalledProg;

List First,Last, variable1,variable2,...;

For common routines that you call alot you can just set up a "global"
record in the dictionary with the variables you'll commonly use and
then use the List (Auto) option before any other List statements.  We
use this a lot for passing security information from program to
program.

If your main reason for wanting to modularize the program is to make
memory usage more efficient you may want to instead consider
segmenting the program.  Any perform statements that you repeatedly
call from multiple segments should reside in the first segment.

Hope this helps.




>>We have several legacy programs written in transact.  Now that you
have
stopped laughing please continue reading.  These programs are
basically
top-down in nature.  There is a lot of repeated code and I can see
areas that
could stand to be broken down into modules.

I was reading the transact manual and discovered two verbs; PROC and
CALL.
What I would like to do is break up some of these programs into more
manageable modules.  The PROC verb supports a parameter list, the
CALL verb
does not (according to the manual).

What I'd like to do is break up the large programs into smaller
programs.  I'm
not sure if I can even do what I want to do with Transact. How do I
use either
PROC or CALL and pass parameters between the the two.  See example
below:

-----------------------------------------------------------------
System MainProg;

Define (Item)  Parm1  X(10):
                      Parm2  X(10);

Main-Driver:
  Move (Parm1) = "First Name";
  Move (Parm2) = "Last Name";
  PROC SwitchParms(#Parm1, #Parm2);
  CALL SwitchParms(#Parm1, #Parm2);
End;
-----------------------------------------------------------------

From the above example "SwitchParms" is the called module.  How do I
code
SwitchParms so it expects the two incomming parameters? The manual
isn't very
clear on this.  Can this be done with the PROC verb?  Can this be
done with
the CALL verb?  Should I use some other verb?


GySgt Michael J. Riley
[log in to unmask]

ATOM RSS1 RSS2