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



%DIV does integer division whereas / does it in whatever format the
expression calls for.

-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Kurt Anderson
Sent: Wednesday, December 07, 2005 10:42 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Initialize array in D-Spec

Bob,

I'm on v5r2 and that's the first version I attempted it on and it
worked.
I figured the D-spec was what made %div worth anything.  What's the
situation that would call for %div over "/" on the C-specs? 

Kurt Anderson
Application Developer
Highsmith Inc

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bob Cozzi
Sent: Wednesday, December 07, 2005 10:28 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Initialize array in D-Spec

When did IBM start allowing the %DIV to be used on the D specs?
This was supposed to be in V3R1 but never got put in as far as I know.
This would be wonderful if it works.

-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Kurt Anderson
Sent: Wednesday, December 07, 2005 10:17 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Initialize array in D-Spec

Titus,

Here is an example from a program of mine (with the individual field
names renamed to be generic for example).

The point here is that one data structure is used as an array for
validation checks.  And later when processing the group, I can perform
separate functions when checking if the group is equal to Group1 or
Group2 and so on (as opposed to comparing the value to vldOrdGrp(1) or
vldOrdGrp(2) and so on).

 *  The valid Order Documentation Groups defined.

D                 DS

D OrdGrpDS                       4a

D  Group1                        1a   Inz( 'H' ) Overlay( OrdGrpDS )

D  Group2                        1a   Inz( 'U' ) Overlay( OrdGrpDS:
*Next ) 
D  Group3                        1a   Inz( 'I' ) Overlay( OrdGrpDS:
*Next ) 
D  Group4                        1a   Inz( 'E' ) Overlay( OrdGrpDS:
*Next ) 
D  vldOrdGrp                          Like( OrdGrp ) Overlay( OrdGrpDS )

D                                     Dim( %div( %len( OrdGrpDS ):

D                                                %len( OrdGrp ) ) )

(OrdGrp is a file-defined field)


A more common version of this that I personally use is to not name the
values inside the data structure.
 *  The valid Order Documentation Groups defined.

D                 DS

D OrdGrpDS                       4a   Inz('H+
D                                          U+
D                                          I+
D                                          E')
D  vldOrdGrp                          Like( OrdGrp ) Overlay( OrdGrpDS )

D                                     Dim( %div( %len( OrdGrpDS ):

D                                                %len( OrdGrp ) ) )  

Kurt Anderson
Application Developer
Highsmith Inc

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Titus Kruse
Sent: Wednesday, December 07, 2005 8:59 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Initialize array in D-Spec

Hi!

What is a good way to initialize an array with different values in the
D-Specs? I want to replace the old fashioned way with tables and
constant data at the end of the program. Another reason is placing the
array in an include-sourcefile. Here is my example. But it doesn't work:

d        ds
d #array    4    dim(3)
d  #value1                    like(#array) overlay(#array) inz('Val1')
d  #value2                    like(#array) overlay(#array:*next)
inz('Val2')
d  #value3                    like(#array) overlay(#array:*next)
inz('Val3')


Titus



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





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.