Announcement

Collapse
No announcement yet.

Help with CALLP

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

  • Help with CALLP

    Hi everyone.

    Am trying my hand at free format at the moment and am struggling to get my head round it.

    What I am trying to do is..

    Code:
    c                   call      dalib01                       
    c                   parm                    dlref#
    I've picked up bits of the web and on here, but my call still isn't working.

    Code:
    d dalib01         PR                  EXTPGM('DALIB01')   
      /free
              callp dalib01(dlref#);
      /end-free
    What am I missing?

    Thanks in advance

  • #2
    Re: Help with CALLP

    PHP Code:
    d dalib01         PR                  EXTPGM(dalib01)   
    d                                  10a
     
    *
    d dlref#          s                10a
    d dalib01         s                10a    Inz('YOURPROGTOCALL')
      /
    free
              dalib01
    (dlref#);
      
    /end-free 
    You don't need the callp.

    In your fix form code it looks like the DALIB01 is a variable. If DALIB01 was the name of the program the it would be enclosed in quotes.
    Bill
    "A good friend will bail you out of jail,
    A true friend would be sitting beside you saying,
    'Wow, that was fun.'"

    Comment


    • #3
      Re: Help with CALLP

      Thanks Bill,

      I'll give this a go when I get home

      Comment


      • #4
        Re: Help with CALLP

        I'm still struggling here if anyone could enlighten me..

        Code:
        /**************************************************************************************************/ 
        /***** Program:    SYSBT01 - System program available to all modules                          *****/ 
        /***** Author:     Chris Lomas                                                                *****/ 
        /***** Usage:      System process to display object description to an output file             *****/ 
        /***** Parameters: &LIB     - Which objects in the library specified are to be documented     *****/ 
        /*****             &OBJ     - The object(s) to document                                       *****/ 
        /*****             &TYP     - The type of objects to document                                 *****/ 
        /*****             &DETAIL  - The type of detail to output                                    *****/ 
        /*****             &OUTFILE - The name of the file to output to                               *****/ 
        /**************************************************************************************************/ 
                     PGM        PARM(&LIB &OBJ &TYP &detail &outfile)                                        
                     DCL        VAR(&LIB) TYPE(*CHAR) LEN(10)                                                
                     DCL        VAR(&OBJ) TYPE(*CHAR) LEN(10)                                                
                     DCL        VAR(&TYP) TYPE(*CHAR) LEN(8)                                                 
                     DCL        VAR(&DETAIL) TYPE(*CHAR) LEN(8)                                              
                     DCL        VAR(&OUTFILE) TYPE(*CHAR) LEN(10)                                            
                     DCL        VAR(&PRODLIB) TYPE(*CHAR) LEN(10)                                            
                                                                                                             
                     RTVOBJD    OBJ(*LIBL/SYSBT01) OBJTYPE(*PGM) +                                           
                                  RTNLIB(&PRODLIB)                                                          
                                                                                                            
                     DSPOBJD    OBJ(&LIB/&OBJ) OBJTYPE(&TYP) DETAIL(&DETAIL) +                              
                                  OUTPUT(*OUTFILE) +                                                        
                                  OUTFILE(&PRODLIB/&OUTFILE) OUTMBR(*FIRST +                                
                                  *REPLACE)                                                                 
                                                                                                            
                     ENDPGM
        This is the program I am trying to call from my free format RPG.

        And, here is my free format rpg..

        Code:
        foqoutq    uf   e           K disk                                    
        f*******bas_outq  if   e             disk    usropn                   
                                                                              
        d dspobjd         pr                  EXTPGM('SYSBT01')               
        d  d#lib          s             10a   inz('*ALL')                     
        d  d#obj          s             10a   inz('*ALL')                     
        d  d#typ          s              8a   inz('*OUTQ')                    
        d  d#detail       s              8a   inz('*BASIC')                   
        d  d#outfile      s             10a   inz('BAS_OUTQ')                 
                                                                              
         /free                                                                
                                                                              
          callp dspobjd (d#lib d#obj d#typ d#detail d#outfile);               
          eval *inlr = *on;                                                   
          return;                                                             
                                                                              
         /end-free
        And, am I right in thinking that I don't need the "eval" I could just do a..

        *inlr = *on?

        Thanks in advance.

        Comment


        • #5
          Re: Help with CALLP

          yes, you can just do *inlr=*on; in free format
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: Help with CALLP

            Originally posted by ChrisL View Post
            And, am I right in thinking that I don't need the "eval" I could just do a..

            *inlr = *on?

            Thanks in advance.
            Yes, eval and callp are both optional unless extenders are needed. Example: Eval(H) would require an extender.
            http://www.linkedin.com/in/chippermiller

            Comment


            • #7
              Re: Help with CALLP

              Thanks guys..

              Next question..

              I want to do a SetLL on a file which has 2 key fields, seems I can do this if I use the primary key field, how do I go about specifying a key list in /free?

              Or can it be clever and let me do something like...

              SetLL (KeyFld#1 : KeyFld#2 : KeyFld#3) MyFileName;

              Comment


              • #8
                Re: Help with CALLP

                Originally posted by ChrisL View Post
                Thanks guys..

                Next question..

                I want to do a SetLL on a file which has 2 key fields, seems I can do this if I use the primary key field, how do I go about specifying a key list in /free?

                Or can it be clever and let me do something like...

                SetLL (KeyFld#1 : KeyFld#2 : KeyFld#3) MyFileName;
                exactly use the inline keys...key lists are for RPG III (eww...) you can still use KLIST for your programs they just have to be defined in fixed format (eww....)
                I'm not anti-social, I just don't like people -Tommy Holden

                Comment


                • #9
                  Re: Help with CALLP

                  I've tried this but I still seem to get compiler errors...

                  Here is my code so far

                  Code:
                    *---------------------------------------------------------------------------------------------  
                    * File definitions                                                                              
                    *---------------------------------------------------------------------------------------------  
                   foqoutq    uf a e           k disk                                                               
                   foqoutqz   if   e           k disk    rename(oqoutqf:NotUsed)                                    
                   fbas_outq  if   e             disk    usropn                                                     
                    *---------------------------------------------------------------------------------------------  
                    * Work field definitions                                                                        
                    *---------------------------------------------------------------------------------------------  
                   d  d#lib          s             10a   inz('*ALL')                                                
                   d  d#obj          s             10a   inz('*ALL')                                                
                   d  d#typ          s              8a   inz('*OUTQ')                                               
                   d  d#detail       s              8a   inz('*BASIC')                                              
                   d  d#outfile      s             10a   inz('BAS_OUTQ')                                            
                    *---------------------------------------------------------------------------------------------  
                    * Procedure definitions                                                                         
                    *---------------------------------------------------------------------------------------------  
                   d dspobjd         pr                  EXTPGM('SYSBT01')                                          
                   d  Library                      10a                                                              
                   d  Object                       10a                                                              
                   d  Type                          8a                                                              
                   d  Detail                        8a                                                              
                   d  Outfile                      10a                                                              
                    *---------------------------------------------------------------------------------------------  
                    * Start of mainline code                                                                        
                    *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
                    /free                                                                                           
                                                                                                                    
                     dspobjd (d#lib : d#obj : d#typ : d#detail : d#outfile);                                        
                     // Load output queue details from the output file                                              
                     open bas_outq;                                                                                 
                     read bas_outq;                                                                                 
                     dow not %eof(bas_outq);                                                                        
                         setll (odlbnm : odobnm) oqoutq;                                                            
                         // If we have a match from the output file in our file then check if desc has changed      
                         if %found(oqoutq);                                                                         
                            if odobtx <> oodesc;                                                                    
                               oodesc = odobtx;                                                                     
                               update oqoutqf;                                                                      
                           endif;                                                                                   
                        else;                                                                                       
                        // Otherwise, write the record to our file                                                  
                           oolib = odlbnm;                                                                          
                           oooutq = odobnm;                                                                         
                           oodesc = odobtx;                                                                         
                           setgt *hival oqoutqz;                                                                    
                           readp oqoutqz;                                                                           
                           if not %eof(oqoutqz);                                                                    
                              ooref# = ooref# +1;                                                                   
                           else;                                                                                    
                              ooref# = 1;                                                                           
                           endif;                                                                                   
                           write oqoutqf;                                                                           
                        endif;                                                                                      
                    read bas_outq;                                                                                  
                    enddo;                                                                                          
                                                                                                                    
                    *inlr = *on;                                                                                    
                    return;                                                                                         
                                                                                                                  
                   /end-free                                                                                      
                   *- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
                   * End of mainline code                                                                         
                   *---------------------------------------------------------------------------------------------
                  Here is the DDS for my PF..

                  Code:
                  A                                      UNIQUE                        
                  A          R OQOUTQF                                                 
                  A            OOLIB         10A         TEXT('Library Name')          
                  A                                      COLHDG('Library' +            
                  A                                            ' Name')                
                  A            OOOUTQ        10A         TEXT('Output Queue Name')     
                  A                                      COLHDG('Output' +             
                  A                                            ' Queue')               
                  A            OODESC        50A         TEXT('Description')           
                  A                                      COLHDG('Description')         
                  A            OOREF#         9S00       TEXT('Reference Number')      
                  A                                      COLHDG('Reference' +          
                  A                                            ' Number')              
                  A          K OOLIB                                                   
                  A          K OOOUTQ
                  And the errors I get are....

                  Code:
                     148   dow not %eof(bas_outq);                                                                       B01       080129     003300 
                     149       setll (odlbnm : odobnm) oqoutq;                                                            01       080129     003400 
                  ======>            a       b                                                                                                       
                  *RNF5309 30 a      003400  Factor 1 operand is not valid.                                                                          
                  *RNF5507 30 b      003400  A semi-colon is not specified at the end of a free-format                                               
                                             specification.                                                                                          
                     150       // If we have a match from the output file in our file then check if desc has changed               080129     003500
                  Can anyone let me know what I am missing please?

                  Comment


                  • #10
                    Re: Help with CALLP

                    Here's a couple if suggestions.
                    1st, use the LPEX editor and not SEU. Enter the setll then Ctrl-space and it will pop up all the possible options for syntax. If that doesn't help enough, press F1 and it pops you to the page in the RPG manual along with samples.

                    2nd, if you already have a working fixed-format, just open it and click "Convert to free-form". It does about 80% of the work for you. A good learning tool.

                    3rd, note that SETLL does not read any records from the file - is that what you intended?

                    Comment


                    • #11
                      Re: Help with CALLP

                      Looks to me like field "odlbnm" is not defined. Check for a "7030" error at the bottom of your compile listing.
                      "Time passes, but sometimes it beats the <crap> out of you as it goes."

                      Comment


                      • #12
                        Re: Help with CALLP

                        Originally posted by arrow483 View Post
                        Here's a couple if suggestions.
                        1st, use the LPEX editor and not SEU. Enter the setll then Ctrl-space and it will pop up all the possible options for syntax. If that doesn't help enough, press F1 and it pops you to the page in the RPG manual along with samples.

                        2nd, if you already have a working fixed-format, just open it and click "Convert to free-form". It does about 80% of the work for you. A good learning tool.

                        3rd, note that SETLL does not read any records from the file - is that what you intended?
                        Arrow,

                        I haven't got the LPEX editor, is it free and where do I get it from?

                        And yes you are right about the SetLL, I actually need to do a Chain (forgot that I added the update of the record in later). But I'd still like to get this working (even though my program will then error with an update without prior read.

                        Littlepd - ODLBNM, ODOBNM and ODOBTX are defined in the BAS_OUTQ file (created from doing a DSPOBJD to outfile).

                        Comment


                        • #13
                          Re: Help with CALLP

                          The LPEX editor is part of Websphere Development Studio Client, and is shipped at "no exta charge" if you bought any compiler (such as RPG, etc). It is a seperate set of disks and installs on the PC. You should ask your IBM rep or BP to order the release 7 set of disks (no charge). This replaces SEU, RLU, SDA, etc and allows interactive editing of virually any source member, along with various web tools.

                          Comment


                          • #14
                            Re: Help with CALLP

                            Make sure that the file BAS_OUTQ file exists prior to compiling. Make sure you have the library in your library list.

                            Another thought....don't you need to do a read of some sort after the setll?
                            Your future President
                            Bryce

                            ---------------------------------------------
                            http://www.bravobryce.com

                            Comment


                            • #15
                              Re: Help with CALLP

                              And yes you are right about the SetLL, I actually need to do a Chain (forgot that I added the update of the record in later). But I'd still like to get this working (even though my program will then error with an update without prior read.
                              Why would you need a SETLL if you are doing a CHAIN anyway ? SETLL is usualy used with READ.

                              Comment

                              Working...
                              X