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



Thanks to you and Barbara for the reminder - I've been replying on somewhat-fractured memory in my replices - have never needed a pointer, it just seems more complicated than it has to be.

If the DS has to have that name for TL Ashford, how about not using the externally-described DS, just put that name on the current "no-name"? This isn't all that hard, right?

OK, time to go back to working for a living!

Vern

On 3/12/2021 12:04 PM, Jon Paris wrote:
But by placing them in a DS you _have_ guaranteed that Vern.

The dangerous technique is is the one that does not define a DS but just uses an array based upon a pointer to the address of the first field. THAT IS DANGEROUS because without a DS there is no guarantee that the fields are contiguous.



On Mar 12, 2021, at 12:04 PM, Vern Hamberg <vhamberg@xxxxxxxxxxxxxxx> wrote:

There is no guarantee that fields are contiguous in the buffer - according to Jon Paris.

Try the suggestion of just using the names at the start of the DS, then the Containers array at the end, positioned at the start of the structure - another post had suggested that, right?

Vern

On 3/12/2021 10:41 AM, Henderson, Liam via RPG400-L wrote:
How about something like this:

Dcl-DS DS0 ExtName('FILE' : *Input);
Container Char(40) Dim(28) Pos(xx);
End-DS;

Where Pos(xx) is the position of the first field in the external file. I presume they're grouped together.




Liam Henderson | Application Consultant | Getronics

T. +441908992044 | M. +447985875181 | E. Liam.Henderson@xxxxxxxxxxxxx | W. www.getronics.com




Getronics Services UK Limited - Registered in England and Wales with No: 07966594. VAT No: GB 130 6848 20.
Registered Office - Getronics, Level 30, The Leadenhall Building, 122 Leadenhall Street, London, EC3V 4AB, UK?
?
The information transmitted is intended only for use by the addressee and may contain confidential and/or privileged material. Any review, re-transmission, dissemination or other use of it, or the taking of any action in reliance upon this information by persons and/or entities other than the intended recipient is prohibited. If you received this in error, please inform the sender and/or addressee immediately and delete the material. ?Thank you.

Legal disclaimer: http://www.getronics.com/legal/
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of smith5646midrange@xxxxxxxxx
Sent: 12 March 2021 16:40
To: 'RPG programming on IBM i' <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: File Fields In Array

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

I'm very weak on totally free code (my client won't let me use it) so this might be wrong.

Don't you just need to add a CHAR(40) to your containers line?

Containers char(40) Dim(28);


-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
(WalzCraft) Jerry Forss
Sent: Friday, March 12, 2021 11:10 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: File Fields In Array

Hi All,

I know this is a simple question but is escaping me at the moment.

I have a file that contains fields SLOTHCTR1 - SLOTHCTR28, each 40 char.

I want to have these loaded into an array because I need to change some, print label, change again, print and so on.

Changing by index would be immensely less coding then changing the field directly.

This is basically what I what it to look like.

Dcl-DS *n;
Containers Dim(28);
SlOthCtr1 Char(40) Overlay(Containers);
SlOthCtr2 Char(40) Overlay(Containers : *Next);
SlOthCtr3 Char(40) Overlay(Containers : *Next);
SlOthCtr4 Char(40) Overlay(Containers : *Next);
SlOthCtr5 Char(40) Overlay(Containers : *Next);
SlOthCtr6 Char(40) Overlay(Containers : *Next);
SlOthCtr7 Char(40) Overlay(Containers : *Next);
SlOthCtr8 Char(40) Overlay(Containers : *Next);
SlOthCtr9 Char(40) Overlay(Containers : *Next);
SlOthCtr10 Char(40) Overlay(Containers : *Next);
SlOthCtr11 Char(40) Overlay(Containers : *Next);
SlOthCtr12 Char(40) Overlay(Containers : *Next);
SlOthCtr13 Char(40) Overlay(Containers : *Next);
SlOthCtr14 Char(40) Overlay(Containers : *Next);
SlOthCtr15 Char(40) Overlay(Containers : *Next);
SlOthCtr16 Char(40) Overlay(Containers : *Next);
SlOthCtr17 Char(40) Overlay(Containers : *Next);
SlOthCtr18 Char(40) Overlay(Containers : *Next);
SlOthCtr19 Char(40) Overlay(Containers : *Next);
SlOthCtr20 Char(40) Overlay(Containers : *Next);
SlOthCtr21 Char(40) Overlay(Containers : *Next);
SlOthCtr22 Char(40) Overlay(Containers : *Next);
SlOthCtr23 Char(40) Overlay(Containers : *Next);
SlOthCtr24 Char(40) Overlay(Containers : *Next);
SlOthCtr25 Char(40) Overlay(Containers : *Next);
SlOthCtr26 Char(40) Overlay(Containers : *Next);
SlOthCtr27 Char(40) Overlay(Containers : *Next);
SlOthCtr28 Char(40) Overlay(Containers : *Next);
End-Ds;

That way I can change the fields by changing the Containers(x);

What should this look like?



Subject to Change Notice:

WalzCraft reserves the right to improve designs, and to change specifications without notice.

Confidentiality Notice:

This message and any attachments may contain confidential and privileged information that is protected by law. The information contained herein is transmitted for the sole use of the intended recipient(s) and should "only"
pertain to "WalzCraft" company matters. If you are not the intended recipient or designated agent of the recipient of such information, you are hereby notified that any use, dissemination, copying or retention of this email or the information contained herein is strictly prohibited and may subject you to penalties under federal and/or state law. If you received this email in error, please notify the sender immediately and permanently delete this email. Thank You

WalzCraft PO Box 1748 La Crosse, WI, 54602-1748 www.walzcraft.com<http://www.walzcraft.com> Phone: 1-800-237-1326
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


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.