[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Fill Field in Displayfile with variable name

Hi Experts,

I have to fill a field in a displayfile, by fieldname
When I put the cursor on a field and press one Function key, I have to store some data from that field.
When I put the cursor on a field and press another Function key, I have to put some data into that field.

After pressing the Fxx key I know the fieldname and screenposition, but I need at least the position in the screenbuffer.


Thanks
0
theo kouwenhoven
Asked:
theo kouwenhoven
  • 3
  • 2
  • 2
1 Solution
 
Gary PattersonVP Technology / Senior Consultant Commented:
What programming language are you using?  In RPG, you shouldn't need to worry about the buffer position - the fields in your display file will get declared automatically when you declare the display file in your "F" specs.

Can you provide the DDS source for the display file?
0
 
theo kouwenhovenAuthor Commented:
Hello Gary,

Yes RPG, I know how to program that, F Specs are not enough to solve this.

What I need is to fill one of 30+ fields with a previously stored value:
I know howto get the fieldname where my cursor is in (from DDS),
But I need to change the contents.
.

I like to change the field by name, by pointer or bij substring the DDS record.
What i Don't want to do is:

Select;
When cursorfield = 'NAME';
NAME = 'hello'
When cursorfield = 'ADDRES'
ADDRES = 'hello'

etc. etc for 36 fields.
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
From my perspective, the Select block that you've described is the best, simplest, and most maintainable way to do this, and it just works.

That said, the List Fields QUSLFLD API can provide the input/output buffer position for each field in each record format.  It has a fairly complex structure

https://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_72/apis/quslfld.htm

In searching for the manual page, I also found this discussion here on EE:

http://www.experts-exchange.com/Programming/System/AS_-_400/Q_22746596.html

- Gary
0
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
tliottaCommented:
I pretty much agree with Gary. If the fields had unpredictable names, etc., I would have no problem going with offsets and lengths; and a lengthy SELECT-block would be fine.

I've used various file APIs to work with variable fields for cases like journal entries, but those cases don't have externally-described, formatted record structures that are always known at compile time. There aren't always good choices.

Use the structures provided by the compiler whenever possible.
0
 
theo kouwenhovenAuthor Commented:
Hi Gary, Tom,

I know the people that I have to work with, select block will create problems in the futur by extending the screen by ne fields and not testing. I go for the ofsett and length

Thanks,
0
 
tliottaCommented:
You can certainly create a very nice encapsulated proc that accepts a field name and a value (and a return value or pointer) and that hides all of the work of calculating lengths/offsets. It could be well insulated from nearly all future DSPF changes by adjusting automatically to everything from format changes to field name changes, including adding new fields and dropping old ones.

Just be sure to test extensively.
0
 
theo kouwenhovenAuthor Commented:
Yes Tom,

What I tried to say, is that a SELECT-block will not work in this case.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now