IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Array passing


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
naresh15

New User


Joined: 20 May 2010
Posts: 2
Location: hyderabad

PostPosted: Tue Jun 15, 2010 8:45 am
Reply with quote

How to pass an array to a subprogram?
Plz give response to this.
Back to top
View user's profile Send private message
naresh15

New User


Joined: 20 May 2010
Posts: 2
Location: hyderabad

PostPosted: Tue Jun 15, 2010 8:47 am
Reply with quote

How to pass a file to subprogram?
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Jun 15, 2010 8:52 am
Reply with quote

naresh15 wrote:
How to pass an array to a subprogram?
Plz give response to this.
CALL subprogram USING array.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Jun 15, 2010 8:53 am
Reply with quote

naresh15 wrote:
How to pass a file to subprogram?
Define 'file'.
A file name?
A file record?
A file contents?
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Jul 08, 2010 6:18 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 08, 2010 6:38 pm
Reply with quote

It would only be an Indexed cobol internal table
if the data definition included the INDEXED BY clause.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jul 08, 2010 7:20 pm
Reply with quote

and,

the definition of the CALLing program has no influence.

only the definition in Linkage of the CALLed program.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jul 08, 2010 7:46 pm
Reply with quote

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
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Jul 08, 2010 11:39 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Jul 09, 2010 12:07 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Passing Parameters to Programs Invoke... PL/I & Assembler 5
No new posts Passing SYSPRINT to Invoked Program PL/I & Assembler 9
No new posts COBOL Ascending and descending sort n... COBOL Programming 5
No new posts Passing parm from JCL to Assembler, b... PL/I & Assembler 2
No new posts To find an array of words (sys-symbol... JCL & VSAM 9
Search our Forums:

Back to Top