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




Peter,

I think I understand what you're saying, that's why I included the
message written to the job log.  The parms look like they are being
passed correctly so why are the values being combined?  It looks to me
like a parameter mismatch but if it is I'm not seeing it.  Maybe
something isn't honoring the end of parameter marker?

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Peter Levy
Sent: Wednesday, October 25, 2006 11:29 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: Parameters passed not what is received

The error you're getting is because pSubLine is declared as "varying"
and the first two bytes of the parameter do not have a valid
binary length. The string begins with "CPW" but in the dump
it shows that it actually begins with "W", so clearly the
first two characters were mistaken for the length. The binary
of EBCDIC letters "CP" converts to
50135 decimal, which is a lot larger than the 40 bytes you've
declared it as and that's why you're getting the error. This
would work fine if you had one ILE RPG program calling
another because the compiler would catch the error and
possibly perform a conversion, but with a straight CALL
command there is no checking or converting.

What surprises is the very next parameter is also declared as
"varying", but it doesn't exhibit the same behavior in the
dump that the first parameter did, which is very strange.

Rick.Chevalier@xxxxxxxxxxxxxxx wrote:
I'm having a problem with parameters on a submit job
command built in
my RPG program.

The submitting program is building the following submit job command
string.  I have the program send the string to the job log as a CPF
message so I can have a copy of how it was formatted.  The
submitting
program runs in batch normally.
sbmjob job(lo1800r) cmd(call lo1800r ('008' '123456789' 'CPW'
'EMAILBKNG'  'CPW Booking Error for 123456789' 'Booking encountered
the following error(s) for application 123456789.'))

Looks good so far.  When the job runs, however, I receive the
following
error:
Message ID . . . . . . :   RNQ0115       Severity . . . . .
. . :   99

Message type . . . . . :   Inquiry

Date sent  . . . . . . :   10/25/06      Time sent  . . . . . . :
10:02:45


Message . . . . :   Length of varying length variable is
out of range (C
G D
  F).

Cause . . . . . :   The length of a varying length character or DBCS
variable
  is less than 0 or greater than its declared maximum length in RPG
procedure
  LO1800R in program RCHEVA1/LO1800R at statement 015100.  
         

Looking at a dump of the program the values used at line 151 are as
follows.  Note that PSUBLINE now contains additional
information.  It
looks like it has picked up the beginning of field
PPREMSGTXT.  Both
of these values are passed as parms.

PPREMSGTXT            CHAR(128)            'Booking encountered the
following error(s) for application 123456789.           '   
                        81                 '
'                                   
                      VALUE IN HEX

'C29696928995874085958396A495A38599858440A38885408696939396A68
9958740859
99996994D'X  
                        41

'A25D408696994081979793898381A389969540F1F2F3F4F5F6F7F8F94B400
0000000000
000000000'X  
                        81

'0000000000000000000000000000000000000000000000000000000000000
0000000000
000000000'X  
                        121                '0000000000000000'X

PSUBLINE              CHAR(40) VARYING     'W Booking Error for
123456789  Booking e'                                           
                      VALUE IN HEX

'C3D7E640C296969289958740C5999996994086969940F1F2F3F4F5F6F7F8F
94040C2969
692899587'X  
                        41                 '4085'X


Prototype from submitted program:
     d LO1800R         pr                  ExtPgm('LO1800R')

     d                                3a

     d                               15a   Const

     d                               10a   Const

     d                               10a   Const

     d                               40a   Varying Options(*VarSize)

     d                              128a   Varying

     d                                     Options(*Nopass :*Omit
:*VarSize)
     d                              128a   Varying

     d                                     Options(*Nopass
:*VarSize)




Field definitions in submitted program:
     d LO1800R         pi

     d  pBank                         3a

     d  pACFApp                      15a   Const

     d  pKeyKind                     10a   Const

     d  pKeyValue                    10a   Const

     d  pSubLine                     40a   Varying Options(*VarSize)

     d  pPreMsgTxt                  128a   Varying

     d                                     Options(*Nopass :*Omit
:*VarSize)
     d  pPostMsgTxt                 128a   Varying

     d                                     Options(*Nopass
:*VarSize)


Field definitions in submitting program:
      // Call to e-mail program

     d SbmJob1         c                   'sbmjob
job(lo1800r) cmd('

     d SbmJob2         c                   ')'

     d SbmJob3         c                   ' log(4 0 *msg)
logclpgm(*yes)'  
     d Call1           c                   'call lo1800r ('

     d CallCmd         s            384a

     d emKey1          c                   'CPW'

     d emKey2          c                   'EMAILBKNG'

     d emSubLine       c                   'CPW Booking Error for'

     d emSubject       s             40a   Varying

     d emPreMsgTxt     s            128a   Varying

     d emPreMsg        c                   'Booking
encountered the -

     d                                     following error(s) for
application'
     d Qte             c                   x'7D'

     d QteSpcQte       c                   x'7D407D'


Submit:
            // Send error e-mail

            If Status = '02';

              emSubject = emSubLine + ' ' + %Char(pbAppNbr);

              emPreMsgTxt = emPreMsg + ' ' + %Char(pbAppNbr) + '.';



              CallCmd = Call1 + Qte + Bank + QteSpcQte +

                        %Char(pbAppNbr) + QteSpcQte + emKey1 +
QteSpcQte
+
                        emKey2 + QteSpcQte + emSubject + QteSpcQte +

                        emPreMsgTxt + Qte + ')';



              SendEMail = SbmJob1 + %TrimR(CallCmd) + SbmJob2;

              SndPgmMsg(MsgID :MsgF :MsgDta@);

              PrcCmd(SendEMail);

            EndIf;


Any thoughts would be greatly appreciated.

Rick


Privileged and Confidential.  This e-mail, and any
attachments there to, is intended only for use by the
addressee(s) named herein and may contain privileged or
confidential information.  If you have received this e-mail
in error, please notify me immediately by a return e-mail and
delete this e-mail.  You are hereby notified that any
dissemination, distribution or copying of this e-mail and/or
any attachments thereto, is strictly prohibited.
 

--

Peter Levy
Alliance Shippers, IT Dept
Englewood Cliffs, NJ
Voice: 201-227-0400
Fax: 201-227-0925
Email: plevy@xxxxxxxxxxxx
AIM: pklevyalliance2

---------------
There are 10 kinds of people in the world; Those who
understand binary and those who don't.



Privileged and Confidential.  This e-mail, and any attachments there to, is 
intended only for use by the addressee(s) named herein and may contain 
privileged or confidential information.  If you have received this e-mail in 
error, please notify me immediately by a return e-mail and delete this e-mail.  
You are hereby notified that any dissemination, distribution or copying of this 
e-mail and/or any attachments thereto, is strictly prohibited.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.