Mike,
Here is an example I how this can be done. The 1st example has 166 1
character flag fields, beginning in position 35 of the file. The 2nd
example has 166 9/0 buckets, beginning in position 31 of that file (TFF6096
is the file name in the 2nd example). If your 53 buckets are all the same
size, it should take care of you. Hope this helps.
Jim Waymire
jim@xxxxxxxxxxx
D* Data Structures
D rec1F E DS extname(tffcflag) prefix(f)
d FAR 35 200
d Dim(166)
D rec1C E DS extname(tff6096) prefix(C)
d CAR 31 860p 0
d Dim(166)
In RPG, is there a way to refer to a field in a file by its relative
position in the file?
E.g. File with 10 fields use array element FIELD(5) to get to 5th field.
I have a file with 53 weekly buckets for a number of different pieces of
information(sales, cost, rebates, etc) so there are > 300 fields.
I know I can define an array in the I specs and list the fields one at
a
time but is there any other mechanism I can use that would allow me to
access the fields in the order they exist in the file(using array like
syntax). Maybe a Data structure or SQL?
Any thoughts would be appreciated
Thanks,
Mike
____________________________________
This email message is intended for the use of the individual to which
it
is addressed and may contain confidential and privileged information.
Any
unauthorized distribution or disclosure is prohibited. If you have
received
this message in error, please contact the sender immediately and
delete it
from your system.
--
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: 3
date: Wed, 13 Feb 2008 09:42:49 -0600
from: "Grizzly Malchow" <grizzlym@xxxxxxxxxxxxxxxxxxxxx>
subject: Processes after CRTSRVPGM
I'm looking for ideas on how to avoid program signature violations after
I run the CRTSRVPGM and the signature changes. Right now, when I
recreate a service program, I rely on notes and a utility that uses
DSPPGMREF to build a file that I can query to find out which programs
need to be re-binded. I then go to each program and recompile each one.
This works for me, but I don't enjoy it when I need to recompile 100
programs. On occasion the notes about which programs need be compiled
don't get updated, or the timing of when the utility to build the
DSPPGMREF file doesn't pick up all of programs referencing the service
program. When this happens signature violations occur.
I was just curious what other people are doing to handle this.
I'm certain this has been discussed, but I'm not finding what I'm
looking for in the archives.
Thanks in advance.
Griz
------------------------------
message: 4
date: Wed, 13 Feb 2008 10:45:05 -0500
from: "Haas, Matt (CL Tech Sv)" <matt.haas@xxxxxxxxxxx>
subject: RE: Processes after CRTSRVPGM
There are many discussions in the archives about using binder source to get
around this problem.
Matt
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Grizzly Malchow
Sent: Wednesday, February 13, 2008 10:43 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Processes after CRTSRVPGM
I'm looking for ideas on how to avoid program signature violations after
I run the CRTSRVPGM and the signature changes. Right now, when I
recreate a service program, I rely on notes and a utility that uses
DSPPGMREF to build a file that I can query to find out which programs
need to be re-binded. I then go to each program and recompile each one.
This works for me, but I don't enjoy it when I need to recompile 100
programs. On occasion the notes about which programs need be compiled
don't get updated, or the timing of when the utility to build the
DSPPGMREF file doesn't pick up all of programs referencing the service
program. When this happens signature violations occur.
I was just curious what other people are doing to handle this.
I'm certain this has been discussed, but I'm not finding what I'm
looking for in the archives.
Thanks in advance.
Griz
--
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: Wed, 13 Feb 2008 10:54:05 -0500
from: Adam Glauser <adamglauser@xxxxxxxxxxxx>
subject: Re: Processes after CRTSRVPGM
Grizzly Malchow wrote:
I'm looking for ideas on how to avoid program signature violations after
I run the CRTSRVPGM and the signature changes.
Are you using binder language? Are you creating a new signature every
time you add a procedure to a service program? What about when you
change a procedure's logic (without changing the parameter list)?
I was just curious what other people are doing to handle this.
The way I do it is to specify a signature when I initially create the
service program. From then on, I add new procedures to the end of the
export list in the binder language source, and UPDSRVPGM specifying the
new module and binder source. Similarly, if I add a parameter I usually
use the *NOPASS option, so that the only programs I need to rebind are
the ones that need the new parameter, which I need to change anyway.
The only time I'd change the signature was if I had to remove a
procedure entirely, or if I needed to add a parameter that was required
for _every_ caller. In that case, I'd use a DSPPGMREF utility as you
suggest.
Hope this helps,
Adam
------------------------------
message: 6
date: Wed, 13 Feb 2008 10:38:58 -0600
from: "Gene Burns" <burns.gene@xxxxxxxxx>
subject: Re: File Fields as array elements
You could do something like this:
d fileds e ds extname(filename)
d workds e ds extname(filename)
prefix(w)
d sales 7p 0 dim(53)
overlay(workds: 12) (start pos of first sales field)
d cost 7p 0 dim(53)
overlay(workds: 200)
read the file data into the fileds data structure and then set workds =
fileds to load the arrays.
Just make sure that the fields and arrays are the same (packed, signed,
etc.) and this should work.
Gene
On Feb 13, 2008 9:29 AM, Mike Roderick <Mike.Roderick@xxxxxxxxxxxxxxx>
wrote:
The layout is Sales1-53 then cost1-53... so consecutive
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Gene Burns
Sent: February-13-08 10:46 AM
To: RPG programming on the AS400 / iSeries
Subject: Re: File Fields as array elements
What is the file structure? Are the fields alternating, (sales, cost,
rebate, sales, cost, rebate, ...) or are they consecutive (sales1,
sales2,
sales3, ...)?
Gene
On Feb 13, 2008 8:00 AM, Mike Roderick <Mike.Roderick@xxxxxxxxxxxxxxx>
wrote:
In RPG, is there a way to refer to a field in a file by its relative
position in the file?
E.g. File with 10 fields use array element FIELD(5) to get to 5th
field.
I have a file with 53 weekly buckets for a number of different pieces
of
information(sales, cost, rebates, etc) so there are > 300 fields.
I know I can define an array in the I specs and list the fields one at
a
time but is there any other mechanism I can use that would allow me to
access the fields in the order they exist in the file(using array like
syntax). Maybe a Data structure or SQL?
Any thoughts would be appreciated
Thanks,
Mike
____________________________________
This email message is intended for the use of the individual to which
it
is addressed and may contain confidential and privileged information.
Any
unauthorized distribution or disclosure is prohibited. If you have
received
this message in error, please contact the sender immediately and
delete it
from your system.
--
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: 7
date: Wed, 13 Feb 2008 12:10:31 -0500
from: Jon Paris <Jon.Paris@xxxxxxxxxxxxxx>
subject: Re: File Fields as array elements
Try the article below for some suggestions Mike. There is usually no
need for pointers etc.
http://www.ibmsystemsmag.com/i5/february03/enewsletterexclusive/
8073p1.aspx
You might also be able to take advantage of the recent support to
read directly into a resulting DS. That will speed operations up as
the read is faster.
By using the techniques described you can handle both a scenario
where the "array" fields are consecutive and when they are in "sets".
i.e. Both JanA, FebA, MarA ... JanB, ...
and JanA, JanB, ... Janx, FebA, FebB ...
Jon Paris
www.Partner400.com
www.SystemiDeveloper.com
------------------------------
message: 8
date: Wed, 13 Feb 2008 12:27:21 -0500
from: Michael_Schutte@xxxxxxxxxxxx
subject: Re: File Fields as array elements
I saw a similar answer as to what I'm going to give. Nevermind how the
fields appear in the file. All you need to do is list the fields in order
of a datastructure.
Assume Sales1 through 4 are defined as decimal 5,2 small yes but you'll
get the point.
* FSPECS
FFILENAME.... yadda yadda yadda.
* DSPECS
D salesDS DS
D Sales1
D Sales2
D Sales3
D Sales4
D Sales 1 20 2 Dim(4)
Since the fields are defined by the file... do not redefine them in the
datastructure... just simply list them. Then when you define the array...
you need to start at 1 and multiply the number of fields by the length.
4 * 5 = 20.... just specify the precision. 2 decimal points. Dim it 4
times to get your array.
Michael Schutte
Admin Professional
rpg400-l-bounces@xxxxxxxxxxxx wrote on 02/13/2008 09:00:52 AM:
In RPG, is there a way to refer to a field in a file by its relative
position in the file?
E.g. File with 10 fields use array element FIELD(5) to get to 5th
field.
I have a file with 53 weekly buckets for a number of different pieces of
information(sales, cost, rebates, etc) so there are > 300 fields.
I know I can define an array in the I specs and list the fields one at a
time but is there any other mechanism I can use that would allow me to
access the fields in the order they exist in the file(using array like
syntax). Maybe a Data structure or SQL?
Any thoughts would be appreciated
Thanks,
Mike
____________________________________
This email message is intended for the use of the individual to
which it is addressed and may contain confidential and privileged
information. Any unauthorized distribution or disclosure is
prohibited. If you have received this message in error, please
contact the sender immediately and delete it from your system.
--
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 7, Issue 121
****************************************
As an Amazon Associate we earn from qualifying purchases.