ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to call in FREE Format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to call in FREE Format

    Hi

    How can i call the another program in /FREE format using PARM

    Thanx in advance

    magesh

  • #2
    Re: How to call in FREE Format

    Magesh,

    In order to use a call to an external program in Free Format, you would be best moving away from parameter lists.

    You can do this by producing a prototype for the external program like this:

    Original Plist:

    Code:
    c     PGMA          plist                          
    c                   parm                    Parm1 
    c                   parm                    Parm2
    c                   parm                    Parm3
    c                   parm                    Parm4
    New Prototype

    Code:
    d ProgramA        pr                  extpgm('PGMA')        
    d  parm1                         4  0                         
    d  parm2                         6  0                         
    d  parm3                        18  0                         
    d  parm4                         3  0
    This means then that you can call your External Program as you would any other procedure by simply using the call statement:

    Code:
    /Free
    
          Callp ProgramA (parm1:parm2:parm3:parm4);
    
    /End-free
    Of course you can exclude the Callp in Free format if you like as well:

    Code:
    /Free
    
          ProgramA (parm1:parm2:parm3:parm4);
    
    /End-free

    Hope this helps.

    Mike
    You don't stop playing games because you get old, You get old because you stop playing games!

    Comment


    • #3
      Re: How to call in FREE Format

      CALL isn't allowed in free format, you will need to create a protoype and use CALLP. Its all in the manual.

      [EDIT]Looks like Mike beat me to it{/EDIT]
      Life is a constant struggle against maturity

      Comment


      • #4
        Re: How to call in FREE Format

        Just an addition of the obvious ... if you want you can name your program something meaningful to make your code even more readable?!

        Code:
         * calls program that performs RTVMBRD                         
        d getNbrRecords   pr                  extPgm( 'EDMPRG02C' )    
        d file                          10a                            
        d library                       10a                            
        d nbrRecords                    10p 0

        The external program here does a RTVMBRD for a record count. Then in the program I call it as such:

        Code:
                               
        getNbrRecords( file : library : nbrRecords );                      
                                                                           
        if nbrRecords > 0;     // records found, populate array   
          :
          :         
        endif;
        Your friends list is empty!

        Comment


        • #5
          Re: How to call in FREE Format

          exists some diference an definition for parameters de entry in format FREE..?

          S.S.

          Comment

          Working...
          X