Callin CLP with parameter

5 pts.
Tags:
CL programming
CL programs
DDS
Hi,

I have a CL program which needs two Parametersa as a input, when i call a pgm with values, the value are not properly passed. It gives me decimal data error.

For instance i gave values as

Call pgm(clpgm) Parm('14' 'aaaaa')

But it takes value as F1F44040404040.

Hel me out soon.

Thanks in advance

 

 

 



Software/Hardware used:
AS400

Answer Wiki

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

If you are receiving a data decimal error, then the expected parm is numeric. CLP passing parms should always be character (IMHO) whenever possible or set at 15.5 as a numeric, because a numeric parm is expected to be 15.5 in length and decimals.

Infiniumpro@hotmail.com

++++++++++++++++++++++++++
Previous response::

How have you declared the parameters in the programs ?

E.g.

<pre> PGM PARM(&DEP &OUTQPA)

DCL VAR(&DEP) TYPE(*CHAR) LEN(2)
DCL VAR(&OUTQPA) TYPE(*CHAR) LEN(10)</pre>

————————————————-
This should give you an idea. Last weeks discussion on this general topic.

http://itknowledgeexchange.techtarget.com/itanswers/why-do-i-have-such-a-problem-with-passing-to-a-program-a-8-byte-field-using-a-parm/

Phil
————————————————–

<i>But it takes value as F1F44040404040.</i>

Because that is the value that you supplied, it is the value that you should expect. Commands should not be entered when they are not understood. CALL is a command.

The [help] text associated with CALL explains in some detail what you are seeing. (If you don’t know how to use [help], then the CL Programming manual is also available. The full detail is in the manual as well as in the Info Center for your release.)

Tom

——————————————————————————————————————————————-

CL programs treat decimal variables as packed. I’m not sure what length your incoming numeric parameter is but, based on the value you posted, if you enter the parameter on the command line as <b>x’0000000000014F’</b> you should see the intended value pass into the program.

Splat

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
  • Craig Hatmaker
    Call pgm(clpgm) Parm('14' 'aaaaa') Remove quotes from 14 - evidently the program you're calling defines the first variable as numeric but you are passing it as character. The call should look like: Call pgm(clpgm) Parm(14 'aaaaa') Caveat: the first parameter in the program called must be defined as *DEC (15, 5)
    1,710 pointsBadges:
    report
  • Craig Hatmaker
    (if called from the command line)
    1,710 pointsBadges:
    report
  • TomLiotta
    (if called from the command line) To clarify, it should work the same if the same CALL command is compiled or submitted to batch. I don't think the command line is the important element -- the omission of declared variables should be the important element. Command-line execution is the most common way, though SBMJOB is probably close. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    There needs to be agreement between the passed parameters and the receiving parameters. In numerc types the receiving program will place it's map over the memory location passed to it so the types, lengths, and decimals need to be consistant. Call pgm(clpgm) Parm(x'014F' 'aaaaa') would work if you declare fld1 as *DEC 2 0 or Call pgm(clpgm) Parm(14 'aaaaa') would work if you declare fld1 as 15 5 or Call pgm(clpgm) Parm('14' 'aaaaa') would work if you declare fld1 as *char 2 Phil
    49,730 pointsBadges:
    report
  • Yorkshireman
    This is a basic, fundamental error. any issue about parameter passing starts with 1) are the sender and receiver defining the location identically ? 2) are you data typing the values correctly and 3) Do I understand what I'm seeing? 4) Do I understand what I'm writing? Numeric parms do NOT need to be 15,5 - neither do alpha parms need to be 32. Anyone who thinks so needs to go read the manuals so helpfully provided by IBM. the value you are sending in is alphameric, wheras the function is ecpecting a packed decimal. As you are using a command line, you need to key enetr the correct data type for the parm. -= others have helpfully provided 'how to's for you.
    5,580 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