× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jim. This goes all the way back to the System 38. When a program is called
from the command line, the command processor has no way of knowing what the
type or size of the variables is so it applies two rules. 

1. If the value is quote marks or contains any alpha characters, it is a
alpha value and the length that is passed is the length of the string.
2. If not, then it is numeric. Since the command processor doesn't know what
the size is, it always passes everything as a packed 15/5 field. That is why
you are getting decimal errors. You have a pointer pointing to a packed 15/5
field trying to process as a 6/2 zoned. It gets upset about that. 

Note: This problem does not occur if you calling the program from another
program because it knows what the type and size are for each field. 

The solution can be one of the following.

1. Create a command to make the call. Anything called from the command I
always use a command front end. 

2. Define the zone fields as alpha and pass them as strings, then convert
them in program to packed.

The same thing happens if you do a SBMJOB with numeric parameters and you
are not using a CL program to do the submit.  

As a side note, you can also get burned on alpha field. Say you define a
field in your program as char(50) and then on the command line you type,
'TestString1'. 

What gets passed to the program is a pointer to an char(11) but your program
thinks it is a char(50). What ends up happening is that you end up including
the next characters in memory, no matter what they are! One of our
programmer blew six hours yesterday because of this problem.
 
Hope this helps. 

-----Original Message-----
From: Jim Langston [mailto:jlangston@conexfreight.com]
Sent: Wednesday, January 19, 2000 1:05 PM
To: RPG400-L@midrange.com
Subject: Entry Parameters


V3R7M0  RPGLE

I wrote an RPGLE program that is supposed to accept four
numeric values as parameters.

D FromCompNum     S         2S 0
D FromBatch       S         6S 0
D ToCompNum       S         2S 0
D ToBatch         S         6S 0

C    *Entry    PList
C              Parm       FromCompNum
C              Parm       FromBatch
C              Parm       ToCompNum
C              Parm       ToBatch

C              If         APComp = FromCompNum And
C                         APBatc = FromBatch
<SNIP>

I call it thustly:

CALL PGM(JIMCONEX/CHGAPOPEN) PARM(51 990110 51 000120)

The If statement bombs with a Decimal Data Error.  Putting it in Debug
Mode, I see that my four parameters contain garbage.  How am I supposed
to call this thing?  Do I have to pass them as character strings?  If
so, I would
create a Data Structure Like:

D                     DS
D                                  FromCompNum    1    2S 0
D                                  FromCompAsStr   1    2

Then put FromCompAsStr in my Parm statement.  Is this what I have to do?

I know this will work, I have done it in the past, and will do it now
while
waiting for a response, but isn't there another way?

Regards,

Jim Langston

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator:
david@midrange.com
+---
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.