-
Cursorposition
Hallo Peter,
da hat KM recht und ich habe noch etwas dazu gefunden:
Select Subfile Records by Position
Hey, Ted:
We have inquiry programs that require users to key an X next to a subfile record in order to select the record. I have seen programs that require that a user place the cursor on a subfile record and press Enter to select it. If we could use that technique, it would mean less keying for the users. Can you tell me how to select a subfile record by cursor position?
--Chad
This is not a difficult technique to use, and, yes, it will help the users by requiring them to key less.
In the display file, define a hidden five-digit zoned decimal field and assign it to the SFLCSRRRN keyword, like this:
A SFLCSRRRN(&S1SLTRRN)
A S1SLTRRN 5S 0H
The relative record number of the selected record will be returned through the hidden field. If the cursor is not sitting on a subfile record, the hidden field will have a value of zero.
Here is a short display file and an RPG program you can play with to learn about this technique. It builds a small subfile of five records. When you call the program, move the cursor to one of the subfile records or outside of the subfile. When you press Enter, the system will tell you the number of the record you selected and retrieve the data from the record.
* display file SFL333D
A DSPSIZ(24 80 *DS3)
A INDARA
A CA03(03 'F3=EXIT')
A CA12(12 'F12=CANCEL')
A R S1SFL SFL
A S1DATA 40 O 5 2
A R S1CTL SFLCTL(S1SFL)
A SFLSIZ(13)
A SFLPAG(11)
A OVERLAY
A SFLCSRRRN(&S1SLTRRN)
A 45 SFLDSP
A 44 SFLDSPCTL
A N99 SFLEND(*MORE)
A S1SFLRRN 4S 0H
A S1SLTRRN 5S 0H
A 2 2'Selected record:'
A CTLRCD 3 0O 2 19EDTCDE(1)
A 2 25'Data:'
A CTLDATA 40 O 2 31
A 4 2'Move cursor, press Enter.'
A DSPATR(UL)
A R S1LEGEND
A 17 2'F3=Exit F12=Cancel'
* RPG program SFL333R
H option(*srcstmt: *nodebugio)
H dftactgrp(*no) actgrp(*new)
Fsfl333d cf e workstn
F indds(wsIndicators)
F sfile(s1SFL:s1SFLRRN)
D CancelRequestd s n
* Indicator data structure for display file
D wsIndicators DS 99
D wsExit 3 3N
D wsCancel 12 12N
D s1SflDspCtl 44 44N
D s1SflDsp 45 45N
D msgSFLEnd 99 99n inz('0')
* load the subfile
C exsr s1LoadSFL
* until user cancels
C dou CancelRequestd
* display the subfile
C write s1Legend
C exfmt s1Ctl
C if wsCancel or wsExit
C eval CancelRequestd = *
C iter
C endif
* select the record the cursor is sitting on
C eval ctlRcd = s1SltRRN
C if s1SltRRN > *zero
C s1SltRRN chain s1SFL
C eval ctlData = s1Data
C else
C eval ctlData = '*NONE*'
C endif
C enddo
C
C eval *inlr = *on
* ================================================== ========
C s1LoadSFL begsr
C
C eval s1Data = 'The first record.'
C eval s1SFLRRN = 1
C write s1SFL
C eval s1Data = 'Another record.'
C eval s1SFLRRN = 2
C write s1SFL
C eval s1Data = 'Yet another record.'
C eval s1SFLRRN = 3
C write s1SFL
C eval s1Data = 'Record 4.'
C eval s1SFLRRN = 4
C write s1SFL
C eval s1Data = 'The last record.'
C eval s1SFLRRN = 5
C write s1SFL
C
C eval s1SflDspCtl = *on
C eval s1SflDsp = *on
C
C endsr
Similar Threads
-
By Anette in forum NEWSboard Programmierung
Antworten: 7
Letzter Beitrag: 24-07-06, 21:52
-
By borwegen in forum NEWSboard Programmierung
Antworten: 4
Letzter Beitrag: 30-06-06, 10:04
-
By steven_r in forum NEWSboard Programmierung
Antworten: 1
Letzter Beitrag: 22-05-06, 14:56
-
By JonnyRico in forum NEWSboard Programmierung
Antworten: 14
Letzter Beitrag: 30-03-06, 13:33
-
By Toschie in forum NEWSboard Programmierung
Antworten: 4
Letzter Beitrag: 08-06-05, 15:21
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- You may not post attachments
- You may not edit your posts
-
Foren-Regeln
|
Erweiterte Foren Suche
Google Foren Suche
Forum & Artikel Update eMail
AS/400 / IBM i
Server Expert Gruppen
Unternehmens IT
|
Kategorien online Artikel
- Big Data, Analytics, BI, MIS
- Cloud, Social Media, Devices
- DMS, Archivierung, Druck
- ERP + Add-ons, Business Software
- Hochverfügbarkeit
- Human Resources, Personal
- IBM Announcements
- IT-Karikaturen
- Leitartikel
- Load`n`go
- Messen, Veranstaltungen
- NEWSolutions Dossiers
- Programmierung
- Security
- Software Development + Change Mgmt.
- Solutions & Provider
- Speicher – Storage
- Strategische Berichte
- Systemmanagement
- Tools, Hot-Tips
Auf dem Laufenden bleiben
|
Bookmarks