Thanks Mel. I will change my code as you mentioned and run it again. Hope it will work.
 
Mathew. 

Mel Rothman <[EMAIL PROTECTED]> wrote:
Some of the reasons that may have caused it to fail are:

  1. All command names, parameter names, library names, etc. should be upper case.
  2. Parameters passed as character literals should be enclosed in quotes.
When using character literals with DOCMD, which uses QCMDEXC, be sure that the variable receiving the literal in the program it is calling is big enough to handle the longest literal you will pass. Also, it should be at least 32 bytes because literals less than 32 bytes are assumed by QCMDEXC to be 32 bytes.

Also, DOCMD returns a value that indicates whether it was successful. You might want to use and test that variable in your code.

As previously noted, if the command to be invoked is CALL, it makes more sense to use RPG's CALL op code.

Following are two sample programs that worked for me. Library CGIDEV2DEV is my CGIDEV2 development library.

Mel Rothman, CGIDEV2 Author
Mel Rothman, Inc.

RPGLE program TESTDOCMD compiled with ACTGRP(*NEW)
-------------
  /copy qrpglesrc,hspecs                                
  /copy qrpglesrc,hspecsbnd                             
 H dftactgrp(*no) actgrp(*new)                          
                                                        
  /copy qrpglesrc,prototypeb                            
  /copy qrpglesrc,usec                                  
                                                        
  * Other variables                                     
 D accnt           s             32    inz('Test data') 
 D rc              s             10i 0                  
                                                        
  /free                                                 
    rc = DoCmd('CALL CGIDEV2DEV/TESTDOCMD2 PARM(''' +   
         %trimr(accnt) + ''')');                        
    *inlr = *on;                                        
  /end-free
                                   

CLLE program TESTDOCMD2, compiled with ACTGRP(*CALLER)
--------
PGM        PARM(&ACNT)                                 
DCL        VAR(&ACNT) TYPE(*CHAR) LEN(32)              
SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA(&ACNT) +
             TOPGMQ(*PRV (*PGMBDY *NONE TESTDOCMD)) +  
             MSGTYPE(*COMP)                            
ENDPGM                                                 


Ignatius Kalapurakkel wrote:
Hi Elbert,
 
I tried your code but sorry that didn't work.

Elbert Cook <[EMAIL PROTECTED]> wrote:
'CALL (MYLIB/MYCLPGM)PARM(ACCNT)' is a literal value.

What you need to do is pass the value of the variable.

DoCmd('call mylib/myclpg parm(' + %trimr(accnt) + ')')



--- ignatiuskm <[EMAIL PROTECTED]> wrote:

> I am calling the DoCmd procedure with the following
> code
>
>     C          callp     DoCmd('CALL (MYLIB/MYCLPGM)
> PARM(ACCNT)')
>
> The ACCNT variable have a value in the CGI pgm. But
> when MYLIB/MYCLPGM
> is called, the value is not getting passed to the CL
> pgm. The CL pgm
> starts with   PGM   PARM(&ACCNT).  Please help.
>
> Thanks
> Mathew.


Yahoo! FareChase - Search multiple travel sites in one click.

YAHOO! GROUPS LINKS




Reply via email to