Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing Array in RPGLE Free Format

Posted on 2015-01-26
5
Medium Priority
?
1,748 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 35

Accepted Solution

by:
Gary Patterson earned 2000 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 35

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

971 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