No you wouldn't need to do the for loop.

MyArray(*) = efdFldDelim;

The * says to populate all array elements with the same value.

On Mon, Mar 21, 2016 at 2:41 PM, Jeff Crosby <jlcrosby@xxxxxxxxxxxxxxxx>
wrote:

Then I still have to use the For loop for filling.

Had a brainstorm and tried this:

Subst(DelimFill:1:%Len(DelimFill)) = efdFldDelim;

which only put in a single semicolon. Then I tried:

%Subst(DelimFill:*All) = efdFldDelim;

which passed the syntax check in RDi, but not the "compiler" check. :)




On Mon, Mar 21, 2016 at 2:27 PM, Michael Schutte <mschutte369@xxxxxxxxx>
wrote:

If you still have it defined as an array, you could

MyArray(*) = efdFldDelim;

Or initialize all array elements to that value.

On Mon, Mar 21, 2016 at 1:46 PM, Jeff Crosby <jlcrosby@xxxxxxxxxxxxxxxx>
wrote:

A couple of weeks ago, I asked about concatenating an entire array to a
string. Scott Klement had a better idea which was this:

<quote>

On Sun, Mar 13, 2016 at 6:07 AM, Scott Klement <
rpg400-l@xxxxxxxxxxxxxxxx>
wrote:

Jeff said one thing that puzzles me. He said it's always filled with
semicolons... That's weird. Why would you use an array for
something
like that? Just do this:

string = *all';';

now the string is filled with all semicolons. isn't that a lot
easier?


</quote>

to which I responded:

<quote>

Yes it is, and I like it.

This is for a new application where I need to create a number of files
that
will be FTP'ed offsite. Each file has a variable number of fields
with a
semicolon as the field separator.

Each file has, as the last record, a BATCHCONTROL record with file
totals,
I need to put a variable number of semicolons at the end of this batch
control record so this record has the same number of fields as the
detail
records in the file. I want to use the exact same logic in each
program
that builds a file and, for some reason, got fixated on using an array
and
just setting the DIM of the array to the number of semicolons I need.
But
it's even simpler to just define a field in the program to the size I
need
initialized to semicolons and use it. Duh.

</quote>


I want to take it a step further. Instead of doing this:

dcl-s DelimFill Char(37) Inz(*All';');

to initialize the variable with all semicolons, I want to initialize it
all
with a named constant I have already defined:

dcl-c efdFldDelim ';';

so I tried this:

dcl-s DelimFill Char(37) Inz(efdFldDelim);

But, as I expected, it only puts in a single semicolon. I tried this:

dcl-s DelimFill Char(37) Inz(*ALLefdFldDelim);

which throws a syntax error, as I expected. I'm guessing it's not
possible?

An alternative would be to initialize as blanks, then assign all
semicolons
in one fell swoop, but this also throws a syntax error:

DelimFill = *ALLefdFldDelim;

and I can't put quotes around efdFldDelim because then DelimFill would
have
"efdFldDelim" as it's contents.

Again, this not possible either?

Don't see examples in the manuals doing either of these. V7R1 up to
date
on PTFs.

Thanks.








--


Jeff Crosby
VP Information Systems
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
www.dilgardfoods.com

The opinions expressed are my own and not necessarily the opinion of my
company. Unless I say so.
--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.




--


Jeff Crosby
VP Information Systems
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
www.dilgardfoods.com

The opinions expressed are my own and not necessarily the opinion of my
company. Unless I say so.
--
This is the RPG programming on the IBM i (AS/400 and 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.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.