Solved

Passing Array in RPGLE Free Format

Posted on 2015-01-26
5
1,037 Views
Last Modified: 2015-01-29
Hi,

I will post more information if needed, but I'm hoping this is quick. I'm a bit brain dead.  (long day).  I have two arrays (occur 99 size 9A: occur 99 size 1A).  I'm using CALLP from rpgle free format to another free format rpgle program with EXTPGM and *ENTRY.  I want to pass both arrays, do updates, and pass back. I'm getting a variety of errors depending on how I handle it.  (I have done this a number of times in RPG.)

Can I do this? What is the simplest way?
Thank you for your help.  If specifics are need please let me know.
Lynn
0
Comment
Question by:lynn_harris
  • 2
  • 2
5 Comments
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 40572615
Here's sample code showing how to pass an array.  Parameters just need to match.

http://www.rpgiv.info/mambo/index.php?option=com_content&task=view&id=486&Itemid=9

Can't help but notice the use of "occur" in your question.  Are you really trying to pass an array, or are you trying to pass a multiple-occurrence data structure?

Passing a MODS is different, and a little trickier.  Here's a nice explanation and example:

http://iprodeveloper.com/rpg-programming/multiple-occurrence-data-structures-parameters

Feel free to post some code if you'd like specific help.

- Gary
0
 

Author Comment

by:lynn_harris
ID: 40572708
Hi Gary,

Thank you.
You are correct (I was fried). It should've 'DIM'. It is an array, but passing a MODS would be great to know.

I have a meeting in a minute and won't get to try this for a bit.  I will read through the information and either post more or close.

Thanks again!
Lynn
0
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 40572789
Happy to help.

- Gary
0
 
LVL 27

Expert Comment

by:tliotta
ID: 40576681
One minor change can be useful. Instead of this:
     D MyProc          PR
     D   Parm1                        3a   dim(10)

     D Array           s              3a   dim(10)

Open in new window

Consider this:
     D MyProc          PR
     D   Parm1                             like( Array ) dim(10)

     D Array           s              3a   dim(10)

Open in new window

It might not make much difference in your case, but the use of LIKE() for a prototype can be helpful in numerous cases. I tend to use it wherever it works.

Tom
0
 

Author Comment

by:lynn_harris
ID: 40577376
Hi,

Tom, thank you for the tip on using the LIKE().  

I have been pulled away temporarily and will not be able to work on this for a few days.  So, I'm going to close it for now and open another question if I get stuck. I don't like to leave answered question hanging.  

Thanks again,
Lynn
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to end AS400 scheduled job after a certain time 7 909
AS400 Single Sign On 3 1,156
DB2 iSeries Sales by Dept for last week and last month and last year 7 90
IBM i - CL Array 5 92
There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now