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









As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.