[NEWSboard IBMi Forum]
  1. #1
    Registriert seit
    Sep 2003
    Beiträge
    221

    Ermitteln der Satznummer in Subfile

    Hallo zusammen,

    ich habe ein kleines Problem mit einer Subfile, bei dem ich nach einer Lösung suche.

    Ich habe eine Subfile die ein Eingabefeld enthält. Hinter diesem Feld gibt es ein Programm für die Bedienerführung, das man mit F4 (*INKD) aufrufen kann.

    Wie komme ich an die Information, auf welchem Subfilesatz der Anwender die F4 gedrückt hat. Denn ich muss ja den selektierten Wert in das richtige Feld schreiben.

    Das Feld SFLCRS(*CURSOR) hat zu diesem Zeitpunkt den Wert "1", und der Satz auf dem ich F4 gedrückt habe ist "5".

    Vielen Dank für Eure Tipps,

    Peter
    Peter Kinne
    EDV-Beratung
    www.kinne.de

  2. #2
    Registriert seit
    Jan 2003
    Beiträge
    759
    Hallo Peter,

    lies mal im DDS-Handbuch das Schlüsselwort SFLRCDNBR nach:

    R SFLCTL: RCDNR 4S 0H SFLRCDNBR
    R SFLDTA: RCDNR 4S 0H

    Viel Erfolg,
    Robert

  3. #3
    Registriert seit
    Sep 2003
    Beiträge
    221
    Hallo Robert,

    das Schlüsselwort habe ich natürlich imt CTL angegeben.

    Aber trotzdem gekomme ich bei F4 nicht die aktuelle Zeile in diesem Feld übermittelt.

    Peter
    Peter Kinne
    EDV-Beratung
    www.kinne.de

  4. #4
    Registriert seit
    Sep 2003
    Beiträge
    236

    Wenig Ahnung, aber READC?

    Guten Tag,

    ich habe zwar keine Ahnung, wie das mit F4(Hilfetext) funktioniert, aber mit READC(RPG III) müsste man doch
    den Datensatz(mit den Bildschirmfeldern) doch
    verarbeiten können.

    Haltet mich auf den Laufenden. ich lerne gerne hinzu.
    (demnächst RPG IV und ILE-RPG)

    Gruss Thomas

  5. #5
    Registriert seit
    May 2002
    Beiträge
    2.643

    Beispiel Subfile Positioning

    Hallo Peter,
    vielleicht hilft Dir diese Beispiel weiter:

    Subfile Positioning

    Hey, Ted:
    I have several RPG IV programs that display a subfile in a work-with-like display. Users enter option numbers in the option field that begins each subfile record. When a user selects a subfile record, the system usually displays another display format in order to handle the request. When the subfile is redisplayed, the first page of the subfile is shown. How can I position the subfile to the page that contains the selected subfile record?






    -- Patrick

    You need to add the Subfile Record Number (SFLRCDNBR) keyword to your display files. Use this keyword with a four-digit, hidden, zoned-decimal field. The value in this field tells the system which page of a subfile to display. Update this field every time an option is processed. Initialize this field to the number one (1) every time you reload the subfile in order to avoid a run-time error. I recommend you use the CURSOR option to position to the record whose relative record number matches the value in the hidden field.
    Here is a short RPG IV program and display file you can play with in order to understand this technique. When you run this program, use option 5 to display more information about a record. (Don’t worry--you don't need a database file; the program displays some dummy data.) When the subfile is redisplayed, you will see the page containing the last selected subfile record.
    Here is display file CD1102D:
    * To compile:
    * CRTDSPF FILE(xxx/CD1102D) +
    * SRCFILE(xxx/QDDSSRC) SRCMBR(CD1102D)

    A CF03(03)
    A DSPSIZ(24 80 *DS3)
    A R SFL SFL
    A OPT 1 B 6 3
    A DTA 5 0O 6 8
    A R CTL SFLCTL(SFL)
    A SFLDSP
    A SFLDSPCTL
    A SFLSIZ(16)
    A SFLPAG(15)
    A POSRRN 4S 0H SFLRCDNBR(CURSOR)
    A 5 3'Opt Data '
    A DSPATR(UL)
    A R SCRN
    A NUM 5 0B 4 5
    A ALPHA 28 O 4 15

    Here is RPG program CD1102R:
    * To compile
    * CRTBNDRPG PGM(xxx/CD1102R) +
    * SRCFILE(xxx/QRPGLESRC) SRCMBR(CD1102R)

    Fcd1102d cf e workstn sfile(sfl:rrn)

    D rrn s 4 0
    D c c 'ABCDEFGHIJKLMNOPQRSTUVWXYZ7890-
    D 1234567890abcde'

    * fill the subfile with dummy data
    C for rrn = 1 to 45
    C eval dta = rrn
    C write sfl
    C endfor

    * display the subfile
    C eval posrrn = 1
    C exfmt ctl
    C dow not *in03
    C exsr dosfl
    C exfmt ctl
    C enddo
    C*
    C eval *inlr = *on

    * process subfile options
    C dosfl begsr
    C readc sfl
    C dow not %eof(cd1102d)
    C if opt = '5'
    C exsr show
    C z-add rrn posrrn
    C eval opt = *blank
    C update sfl
    C endif
    C readc sfl
    C enddo
    C endsr

    * display the data
    C show begsr
    C*
    C eval num = dta
    C eval alpha = %char(num) + '='
    C + %subst(c:num:1)
    C exfmt scrn
    C*
    C endsr

    -- Ted

  6. #6
    Registriert seit
    Jul 2001
    Beiträge
    68

    Smile SUBFILE - F4 auf Satz

    Hallo Peter.

    Ich habe früher (es ist schon etwas her) immer mit Auswahlfeldern (hier z.B. SAUSW) gearbeitet:

    Mit F4 habe ich z.B. immer nur im ganzen Bildschirm gearbeitet.

    Auslesen angezeigte angezeigte-SUBFILE-Sätze

    *IN95 DOUEQ *ON
    READC ..... BS1= Satzformat = SFL-Satz von Bildschirmdatei *IN95

    *IN95 IFEQ *OFF
    -----------------------------------------------------------------
    SAUSW IFEQ '1' (Auswahl-Feld BS1) =======> Auswahlfeld (1)
    Aktionen ... (= wie von Tarasik)
    MOVE *ON *IN95
    MOVE ' ' SAUSW
    ENDIF

    -----------------------------------------------------------------
    Anstatt SAUSW-Eingabe/Abfrage (1)
    -- Überlegung Cursor F4 -Ermittlung (2)
    -----------------------------------------------------------------

    Überlegung - wenn Cursor-Position innerhalb Gesamtbildschirm ermittelbar
    z.B. von Zeile 9 - 21 = Subfile-Satz-Anzeige
    Cursor steht auf Zeile 13: 13 - 8 = 5
    = 5-ter angezeigter Subfile-Satz

    =======> Cursor (2)


    SRSNR IFEQ 5 (SRSNR = Zähler lfd.Satz Nr. pro Subfile-Seite)
    = verdecktes H(hidden) Feld im Satzformat BS1)
    Aktionen ....
    MOVE *ON *IN95
    ENDIF

    -----------------------------------------------------------------

    ENDIF

    ENDDO
    ==========================================
    Viele Grüsse Alf

  7. #7
    Registriert seit
    Jan 2003
    Beiträge
    759
    Peter,

    das Schlüsselwort im CTLFMT genügt nicht, das im Schlüsselwort definierte Feld RCDNR muss im Subfile als Hidden Field ergänzt werden ...

    Gruß, Robert

  8. #8
    KM is offline [professional_User]
    Registriert seit
    Apr 2003
    Beiträge
    1.012
    Hallo Peter,

    ich glaube hier werden 2 Sachen vertauscht. Das Schlüsselwort SFLRCDNBR wird benötigt, wenn Du den Cursor nach der Verarbeitung wieder auf einem bestimmten Subfilesatz positionieren willst.
    Du willst aber wissen auf welchem Subfilesatz die F4 gedrückt wurde. Dafür brauchst Du das Schlüsselwort SFLCSRRRN beim Controlsatz. In diese Variable wird der Wert geschrieben.

    Gruß,
    KM

  9. #9
    Registriert seit
    May 2002
    Beiträge
    2.643

    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

  10. #10
    Registriert seit
    Sep 2003
    Beiträge
    221
    Hallo an Alle,

    vielen Dank für die vielen Tipps.

    Ich habe mich für die Variante "SFLCSRRRN" entschieden. Die bringt genaus das Ergebnis, dass ich brauche.

    Schönen Tag noch,

    Peter
    Peter Kinne
    EDV-Beratung
    www.kinne.de

Similar Threads

  1. Cursor in Subfile - Cobol
    By Anette in forum NEWSboard Programmierung
    Antworten: 7
    Letzter Beitrag: 24-07-06, 20:52
  2. KEYED DATA QUEUES SUBFILE DESCEND RPGLE
    By borwegen in forum NEWSboard Programmierung
    Antworten: 4
    Letzter Beitrag: 30-06-06, 09:04
  3. Subfile Drop
    By steven_r in forum NEWSboard Programmierung
    Antworten: 1
    Letzter Beitrag: 22-05-06, 13:56
  4. SQL Select mit SUM aus einer DB
    By JonnyRico in forum NEWSboard Programmierung
    Antworten: 14
    Letzter Beitrag: 30-03-06, 12:33
  5. Subfile aus einer Subfile?
    By Toschie in forum NEWSboard Programmierung
    Antworten: 4
    Letzter Beitrag: 08-06-05, 14:21

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • You may not post attachments
  • You may not edit your posts
  •