Solved

Passing Array in RPGLE Free Format

Posted on 2015-01-26
5
1,115 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries Library Syncing 3 177
Read spool files from iseries in C# 4 271
IBM flash storage 840 15 64
iSeries Memory Utilization 2 85
The question appears often enough, how do I transfer my data from my old server to the new server while preserving file shares, share permissions, and NTFS permisions.  Here are my tips for handling such a transfer.
When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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