Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing the Plist 2

Status
Not open for further replies.

jrowden773

Programmer
Oct 19, 2007
9
0
0
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.
 
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.

 
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')



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top