For Programmers: Free Programming Magazines  


Home > Archive > Cobol > February 2006 > Re: ouvrir un document word à partir d'un programme cobol









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: ouvrir un document word à partir d'un programme cobol
Michael Mattias

2006-02-23, 7:55 am

"2jo" <joffroy_lapeyronnie@yahoo.fr> wrote in message
news:1140679832.187978.193190@g44g2000cwa.googlegroups.com...
> In VB (or VBA) we can create 'Macros' (called subs or functions) and
> what i want to do is to call a sub from my COBOL program...
>..
> the definition of a sub with parameters in VB is like that :
> 1-
> private (or public) sub Name_of_sub (first_var as string)
> [the code is here]
> end sub


COBOL is not BASIC.

If you really need a BASIC analogy, COBOL supports "GOSUB" (via the PERFORM
verb), but does not support CALL (function or sub). (Period. Deal with it).
The COBOL 'CALL' verb is reserved for external procedures, nested programs
or additional ENTRY points, all beyond the scope of the this message.

For 'parameters', you can use with COBOL what you would use with BASIC to
execute code via GOSUB/RETURN: you write that subroutine to use a set of
specific variable names; when you are ready to execute your subroutine (in
COBOL, "PERFORM the paragraph") you assign (in COBOL, 'MOVE') to those
variables the values to be used for this particular execution.on RETURN, you
assign the result variables to the 'working' variables.

As far as 'private' or 'public' variables, you can forget about those, too,
unless you get into LOCAL STORAGE, available only when using additional
ENTRY points or nested programs. In COBOL, all datanames are GLOBAL (
SHARED by all code within the code module).

All that said, well-written COBOL ends up looking a lot like well-written
BASIC. And poorly-written COBOL looks a lot like...well, poorly-written
COBOL.

>the solution (1-) is what i need to do


What you are describing is 'how', not 'what'. You never *need* to do
anything a certain way. Maybe you WANT to do it that way, but in this case
that is simply not possible. So you do it another way.


--------
Michael C. Mattias
Tal Systems Inc.
Racine WI
mmattias@talsystems.com



















Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com