×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Replacing the Plist
2

Replacing the Plist

Replacing the Plist

(OP)
Hello All,

As RPG evolves and there becomes better better and more modern ways to code in free form. I was wondering is anyone able to replace a plist without turning a program into a procedure. I'd like to know how to replace PLIST and PARM statements in a program that is called by a CL and has parameter(s) passed to it. I'm guessing the answer has to do with prototypes but I'm not sure how to use them in this case.

RE: Replacing the Plist

You use botha prototype (PR) and a procedure interface (PI) statement, followed by the parameter(s) on each. The PR and PI statements have to have the same name as the program.

Using *ENTRY PLIST:

CODE

     C     *Entry        PList                               
     C                   Parm                    pass        
     C                   Parm                    confirmation
     C                   Parm                    location_id

Using PR/PI specs:

CODE

               *  Prototype for Main Procedure                         
          D MyProgram       PR                  Extpgm('MYPROGRAM')
          D Pass_                               Like(Pass)         
          D Confirmation_                       Like(Confirmation)
          D Location_Id_                        Like(Location_Id)  
                                                                   
               *  *ENTRY Interface for Main Procedure                  
          D MyProgram       PI                                     
          D Pass                           1                       
          D Confirmation                   9  0                    
          D Location_Id                   10  0                    

Solum potestis prohibere ignes silvarum.

RE: Replacing the Plist

RPG III parameters style

CODE

d prm1            s             15p 5               
d prm2            s             15p 5               
d prm3            s              5a                 
                                                    
 * RPG III Entry Point                        
c     *entry        plist                           
c                   parm                    prm1    
c                   parm                    prm2  
c                   parm                    prm3  
  
c     prm1          dsply                    
c     prm2          dsply                    
c     prm3          dsply                    
c                   dump(a)                  
c                   eval      *inlr = '1'  
RPG IV parameters style

CODE

*   Program Prototype (the parms are NOT defined in the prototype)
d MyPgm           pr                   
d  prm1                         15p 5  
d  prm2                         15p 5  
d  prm3                          5a    

 * RPG IV-style Entry Point                                         
 *   Procedure Interface (That's where the parms are defined)                
d MyPgm           pi                   
d  prm1                         15p 5  
d  prm2                         15p 5  
d  prm3                          5a    
                                       
c     prm1          dsply                    
c     prm2          dsply                    
c     prm3          dsply                    
c                   dump(a)                  
c                   eval      *inlr = '1'
     

The CALL from the CL doesn't change :

CALL MYPGM (12345     9876543210     'ABCDE')



Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close