ibm-midrangerpglerpg

One RPGLE calls another RPGLE program using a data structure, how to achieve this in free format


I have a calling program suppose program1 which calls program2 using a data structure.

CALL 'Program2'        
PARM           P1PARM  

The structure of P1PARM 

D P1PARM          DS           256      
D  P1ADFR                 1     15      
D  P1ADTO                16     30      
D  P1MSNR                31     37  0   
D  P1NSNR                38     44  0   
D  P1YEAR                45     48  0   
D  P1COMP                59     62      
D  P1FAC                 63     67      
D  P1PPSR                68     74  0   
D  P1PTNS                75     79      

this structure is also defined in the called program program2 and as a input parameter in *entry

*Entry        PList                         
              Parm                    P1PARM

If I want to write a new program2 in fully free format how to describe this data structure in the PI section (*entry) of the called program.

*Note : I cannot change the calling program , I want to write a new called program using the total free format , kindly help me out out the syntax, I tried the net to find the syntax but couldn't get the exact answer.


Solution

  • The free-form equivalent of *ENTRY PLIST is the "procedure interface", DCL-PI.

    Define the parameter using LIKEDS. The parameter for LIKEDS is the actual data structure definition, either a new free-form definition for this program using DCL-DS, or the old fixed-form one above that you bring in by a copy file.

    dcl-pi *n;
       p1 likeds(p1parm);
    end-pi;
     
    dsply p1.p1adfr; // the parameter is qualified