View previous topic :: View next topic
|
Author |
Message |
naresh15
New User
Joined: 20 May 2010 Posts: 2 Location: hyderabad
|
|
|
|
How to pass an array to a subprogram?
Plz give response to this. |
|
Back to top |
|
|
naresh15
New User
Joined: 20 May 2010 Posts: 2 Location: hyderabad
|
|
|
|
How to pass a file to subprogram? |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
naresh15 wrote: |
How to pass an array to a subprogram?
Plz give response to this. |
CALL subprogram USING array. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
naresh15 wrote: |
How to pass a file to subprogram? |
Define 'file'.
A file name?
A file record?
A file contents? |
|
Back to top |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
Quote: |
How to pass an array to a subprogram? |
The question could be better framed as:
How to pass an Indexed array to a subprogram ? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
It would only be an Indexed cobol internal table
if the data definition included the INDEXED BY clause. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
and,
the definition of the CALLing program has no influence.
only the definition in Linkage of the CALLed program. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Note: When the sub-program receives control and obtains array-addressability, using the passed-array address, the associated indices of the array are NOT set to the values set by the caller (if applicable).
Bill |
|
Back to top |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
Yes bill,
I got it. The array(indexed or non indexed) could be passed the same way in both cases. In case of indexed the the index value needs to be sent via some other numeric variable, in order to retain the index information of calling program.
Thanks. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Yes, that's correct. A preferable variable will be defined as S9(08) COMP (or COMP-5, if your compiler supports this).
You can pass intelligence to the sub-program by moving -1 (X'FFFFFFFF') to this COMP/COMP-5 parameter.
When the sub-program gains control and finds this negative 1 value, then this would indicate that the associated index needs to be set to 1.
Or instead of a -1, a ZERO could also be used to inform the sub-program to set the associated index to 1.
Any value greater than ZERO, the associated index is set to the COMP/COMP-5 parameter.
Bill |
|
Back to top |
|
|
|