QCMDEXC error

2460 pts.
Tags:
#AS400 #RPGLE #as400
Hi Team, I am using below code but it's giving me this error :-*RNF5343 30 1 Array has too many omitted indexes; specification is ignore Code:- SEU==> AP2 FMT D .....DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++++++++++++++ *************** Beginning of data ************************************* 0001.00 DCMD S 9 DIM(1) CTDATA PERRCD(1) 0002.00 D CMDLEN S 15 5 0003.00 DN 1P 0 INZ(0) 0004.00 C N DO 1 0005.00 C EVAL CMDLEN = %LEN(%TRIM(CMD)) 0006.00 C* Execute Command using QCMDEXC 0007.00 C CALL 'QCMDEXC' 0008.00 C PARM CMD 0009.00 C PARM CMDLEN 0010.00 C ENDDO 0011.00 C EVAL *INLR=*ON 0012.00 ** CTDATA CMD 0013.00 wrkactjob ****************** End of data ****************************************

Any idea how to avoid it? and can i specify more than one commands as i am using compile time array here.But currently single command wrkactjob itself not getting executed and program ends up in compilation error itself. any idea/suggestion to correct this error please?

Thanks


Software/Hardware used:
RPGLE-AS/400 V7.3
1

Answer Wiki

Thanks. We'll let you know when a new response is added.
SEU==>                                                                     AP2
 FMT D  …..DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords++++++++++++++++++++
        *************** Beginning of data *************************************
0001.00      DCMD              S              9    DIM(1) CTDATA PERRCD(1)     
0002.00      D CMDLEN          S             15  5                             
0003.00      DN                               1P 0 INZ(0)                      
0004.00      C     N             DO        1                                   
0005.00      C                   EVAL      CMDLEN = %LEN(%TRIM(CMD))           
0006.00      C* Execute Command  using QCMDEXC                                 
0007.00      C                   CALL      ‘QCMDEXC’                           
0008.00      C                   PARM                    CMD                   
0009.00      C                   PARM                    CMDLEN                
0010.00      C                   ENDDO                                         
0011.00      C                   EVAL      *INLR=*ON                           
0012.00 ** CTDATA CMD                                                          
0013.00 wrkactjob                                                              
        ****************** End of data ****************************************
                            

Discuss This Question: 16  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TheRealRaven
    You reference CMD as a PARM, but CMD is an array. QCMDEXC doesn't accept an array as a parm. You need to pass just a single element, i.e., an indexed reference, e.g., CMD(1).
    33,080 pointsBadges:
    report
  • ToddN2000
    What is your purpose of running a WRKACTJOB inside an RPG program? Do you want to display the results or send to a file?
    127,920 pointsBadges:
    report
  • 6r
    main purpose is to understand the use of QCMDEXC API and want to give multiple commands in this compile time array and want to see do they really get executed after this program is run for example if there are 4 commands mentioned subsequently WRKACTJOB,WORKOBJ,WRKOUTQ,WRKUSRPRF,WRKOBJPDM etc.so I want to see do they really get executed one after another as mentioned in the sequence of compile time array. 
    So if I pass them as CMD(i) as an index and run in loop like for i=1 to 4 will all of 
    the commands if i declare in this compile time array be executed one after another?
    2,460 pointsBadges:
    report
  • ToddN2000
    in your EVAL command, where is the index for CMD? Also you would need it on the PARM. Even though you only have one element in the array you still need the index if I remember.. 

    EVAL      CMDLEN = %LEN(%TRIM(CMD(1))) 

    PARM                    CMD(1)

    127,920 pointsBadges:
    report
  • ToddN2000
    We had something similar. Instead of creating a table, we put the options in a file. We read the file, moved the value to the parameter and ran the QCMDEXE.  Read the file again and repeat until they all were processed. The reason for going this way was there is no need to edit and recompile the program if changes to the parameters were needed. Just edit the file and you were good to go,
    127,920 pointsBadges:
    report
  • 6r
    Now the error is "*RNF3703 20 a      000300  The subfield or parameter definition is not specifi 
                               within a group."     
    2,460 pointsBadges:
    report
  • TheRealRaven
    We need to see enough code around the point of error to know what the error refers to. Please post the relevant source lines.
    33,080 pointsBadges:
    report
  • 6r
                 D CMD              S              9    DIM(1) CTDATA PERRCD(1)     
    0002.00      D CMDLEN          S             15  5                             
    0003.00      DN                               1P 0 INZ(0)                      
    0004.00      C     N             DO        1                                   
    0005.00      C                   EVAL      CMDLEN = %LEN(%TRIM(CMD(1)))           
    0006.00      C* Execute Command  using QCMDEXC                                 
    0007.00      C                   CALL      ‘QCMDEXC’                           
    0008.00      C                   PARM                    CMD(1)                   
    0009.00      C                   PARM                    CMDLEN                
    0010.00      C                   ENDDO                                         
    0011.00      C                   EVAL      *INLR=*ON                           
    0012.00 ** CTDATA CMD                                                          
    0013.00 wrkactjob                                                              
            ****************** End of data ****************************************
                                
    
    2,460 pointsBadges:
    report
  • 6r
    i used this advice:-

    ToddN2000  May 1, 2019   11:54 AM GMT
    in your EVAL command, where is the index for CMD? Also you would need it on the PARM. Even though you only have one element in the array you still need the index if I remember.. 

    EVAL      CMDLEN = %LEN(%TRIM(CMD(1))) 

    PARM                    CMD(1)
    2,460 pointsBadges:
    report
  • 6r
    so any idea/suggestion to remove this error from above pasted code please?

    Thanks
    2,460 pointsBadges:
    report
  • 6r
    Any updates team please?
    2,460 pointsBadges:
    report
  • 6r
    any iseries/AS/400 expert could you please guide how to remove this error?
    2,460 pointsBadges:
    report
  • ToddN2000
    @6r: Have you tried running the program in debug mode to see what the parameter values are? If it does not like the cmd(1) as a parm then you can try moving that to a work field and use that as the first parm in you parameter list. 
    127,920 pointsBadges:
    report
  • TheRealRaven
    It's difficult to be sure what code is throwing the error. It seems that the latest error is:
    "*RNF3703 20 a      000300  The subfield or parameter definition is not specified
                                within a group."
    And if that error refers to this code:
    0003.00      DN                               1P 0 INZ(0)
    ...(since the error eferences sequence# 000300), then all that needs to be done is to follow the recovery instructions in message ID RNF3703. No need to ask what to do here.

    Always check the Cause: and Recovery: portions of an error message description.
    33,080 pointsBadges:
    report
  • 6r
    to debug atleast it should be compiled first but it's not getting compiled itself due to the latest error which is coming like "*RNF3703 20 a 000300 The subfield or parameter definition is not specified
                                within a group."
    where as parameter definition is specified whatelse i need to specify to remove this error it's very tough error seems to be removed.
    2,460 pointsBadges:
    report
  • ToddN2000
    TRy something like this. It's a bit simpler and it compiles
         HDEBUG OPTION(*SRCSTMT:*NODEBUGIO)                           
         D CMD             S              9    DIM(1) CTDATA PERRCD(1)
         D CMDPARM         S             15                           
         D CMDLEN          S             15  5 INZ(80)                
         D N                              1P 0 INZ(0)                 
         C     N             DO        1                              
         C* Execute Command  using QCMDEXC                            
         C                   MOVEL     CMD(1)        CMDPARM          
         C                   CALL      'QCMDEXC'                      
         C                   PARM                    CMDPARM          
         C                   PARM                    CMDLEN           
         C                   ENDDO                                    
         C                   EVAL      *INLR=*ON                      
    ** CTDATA CMD                                                     
    wrkactjob                                                         
    127,920 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: