Callin CLP with parameter
5 pts.
0
Q:
Callin CLP with parameter
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
ASKED: Oct 15 2009  9:40 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
1050 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
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.

             PGM        PARM(&DEP &OUTQPA)

DCL VAR(&DEP) TYPE(*CHAR) LEN(2)
DCL VAR(&OUTQPA) TYPE(*CHAR) LEN(10)



-------------------------------------------------
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
--------------------------------------------------

But it takes value as F1F44040404040.

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 x'0000000000014F' you should see the intended value pass into the program.

Splat
Last Answered: Oct 16 2009  1:52 AM GMT by Splat   1050 pts.
Latest Contributors: TomLiotta   7675 pts., Infiniumpro   115 pts., Philpl1jb   24540 pts., KasMcc   120 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Chatmaker   695 pts.  |   Oct 15 2009  4:02PM GMT

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)

 

Chatmaker   695 pts.  |   Oct 15 2009  4:04PM GMT

(if called from the command line)

 

TomLiotta   7675 pts.  |   Oct 18 2009  3:36AM GMT

(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

 

Philpl1jb   24540 pts.  |   Oct 18 2009  12:28PM GMT

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

 

Yorkshireman   3200 pts.  |   Oct 20 2009  8:25AM GMT

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.

 
0