CL400 PARAM

820 pts.
Tags:
Hi,
I am a beginner on as400. I have a written cl program.Just a normal addition.Here I am supplying values to the program on run time.Every thing is perfect.program is compiling. When I am trying to send parameter values through Call statement, If I enter the value as 6(variable length is 5). It is throwing an error. Instead of 6 I need to code as X'000006F'. Then It is accepting the values & i can see the o/p what I am expecting.Kindly clarify me regarding this.I mean why this is not accepting the value 6 directly. 


Software/Hardware used:
Iseries

Answer Wiki

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

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

    A CALL command cannot have parameter definitions. Every parameter for CALL is undefined. The values do not have structure in memory that CALL knows about. Instead, you must place the value in memory so that it has the structure required by the called program.

    When you code a CALL command in one program so you can call another program, you will pass a variable through a parameter. The variable will be declared in the calling program the same way that the parameter is declared in the called program. Since the declarations are the same in both programs, the memory that holds the value is structured correctly for both programs.

    But the command line has no variables. So when CALL runs on a command line, it places parameter values in memory with a default structure.

    For numeric values in CALL parameters, the value is stored with a default declaration of *DEC (15 5). It has to store it with some definition, and it has no way to know what the called program expects. It uses the default declaration.

    You have two direct options. You can change the DCL in your CL program to be *DEC (15 5) so it matches the default structure. Or you can enter the parameter value as X'00006F' which is the hex memory representation of (6) when it's declared as *DEC (5 0).

    And you also have two indirect options. For one, you can create a new CL program that declares a variable as *DEC (5 0), assigns the value (6) to the variable and passes the variable to your current CL program with CALL. Or for the other option, you can create a *CMD (command) definition that prototypes your parameter value and passes it to your CL program.

    You create *CMD objects in order to extend the CL language. With a *CMD wrapper for your CL program, you would run your new command on the command line instead of using CALL. A major purpose of new *CMDs is to provide the prototyping of parameter values for programs that you write.

    Tom

    125,585 pointsBadges:
    report
  • HABBIE
    Thanks for the Info  Tom
    820 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