Getting the number of records from CL

770 pts.
Tags:
AS/400
I want to get the number of records from the CL program.I used the following code however I am getting the error. Please suggest the solution PGM DCL VAR(&RCDCOUNT) TYPE(*CHAR) LEN(10) VALUE('0') RTVMBRD FILE(ATANEJA/SAME1) NBRCURRCD(&RCDCOUNT) SNDMSG MSG(&RCDCOUNT) TOUSR(ATANEJA) ENDPGM Error code is : CPD0783

Software/Hardware used:
AS400

Answer Wiki

Thanks. We'll let you know when a new response is added.

Now convert &RCDCOUNT to *Char and use that in the MSG parm

Discuss This Question: 5  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    The solution is to follow the instructions from the CPD0783 message. What happens when you do what the message says? -- Tom
    125,585 pointsBadges:
    report
  • ankit2002
    @Tom: CPD0783 30  Variable &RCDCOUNT for parameter NBRCURRCD must be TYPE(*DEC), LEN(10,0).   After getting the above error I changed the code to   DCL VAR(&RCDCOUNT) TYPE(*DEC) LENGTH(10 0) VALUE(0)   However after changing the type of variable i got the following error:   * CPD0776 30  Variable &RCDCOUNT for parameter MSG must be *CHAR.
    770 pointsBadges:
    report
  • philpl1jb
    You'll pobably need two variables, one *DEC 10 0, the second *CHAR 10 three commands 1.  Get the number of records into the *DEC 10 0 2.  Change the value of the character field to the value in the *DEC field 3.  Send the message Phil
    49,550 pointsBadges:
    report
  • TomLiotta
    The error messages include the source line numbers where the errors are found. You should be able to see that the two errors are on two different lines. They happen at different times depending on how you define &RCDCOUNT.   The RTVMBRD command can only place its numeric results into numeric variables. But SNDMSG can only use character variables for its message text variables.   The solution is to have two variables, one for each command. Convert the value in the numeric variable into a character value in a second variable. That will satisfy both commands.   Phil gave the basic sequence. BTW, every one of us ran into the same problem when we were learning.   Tom
    125,585 pointsBadges:
    report
  • iiiiiiiiiiiii
    PGM                                                       DCL        VAR(&RCDCNT1) TYPE(*DEC) LEN(10 0)             DCL        VAR(&RCDCNT) TYPE(*CHAR) LEN(10) VALUE('0')    RTVMBRD    FILE(ARCPGM/BATCHPF) NBRCURRCD(&RCDCNT1)       CHGVAR     VAR(&RCDCNT) VALUE(&RCDCNT1)                   SNDMSG     MSG(&RCDCNT) TOUSR(ARCUSER)                    ENDPGM                                                    Please try this code
    335 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following