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



 A while back I had a question about this recently I can across a good
example of how to use this api

So here it is
Any message that is not sent as an *ESCAPE, *STATUS, or *NOTIFY message
can be sent as an impromptu message, Russell. Here's a short program you
can play with. The display file is the JKL001D file from the March 29,
2002, "Odds and Ends" column. 

A                                      DSPSIZ(24 80 *DS3)
A          R FORMAT01
A                                      CA03(03)
A                                      OVERLAY
A                                  1 31'Generate Some Report'
A                                  1 72DATE
A                                      EDTCDE(Y)
A                                  2 72TIME
A                                  5  8'Enter range of dates in MMDDYY
for-
A                                      mat. You may leave ending date'
A                                  6  8'blank if the report is to be run
f-
A                                      or only one day.'
A                                  8  8'Beginning date
...................-
A                                      ...........:'
A            SBGNDATE       6Y 0B  8 55EDTCDE(4)
A                                  9  8'Ending date
......................-
A                                      ...........:'
A            SENDDATE       6Y 0B  9 55EDTCDE(4)
A                                 22  6'F3=Cancel request'
A                                 22 27'Enter=Generate report'
A
A          R MSGSFL                    SFL
A                                      SFLMSGRCD(24)
A            MSGKEY                    SFLMSGKEY
A            PGMNAM                    SFLPGMQ
A
A          R MSGCTL                    SFLCTL(MSGSFL)
A                                      SFLSIZ(0010)
A                                      SFLPAG(0001)
A                                      OVERLAY
A                                      SFLDSP
A                                      SFLDSPCTL
A                                      SFLINZ
A N87                                  SFLEND
A            PGMNAM                    SFLPGMQ(10)

Notice the SFLPGMQ keywords in both the subfile and subfile control
formats. I attached the field name PGMNAM to both of them. (This is a
habit from my RPG III days, when the maximum allowable length of
variable names was six characters.) This variable gets its value from
the program status data structure of the RPG program. 

Here's the RPG source code. I compiled it with Create Bound RPG Program
(CRTBNDRPG) command to run in the default activation group. I only
included one test for an error--in a production environment, there would
be more, of course. 

FJKL001D   cf   e             workstn

D Error           s               n

D ErrorDS         ds            16
D   BytesProv                   10i 0 inz(%size(ErrorDS))
D   BytesAvail                  10i 0
D   ExceptionID                  7

D                sds
D  PgmNam           *proc
D
D Msg             s             78
D
D SendMsg         pr                  extpgm('QMHSNDPM')
D   MsgID                        7a   const
D   MsgF                        20a   const
D   MsgData                     30a   const
D   MsgDataLen                  10i 0 const
D   MsgType                     10a   const
D   CallStackEnt                10a   const
D   CallStackCtr                10i 0 const
D   MsgKey                       4a   const
D   Error                             like(ErrorDS)

D ClrMsgQ         pr                  extpgm('QMHRMVPM')
D   MsgQueue                   276a   const
D   CallStack                   10i 0 const
D   MsgKey                       4a   const
D   MsgRmv                      10a   const
D   Error                             like(ErrorDS)

 /free
   dow '0' = '0';
     exfmt format01;
     // clear msg subfile
     callp  ClrMsgQ ('*': *zero: *blanks: '*ALL': ErrorDS);
     if *in03;
        leave;
     endif;
     // ++++++++ calcs to verify data go here ++++++++
     error = *off;
     if (sbgndate = *zero);
        error = *on;
        msg = 'Beginning date must not be blank.';
     endif;
     // ----------------------------------------------
     if not error;
        leave;
     endif;
     callp  SendMsg (*blanks: *blanks :
            Msg : %size(Msg):
            '*INFO': '*':
             0: *blanks: ErrorDS);
     write msgctl;
   enddo;

  if not *in03;
    // do what needs to be done
  endif;

  *inlr = *on;
 /end-free




-----Original Message-----
From: rpg400-l-bounces+michael.ala=bp.com@xxxxxxxxxxxx
[mailto:rpg400-l-bounces+michael.ala=bp.com@xxxxxxxxxxxx] On Behalf Of
rpg400-l-request@xxxxxxxxxxxx
Sent: Friday, March 18, 2005 2:15 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RPG400-L Digest, Vol 4, Issue 307

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. Re: Proper way to die... (Simon Coulter)
   2. Data translation question (Paul Jackson)
   3. RE: Data translation question (Bob Cozzi)
   4. RE: Data translation question (Paul Jackson)
   5. RE: Data translation question (Bob Cozzi)
   6. comments in rpgle program  (kurien)
   7. Re: comments in rpgle program (Peter Colpaert)
   8. Re: data pointer vs userspace (Scott Klement)
   9. RE: data pointer vs userspace (Scott Klement)


----------------------------------------------------------------------

message: 1
date: Fri, 18 Mar 2005 08:35:41 +1100
from: Simon Coulter <shc@xxxxxxxxxxxxxxxxx>
subject: Re: Proper way to die...


On 18/03/2005, at 7:40 AM, Rich Duzenbury wrote:

> I also tried *CTLBDY and *PGMBDY, they work the same as setting the 
> call stack entry to the program name, and the call stack count to 1.  
> That is, the application doesn't throw an inquiry message, but instead

> a
> CEE9901 INFO message on the message line after the program ends - 
> 'Application error. CPF9898 ummonitored by ZZZ_PH at statement *N, 
> instruction x'0000'.

Using *PGMBDY is the correct way to do what you want. *CTLBDY appears to
give the same behaviour in this case but may not always do that when you
start messing with activation groups.

I'll bet you are calling this from within PDM. PDM receives the *ESCAPE
message and converts it to *INFO (UIM panels often do the same). Call it
from QCMD or from another program and I think you'll get the effect you
desire.

Regards,
Simon Coulter.
--------------------------------------------------------------------
    FlyByNight Software         AS/400 Technical Specialists

    http://www.flybynight.com.au/
    Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
    Fax:   +61 3 9419 0175                                   \ /
                                                              X
                  ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------




------------------------------

message: 2
date: Thu, 17 Mar 2005 13:14:36 -0800
from: Paul Jackson <pjackson@xxxxxxxxxx>
subject: Data translation question

I am calling API QSYRUSRI to get the user profile Home Directory, but
the structure that the info comes back into has the directory name
formatted as CCSID 1200.

I am looking at various API's but am wondering what the consensus seems
to be regarding the best way to translate this data back into human
readable form.

Thanks in advance for any suggestions.

Paul


------------------------------

message: 3
date: Thu, 17 Mar 2005 16:41:34 -0600
from: "Bob Cozzi" <cozzi@xxxxxxxxx>
subject: RE: Data translation question

If you have the RPG xTools, you can use the xLateCCSID subprocedure to
"just do it". If not, you can call a number of different APIs to do the
conversion for you. The one xlateCCSID uses under the covers is iconv().

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Paul Jackson
Sent: Thursday, March 17, 2005 3:15 PM
To: 'RPG400-L@xxxxxxxxxxxx'
Subject: Data translation question

I am calling API QSYRUSRI to get the user profile Home Directory, but
the structure that the info comes back into has the directory name
formatted as CCSID 1200.

I am looking at various API's but am wondering what the consensus seems
to be regarding the best way to translate this data back into human
readable form.

Thanks in advance for any suggestions.

Paul
--
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: Thu, 17 Mar 2005 15:43:52 -0800
from: Paul Jackson <pjackson@xxxxxxxxxx>
subject: RE: Data translation question

Thanks Bob,

I was contemplating the iconv() api's also. Do you happen to have
example
usage of these api's? (we don't have xTools)

Thanks

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Bob Cozzi
Sent: Thursday, March 17, 2005 2:42 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Data translation question


If you have the RPG xTools, you can use the xLateCCSID subprocedure to
"just
do it". If not, you can call a number of different APIs to do the
conversion
for you. The one xlateCCSID uses under the covers is iconv().

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Paul Jackson
Sent: Thursday, March 17, 2005 3:15 PM
To: 'RPG400-L@xxxxxxxxxxxx'
Subject: Data translation question

I am calling API QSYRUSRI to get the user profile Home Directory, but
the
structure that the info comes back into has the directory name formatted
as
CCSID 1200.

I am looking at various API's but am wondering what the consensus seems
to
be regarding the best way to translate this data back into human
readable
form.

Thanks in advance for any suggestions.

Paul
-- 
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: 5
date: Thu, 17 Mar 2005 20:10:48 -0600
from: "Bob Cozzi" <cozzi@xxxxxxxxx>
subject: RE: Data translation question

I don't think I have any open source that uses iconv() in RPG IV, but
here's
a link to a C example... RPG IV isn't really all that much different
today.

http://www.delorie.com/gnu/docs/glibc/libc_101.html

To use the xTools, do this:

Callp  xLateCCSID(szHomeDir : szOutDir : %size(szHomeDir) : 1200 : 0)

This would convert the text from CCSID 1200 in szHOMEDIR to the CCSID of
your job and copy that converted text in to the szOUTDIR field.

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Paul Jackson
Sent: Thursday, March 17, 2005 5:44 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Data translation question

Thanks Bob,

I was contemplating the iconv() api's also. Do you happen to have
example
usage of these api's? (we don't have xTools)

Thanks

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Bob Cozzi
Sent: Thursday, March 17, 2005 2:42 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Data translation question


If you have the RPG xTools, you can use the xLateCCSID subprocedure to
"just
do it". If not, you can call a number of different APIs to do the
conversion
for you. The one xlateCCSID uses under the covers is iconv().

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Paul Jackson
Sent: Thursday, March 17, 2005 3:15 PM
To: 'RPG400-L@xxxxxxxxxxxx'
Subject: Data translation question

I am calling API QSYRUSRI to get the user profile Home Directory, but
the
structure that the info comes back into has the directory name formatted
as
CCSID 1200.

I am looking at various API's but am wondering what the consensus seems
to
be regarding the best way to translate this data back into human
readable
form.

Thanks in advance for any suggestions.

Paul
-- 
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: 6
date: Fri, 18 Mar 2005 08:52:47 +0530
from: "kurien" <kurien.joseph@xxxxxxxxx>
subject: comments in rpgle program 


Hi 

 

I would like to highlight the comments in the RPGLE program so that it
appears in bold. Can you let me know if you are aware of it. 

 

Regards

Joseph 

 





Confidentiality Notice 

The information contained in this electronic message and any attachments
to this message are intended
for the exclusive use of the addressee(s) and may contain confidential
or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or
Mailadmin@xxxxxxxxx immediately
and destroy all copies of this message and any attachments.

------------------------------

message: 7
date: Fri, 18 Mar 2005 07:39:59 +0100
from: "Peter Colpaert" <Peter.Colpaert@xxxxxxxxxx>
subject: Re: comments in rpgle program

Joseph,

if you use CODE or WDSCi, the comments will be in a different colour and

easily recognised.

Plus you get all the other advantages these products have to offer.

If you have the compilers, you will also have (or can ask your BP for)
the 
client tools.

HTH,

Peter Colpaert
Application Developer
Massive - Kontich, Belgium
-----
Yoda of Borg are we.  Futile is resistance, assimilated will you be.
-----




"kurien" <kurien.joseph@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
18/03/2005 04:22
Please respond to RPG programming on the AS400 / iSeries

 
        To:     <RPG400-L@xxxxxxxxxxxx>
        cc: 
        Subject:        comments in rpgle program



Hi 

 

I would like to highlight the comments in the RPGLE program so that it
appears in bold. Can you let me know if you are aware of it. 

 

Regards

Joseph 

 





Confidentiality Notice 

The information contained in this electronic message and any attachments

to this message are intended
for the exclusive use of the addressee(s) and may contain confidential
or 
privileged information. If
you are not the intended recipient, please notify the sender at Wipro or

Mailadmin@xxxxxxxxx immediately
and destroy all copies of this message and any attachments.




------------------------------

message: 8
date: Fri, 18 Mar 2005 01:03:53 -0600 (CST)
from: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
subject: Re: data pointer vs userspace



> I know I can allocate up to 16mb of memory to a data pointer, and
similar 
> sizes on a userspace. BUT what scenarios favour one over the other?
Which is 
> fastest to allocate? Which is fastest to reallocate? Which is the most

> flexible? Which is the most stable/reliable/resilient?

User space: Takes longer to create, takes longer to do read/write access

until the optimizer kicks in and speeds things up for you. Auto-extend
is 
very quick.

%alloc space: Allocates very quickly, access is very quick unless your 
system is hurting for physical RAM. %realloc causes a whole new
allocation 
to be created, the data from the original allocation gets copied to the 
new one, and the original is deallocated.  This copy can end up slowing 
you down -- the user space technique is faster if you have to
re-allocate 
frequently, since auto-extend does not involve copying your data.

A third alternative is to allocate memory in teraspace. This will be 
slightly slower than both of the other alternatives, but has the
advantage 
that you're not limited to 16mb.

>
> Finally, I would not expect the memory I allocate to persist once the 
> job has finished.
>

Space allocated with %alloc() / %realloc() / teraspace is automatically 
deallocated when the activation group ends. Since all activation groups 
are destroyed when your job ends, allocated memory never persists past
the 
job end.

User spaces can also be forced to be cleaned up when the job ends simply

by creating them in QTEMP.

Another consideration is what happens when your program is called 
recursively. With a user space, you'd need to make sure that each 
incarnation of your program used a different user space name, or you'll 
have problems.  That won't be a problem if you use %alloc / teraspace.

If performance is your primary consideration, I'd suggest trying each 
method and benchmarking them. The coding difference is relatively minor,

especially if you wrap them up in subprocedures.



------------------------------

message: 9
date: Fri, 18 Mar 2005 01:05:59 -0600 (CST)
from: Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
subject: RE: data pointer vs userspace


> The other benefit is, as you pointed out, you don't have to remember
to do
> the DeAlloc and the end of the program, when the job ends, the usrspc
in
> qtemp goes away.

Allocated memory will also automatically go away when the job ends (or 
when the activation group ends, if that's sooner.)




------------------------------

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

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.