Question

Passing Array as parameter in COBOL/400, is it possible?

Asked by: Andy400

Hi
I am new to COBOL/400 preogramming although know RPG,ILE RPG for 4 years.
Can anyone please guide me is it posible to passing Array as parameter in COBOL/400?
I have done it in ILE  RPG but dn't know how it works in COBOL 400.

Please help, a code example will be of great help

Andy400

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-10-26 at 00:04:16ID24842734
Tags

COBOL/400

,

Arrays

Topics

COBOL Programming Language

,

RPG Programming Language

,

Programming Languages

Participating Experts
2
Points
500
Comments
8

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Array defining in RPG
    Hi, Could somebody tell me how to define Array in RPG IV and initialize it as per the below example I have a example in "C" and I want to define it in RPG int xyz[15]; xyz[0] = 1; xyz[1] = 0; xyz[2] = 1; xyz[3] = 1...
  2. converting from C++ prototypes to ILE RPG prototypes
    Hi Guys, Does anybody has any information about converting C++ prototypes to ILE RPG prototypes? How do we resolve at link time the mangled symbol name of C++ referenced in ILE RPG? Thanks! Dhumal
  3. how to pass arguements as address in ILE RPG to C++
    Can anybody please throw some light on how to pass arguements as address in ILE RPG to C++. Any response will be greatly appreciated. Regards, Dhumal
  4. passing structures in ILE RPG
    Hi Everyone, I just wanted to know the latest trend in ILE RPG. Is everybody prefer the use of passing structure or it is still same old passing formal parameters in ILE RPG.Which one is more prefered these days and why? I just wanted to know the views of the expert people...
  5. Return Result Set from RPG output parameter
    I need to use a stored procedure(400 DB2) to take input parameters, run an RPG program, then take an RPG output parameter and display it in a result set. I can do this with a java program call, or I can even display the RPG output on the iSeries console, but my boss requires...
  6. RPG procedure to return array to java using Callable Statem…
    I have a callable statement that uses the following parameters. rpg.registerOutParameter(1, java.sql.Types.CHAR); rpg.registerOutParameter(2, java.sql.Types.DECIMAL); rpg.registerOutParameter(3, java.sql.Types.DATE); rpg.registerOutParameter(4, java.sql.Types.CHA...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: tliottaPosted on 2009-10-26 at 11:22:54ID: 25665133

Andy400:

Of course it's possible. How it's done will depend on a little more info from you.

RPG passing to COBOL? COBOL/400 or ILE COBOL? (RPG/400 or ILE RPG?) COBOL program receiving the parm or COBOL module/procedure? And it shouldn't make a difference, but OS version/release?

Tom

 

by: Andy400Posted on 2009-10-26 at 20:52:53ID: 25669027

Hi tliotta,
Thanks for responce.
I am writting a cobol/400 program. TypeCBLLE.(OS/400-V5R3)
The program will be invoked from GUI screen developed using EGL technolgy. The call will be storeprocedue call; which has my COBOL/400 pgm as external object linked to store procedure.
All incomming parameters will be sent in Char format which my cobol/400 willl redefine as per requirements.
Basic issue is
1.Parameter which is passedTO COBOL/400  is in form of array (Dim 15). theses are 15 records in single parameter
2.It needs to be recevied as ARRAY.
 I am not sure how to go about it , if any sample code is given it will be most helpfull.

 

by: tliottaPosted on 2009-11-02 at 17:52:12ID: 25725525

Andy400:

Just to clarify for your use, you are compiling ILE COBOL which should be distinguished from COBOL/400. I'm not sure if COBOL/400 could do this and I'll have to do some research on how ILE COBOL would receive whatever kind(s) of structures that EGL might be attempting to pass. (Your source member type of [CBLLE] should cause the ILE COBOL compiler to be invoked.)

If EGL invokes program objects, then the physical mechanism of parameter passing will be "by reference". That means that the only thing in the actual argument list will be a pointer. Your compiled program would have a LINKAGE SECTION item declared and it would become based on what address was in the pointer.

You don't do any coding for the pointer. You simply place your data definition in the LINKAGE SECTION and reference the data element name in the PROCEDURE DIVISION USING ... statement. If you expect an array, then you code the data definition as an array. A likely structure would consist of an 01-level item that had the actual array definition on a lower-level item within it.

That would be what I would expect -- a single 01-level group item with the array defined at a lower level, a single argument address. I don't EGL available to check that out.

Unfortunately, I can't check out how EGL will structure the array in memory either.

Since (AFAIK) EGL has more COBOL in its heritage than other languages, I would expect that any array would be structured so that a COBOL definition should be fairly obvious.

I don't think there's much more I can say. I could make a guess or two about what some specific LINKAGE SECTION definitions would look like if I knew more about how the array is defined in EGL.

Also, because this is EGL instead of just one program calling another, I can't make the guaranteed assertion that EGL is making a "program call" rather than a "procedure call".

A procedure can have parameters passed "by reference" or "by value". If EGL can access procedures, then the COBOL _might_ expect arguments to arrive "by value". I figure that to be less likely enough to ignore it for now.

So, what exactly is the "problem"? Are you needing to learn how to code in COBOL? Are you choosing COBOL other than some other language for a reason? Do you have background in iSeries programming?

I see that this is i5/OS V5R3 (previously OS/400). You are aware that V5R3 is no longer supported by IBM, right? Can you determine if all relevant PTFs have been applied?

Tom

 

by: Andy400Posted on 2009-11-03 at 19:25:28ID: 25736137


 Tom,

Thanks for the response, apologies for late reply.

I do have coding exp in RPG/LE around 4 years, but I am  very new in Cobol/400 coding.
Writing is COBOL is mandatory as current application is written in that way.
To make it short,  
I am passing string in Char (Appx length 250) to COBOL (ILE) program. This program needs to receive it in array format, so that in the PROCEDURE DIVISION USING ..Statement it receives it that way.
I need some practical example which works. If a code sample is posted then it will be a great help.

Here you  can assume that a char string as parameter is passed to Cobol program which is called from command line. If this works I can take care of EGL thing.

Thanks in advance.
Andy






 

by: Gary_The_IT_ProPosted on 2009-11-18 at 19:09:33ID: 25857242

Warning - I've done a some COBOL maintenance and troubleshooting, but I'm not a COBOL expert.

That said, check out the topic "Grouping Data to be Passed" starting on page 225:

http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/books/sc092540.pdf

The CALLING program can just pass a single parameter of the correct length to the CALLED program (e.g. 15 rows x 80 characters would pass a single 120-byte parameter),

Sample CALLED program below.

- Gary Patterson

Check out my EE profile:  http://www.experts-exchange.com/M_4382324.html

IDENTIFICATION DIVISION.                       
 PROGRAM-ID. PARMDEMO.                          
                                                
 DATA DIVISION.                                 
 WORKING-STORAGE SECTION.                       
 LINKAGE SECTION.                               
 01 PARM-LIST.                                  
    05 MY-LIST PIC X(80) OCCURS 15 TIMES.
       
**********************************************                                                
*** Demonstrate parameter passing into an array    
**********************************************                                                 
 PROCEDURE DIVISION USING BY REFERENCE PARM-LIST
 MAIN-LINE.                                     
    DISPLAY "First line:".                       
    DISPLAY MY-LIST(1).                         
    DISPLAY "Last line:".                        
    DISPLAY MY-LIST(15).                        
    STOP RUN.                                    
 ===> CRTBNDCBL PGM(mylib/PARMDEMO) SRCFILE(mylib/QCBLLESRC) SRCMBR(PARMDEMO)
 ===> ADDLIBLE mylib
 ===> call qcmd   
     /* Then press F11 for a full screen, with convenient 80-byte lines */
     /* Here's the call with a 120-byte parm all spaced out to look good in the command entry screen */ 
 ===> call parmdemo                                                       PARM('
This is the first line.                                                         
This is the second.                                                             
Third.                                                                          
4th                                                                             
5th                                                                             
6                                                                               
7                                                                               
8                                                                               
9                                                                               
10                                                                              
11                                                                              
12                                                                              
13                                                                              
14th                                                                            
This is the fifteenth line.                                                     
')

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:

Select allOpen in new window

 

by: Andy400Posted on 2009-11-20 at 05:54:48ID: 31645768

Thanks a lot.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...