|
Thanks for the Info on the API
Here is what I have changed the d specs to
D*------------------------
D* Message Subfile Parms *
D*------------------------
D msgId s 7A INZ('CPF9898')
D msgLoc s 20A inz('QCPFMSG *LIBL ')
D msgRplDta s 3000A
D msgRplDtaLen s 10i 0 inz(0)
D msgType s 10A inz('*DIAG')
D msgQueue s 276A inz('*')
D msgCallStack s 10i 0 inz(0)
D msgKey s 4A inz(' ')
D msgErr ds
D msge1 s 10i 0 inz(0)
D msge2 s 10i 0 inz
D msgrmv s 10A inz('*ALL')
D*---------------------------------------------
Here are my calcs - Eval Statements are her to force those values when I
debuged the Program
I saw that some values were being reset from what I initialized them as
in the D Specs
Probably data back from QMHRMVPM
0615.00 C If ErrFlg= 'Y'
0616.00 C Eval msgRplDta = 'Business Unit not on
File'
0617.00 C Eval msgRplDtaLen =
%len(%TRIM(msgRplDta))
0618.00 C Eval msgID = 'CPF9898'
0619.00 C Eval msge1 = 0
0620.00 C eval msgKey = *blanks
0621.00 C Exsr sndmsg
0622.00 C Iter
0623.00 C ENDIF
Error Condition
0624.00 C* -----
Here is the call
0631.00 C* Send message subroutine
0632.00 C*
0633.00 C sndmsg begsr
0634.00 C*
0635.00 C call 'QMHSNDPM'
0636.00 C parm msgId
0637.00 C parm msgLoc
0638.00 C parm msgRplDta
0639.00 C parm msgRplDtaLen
0640.00 C parm msgType
0641.00 C parm msgQueue
0642.00 C parm msgCallStack
0643.00 C parm msgKey
0644.00 C parm msgErr
0645.00 C*
0646.00 C endsr
0647.00 C* -----
0648.00 C*----------------------------
I still do not get the message to display when the error condition
exists - What am I missing
Thanks for your assistance
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of
rpg400-l-request@xxxxxxxxxxxx
Sent: Friday, February 11, 2005 10:27 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RPG400-L Digest, Vol 4, Issue 184
Send RPG400-L mailing list submissions to
rpg400-l@xxxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.midrange.com/mailman/listinfo/rpg400-l
or, via email, send a message with subject or body 'help' to
rpg400-l-request@xxxxxxxxxxxx
You can reach the person managing the list at
rpg400-l-owner@xxxxxxxxxxxx
When replying, please edit your Subject line so it is more specific than
"Re: Contents of RPG400-L digest..."
Today's Topics:
1. sqlrpgle & copy book (SRamanujan@xxxxxxxxxxxxxxxxxx)
2. Re: Message Subfile (Scott Klement)
3. AW: sqlrpgle & copy book (HauserSSS)
4. RE: sqlrpgle & copy book (Rick.Chevalier@xxxxxxxxxxxxxxx)
5. RE: sqlrpgle & copy book (SRamanujan@xxxxxxxxxxxxxxxxxx)
6. RE: sqlrpgle & copy book (SRamanujan@xxxxxxxxxxxxxxxxxx)
7. RE: sqlrpgle & copy book (rob@xxxxxxxxx)
8. RE: sqlrpgle & copy book (SRamanujan@xxxxxxxxxxxxxxxxxx)
----------------------------------------------------------------------
message: 1
date: Thu, 10 Feb 2005 16:32:13 -0600
from: <SRamanujan@xxxxxxxxxxxxxxxxxx>
subject: sqlrpgle & copy book
Hi all,
When I have a copy book that has the data structure, and fetch into the
ds, I get a sql pre-compiler error SQL0312 'The DSNAME is not define or
not usable' Is there anyway to avoid this? Thanks, Sudha
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
------------------------------
message: 2
date: Thu, 10 Feb 2005 17:48:06 -0600 (CST)
from: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
subject: Re: Message Subfile
There are 3 mistakes in your code that jump out at me:
a) Everywhere you have a field defined as "4B 0" it's wrong. Change
them
all to "10I 0". Whenever API documentation says BINARY(4) it's
referring
to RPG's "10I 0" data type. (Any time you find yourself coding "4B 0"
stop yourself, because it's probably a mistake. This is the #1
most common question posted to this mailing list!)
b) Remove the word "VARYING" from your definition of msgRplDta, since
the
API does not allow the varying data type. That also means that you have
to trim your field when you calculate the length. i.e. change
%len(msgRplDta) to %len(%trimr(msgRplDta))
c) the error code field "msgErr" needs to be at least 8 bytes long.
Yours
is currently defined as 2 bytes long. Make it a data structure
containing
two "10I 0" fields, and set the first one to zero.
Those are the only bugs that stand out, but I've got another suggestion
as
well:
Please consider writing a prototype for the API, and using that instead
of
CALL/PARM. That way you can re-use the prototype later and it will
protect you and other people who use this API from making the same
mistakes. It also will make it possible to use the API in free format
RPG
if you ever want to do that.
That advice applies to all other program calls as well, not just this
API.
Hope that helps
On Thu, 10 Feb 2005, Ala, Michael A wrote:
>
> I am trying to Write a Program Message to CPF9898 to display in a
> message subfile
>
> It Is not Displaying
>
> Here are my D specs
> D msgId s 7A INZ('CPF9898')
> D msgLoc s 20A inz('QCPFMSG *LIBL ')
> D msgRplDta s 3000A Varying
> D msgRplDtaLen s 4B 0 inz(0)
> D msgType s 10A inz('*INFO')
> D msgQueue s 276A inz('*')
> D msgCallStack s 4B 0 inz(0)
> D msgKey s 4A inz(' ')
> D msgErr s 4B 0 inz(0)
> D msgrmv s 10A inz('*ALL')
>
> call 'QMHSNDPM'
> parm msgId
> parm msgLoc
> parm msgRplDta
> parm msgRplDtaLen
> parm msgType
> parm msgQueue
> parm msgCallStack
> parm msgKey
> parm msgErr
------------------------------
message: 3
date: Fri, 11 Feb 2005 07:11:22 +0100
from: "HauserSSS" <Hauser@xxxxxxxxxxxxxxx>
subject: AW: sqlrpgle & copy book
Hi Sudha,
do you use a qualified data structure or is the data structure defined
in a nested data structure. If so, you must be on release VR3M0 to get
it to work.
Before Release V5R2M0 you have to define a non qualified data structure.
If you don't use nested copy books, the data structure can be defined in
a copy book.
Birgitta
-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von
SRamanujan@xxxxxxxxxxxxxxxxxx
Gesendet: Donnerstag, 10. Februar 2005 23:32
An: rpg400-l@xxxxxxxxxxxx
Betreff: sqlrpgle & copy book
Hi all,
When I have a copy book that has the data structure, and fetch into the
ds, I get a sql pre-compiler error SQL0312 'The DSNAME is not define or
not usable' Is there anyway to avoid this? Thanks, Sudha
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
------------------------------
message: 4
date: Fri, 11 Feb 2005 08:08:01 -0600
from: <Rick.Chevalier@xxxxxxxxxxxxxxx>
subject: RE: sqlrpgle & copy book
Also make sure the sub fields are defined in your copybook. I have not
been able to use externally defined data structures as result sets for
embedded SQL. The compiler always complains they aren't defined or
usable.
I vaguely remember someone posting to this list that they got embedded
SQL to work using an externally described DS as the result set but I may
be mistaken. Check the archives, this has been discussed several times
before.
Rick
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of
SRamanujan@xxxxxxxxxxxxxxxxxx
Sent: Thursday, February 10, 2005 4:32 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: sqlrpgle & copy book
Hi all,
When I have a copy book that has the data structure, and fetch into the
ds, I get a sql pre-compiler error SQL0312 'The DSNAME is not define or
not usable' Is there anyway to avoid this? Thanks, Sudha
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
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 legally 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.
------------------------------
message: 5
date: Fri, 11 Feb 2005 09:06:01 -0600
from: <SRamanujan@xxxxxxxxxxxxxxxxxx>
subject: RE: sqlrpgle & copy book
Thanks Birgitta,
We are on v5r3, I have a simple non qualified ds and I don't have nested
ds either. Something like below and it does not compile. Once I put
the DS within the sqlrpgle, it works. Thanks, Sudha
Rpgle.myds
dfieldDs ds
d field1 5a
d field2 15p 2
d field3 30a
sqlrpgle :
/copy rpgle,myds
*
d myDsNullI ds
d based(myDsNullAd)
d myNullAry 5i 0 dim(21)
c/exec sql declare c cursor for select * from filea for read only
c/end-exec c/exec sql open c c/end-exec c/exec sql fetch next from c
into :fields :myNullAry c/end-exec c/exec sql close c c/end-exec
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
-----Original Message-----
From: HauserSSS [mailto:Hauser@xxxxxxxxxxxxxxx]
Sent: Friday, February 11, 2005 12:11 AM
To: RPG programming on the AS400 / iSeries
Subject: AW: sqlrpgle & copy book
Hi Sudha,
do you use a qualified data structure or is the data structure defined
in a nested data structure. If so, you must be on release VR3M0 to get
it to work.
Before Release V5R2M0 you have to define a non qualified data structure.
If you don't use nested copy books, the data structure can be defined in
a copy book.
Birgitta
-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von
SRamanujan@xxxxxxxxxxxxxxxxxx
Gesendet: Donnerstag, 10. Februar 2005 23:32
An: rpg400-l@xxxxxxxxxxxx
Betreff: sqlrpgle & copy book
Hi all,
When I have a copy book that has the data structure, and fetch into the
ds, I get a sql pre-compiler error SQL0312 'The DSNAME is not define or
not usable' Is there anyway to avoid this? Thanks, Sudha
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
------------------------------
message: 6
date: Fri, 11 Feb 2005 09:07:19 -0600
from: <SRamanujan@xxxxxxxxxxxxxxxxxx>
subject: RE: sqlrpgle & copy book
Thanks Rick, -s
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
-----Original Message-----
From: Rick.Chevalier@xxxxxxxxxxxxxxx
[mailto:Rick.Chevalier@xxxxxxxxxxxxxxx]
Sent: Friday, February 11, 2005 8:08 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: sqlrpgle & copy book
Also make sure the sub fields are defined in your copybook. I have not
been able to use externally defined data structures as result sets for
embedded SQL. The compiler always complains they aren't defined or
usable.
I vaguely remember someone posting to this list that they got embedded
SQL to work using an externally described DS as the result set but I may
be mistaken. Check the archives, this has been discussed several times
before.
Rick
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of
SRamanujan@xxxxxxxxxxxxxxxxxx
Sent: Thursday, February 10, 2005 4:32 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: sqlrpgle & copy book
Hi all,
When I have a copy book that has the data structure, and fetch into the
ds, I get a sql pre-compiler error SQL0312 'The DSNAME is not define or
not usable' Is there anyway to avoid this? Thanks, Sudha
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
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 legally 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.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
------------------------------
message: 7
date: Fri, 11 Feb 2005 10:16:17 -0500
from: rob@xxxxxxxxx
subject: RE: sqlrpgle & copy book
You are doing a /copy and not a /include, right?
Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
<SRamanujan@xxxxxxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
02/11/2005 10:06 AM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
<rpg400-l@xxxxxxxxxxxx>
cc
Subject
RE: sqlrpgle & copy book
Thanks Birgitta,
We are on v5r3, I have a simple non qualified ds and I don't have nested
ds either. Something like below and it does not compile. Once I put
the DS within the sqlrpgle, it works. Thanks, Sudha
Rpgle.myds
dfieldDs ds
d field1 5a
d field2 15p 2
d field3 30a
sqlrpgle :
/copy rpgle,myds
*
d myDsNullI ds
d based(myDsNullAd)
d myNullAry 5i 0 dim(21)
c/exec sql declare c cursor for select * from filea for read only
c/end-exec c/exec sql open c c/end-exec c/exec sql fetch next from c
into :fields :myNullAry c/end-exec c/exec sql close c c/end-exec
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
-----Original Message-----
From: HauserSSS [mailto:Hauser@xxxxxxxxxxxxxxx]
Sent: Friday, February 11, 2005 12:11 AM
To: RPG programming on the AS400 / iSeries
Subject: AW: sqlrpgle & copy book
Hi Sudha,
do you use a qualified data structure or is the data structure defined
in a nested data structure. If so, you must be on release VR3M0 to get
it to work.
Before Release V5R2M0 you have to define a non qualified data structure.
If you don't use nested copy books, the data structure can be defined in
a copy book.
Birgitta
-----Ursprungliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]Im Auftrag von
SRamanujan@xxxxxxxxxxxxxxxxxx
Gesendet: Donnerstag, 10. Februar 2005 23:32
An: rpg400-l@xxxxxxxxxxxx
Betreff: sqlrpgle & copy book
Hi all,
When I have a copy book that has the data structure, and fetch into the
ds, I get a sql pre-compiler error SQL0312 'The DSNAME is not define or
not usable' Is there anyway to avoid this? Thanks, Sudha
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
------------------------------
message: 8
date: Fri, 11 Feb 2005 09:26:06 -0600
from: <SRamanujan@xxxxxxxxxxxxxxxxxx>
subject: RE: sqlrpgle & copy book
Ok I checked the Archives and found to use /include instead of /copy but
I still get the error SQL0312 'Fields is not defined or not usable'.
What am I doing wrong. My code looks now as:
Rpgle.myds
dfieldDs ds
d field1 5a
d field2 15p 2
d field3 30a
sqlrpgle :
/include rpgle,myds
*
d myDsNullI ds
d based(myDsNullAd)
d myNullAry 5i 0 dim(21)
c/exec sql declare c cursor for select * from filea for read only
c/end-exec
c/exec sql open c
c/end-exec
c/exec sql fetch next from c into :fields :myNullAry
c/end-exec
c/exec sql close c
c/end-exec
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
-----Original Message-----
From: Rick.Chevalier@xxxxxxxxxxxxxxx
[mailto:Rick.Chevalier@xxxxxxxxxxxxxxx]
Sent: Friday, February 11, 2005 8:08 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: sqlrpgle & copy book
Also make sure the sub fields are defined in your copybook. I have not
been able to use externally defined data structures as result sets for
embedded SQL. The compiler always complains they aren't defined or
usable.
I vaguely remember someone posting to this list that they got embedded
SQL to work using an externally described DS as the result set but I may
be mistaken. Check the archives, this has been discussed several times
before.
Rick
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of
SRamanujan@xxxxxxxxxxxxxxxxxx
Sent: Thursday, February 10, 2005 4:32 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: sqlrpgle & copy book
Hi all,
When I have a copy book that has the data structure, and fetch into the
ds, I get a sql pre-compiler error SQL0312 'The DSNAME is not define or
not usable' Is there anyway to avoid this? Thanks, Sudha
Sudha Ramanujan
SunGard Futures Systems
sramanujan@xxxxxxxxxxxxxxxxxx
(312) 577 6179
(312) 577 6101 - Fax
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 legally 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.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
------------------------------
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) digest
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
End of RPG400-L Digest, Vol 4, Issue 184
****************************************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.