In diesem Beispiel wird ausführlich eine Anwendungsmöglichkeit gezeigt, wie das Zusammenspiel von S-Prozeduren, S-Variablenströmen und FHS für die Erstellung eines graphischen Bibliotheksmanagers genutzt werden kann.
Die einzelnen dafür verantwortlichen S-Prozeduren sind als Elemente in der (Benutzer-) Bibliothek LIBRARY-MANAGER.PL unter den Namen RUN, SCREEN01 und SCREEN02 mit dem Typ J gespeichert. Dabei ist RUN die steuernde S-Prozedur, die mit dem Kommando CALL-PROCEDURE gestartet wird. SCREEN01 (siehe "Anwendungsbeispiel ") und SCREEN02 (siehe "Anwendungsbeispiel ") sind dagegen davon abhängig für die zwei möglichen Standard-Bildschirmanzeigen verantwortlich.
Im Folgenden werden diese drei S-Prozeduren aufgelistet. Anschließend werden einige Anwendungen gezeigt, um zu demonstrieren, wie der FHS-unterstützte Bibliotheksmanager eingesetzt werden kann.
Prozedur: RUN
/SET-PROCEDURE-OPTIONS CALLER=CALL / /"----------------------------------------------------------" /"First get library name from which this procedure is called" /"----------------------------------------------------------" / /DECLARE-VARIABLE SYSOUT(TYPE=*STRUCTURE),MULTIPLE-ELEMENTS=*LIST /EXECUTE-CMD (SHOW-SYSTEM-FILE-ASSIGNMENT SYSTEM-FILE=*SYSCMD),- / STRUCTURE-OUTPUT=SYSOUT,TEXT-OUTPUT=*NONE /LIBRARY-NAME = SYSOUT#1.SYSCMD.LIB / /"----------------------------------------------------------" /"Get FHS library names via IMON-GPN " /"----------------------------------------------------------" / /FHSLNK = '$TSOS.SYSFHS.FHS.082.FHS-DM.D' /FHSLNK = INSTALLATION-PATH(LOGICAL-ID = 'SYSFHS.FHS-DM.D' , - / INSTALLATION-UNIT = 'FHS' , - / VERSION = *STD , - / DEFAULT-PATH-NAME = FHSLNK) / /FHSPRC = '$TSOS.SYSPRC.FHS.082' /FHSPRC = INSTALLATION-PATH(LOGICAL-ID = 'SYSPRC' , - / INSTALLATION-UNIT = 'FHS' , - / VERSION = *STD , - / DEFAULT-PATH-NAME = FHSPRC) / /"----------------------------------------------------------" /"Get SDF-P-BASYS library name via IMON-GPN " /"----------------------------------------------------------" / /SDPPRC = '$TSOS.SYSPRC.SDF-P-BASYS.022' /SDPPRC = INSTALLATION-PATH(LOGICAL-ID = 'SYSPRC' , - / INSTALLATION-UNIT = 'SDF-P-BASYS' , - / VERSION = *STD , - / DEFAULT-PATH-NAME = SDPPRC) / /"--------------------------------------------------------------" /"Initialize FHS control variables " /"--------------------------------------------------------------" /WRITE-TEXT 'LIBRARY MANAGER V1.0 - LOADING' /SHOW-VAR *ALL /INCLUDE-PROCEDURE *LIBRARY-ELEMENT(LIBRARY = &(SDPPRC) - / ,ELEMENT = FHDR) - / ,PROCEDURE-PARAMETERS = (PREFIX = 'SYSFHS-') /SHOW-VAR *ALL /INCLUDE-PROCEDURE *LIBRARY-ELEMENT(LIBRARY = &(FHSPRC) - / ,ELEMENT = SYSFHS-CONTROL) /DECLARE-VARIABLE SYSPINFO (TYPE = *STRUCTURE(SYSFHS-LAYOUT)) /DECLARE-VARIABLE SYSPINFO-SAVE (TYPE = *STRUCTURE(SYSFHS-LAYOUT)) /INCLUDE-PROCEDURE *LIBRARY-ELEMENT(LIBRARY = &(FHSPRC) - / ,ELEMENT = SYSFHS-CONTROL) - / ,PROCEDURE-PARAMETERS = (INCLUDE-FORM='INITIALIZE' - / ,VARIABLE-NAME='SYSPINFO') / /"--------------------------------------------------------------" /"Assign the stream to FHS " /"--------------------------------------------------------------" /ADD-FILE-LINK LINK-NAME=BLSLIB01,FILE-NAME=&(FHSLNK) /ASSIGN-STREAM STREAM-NAME = PRESENTATION - / ,TO = *SERVER(FHS - / ,SERVER-INFO = 'FHS-LIB = &(LIBRARY-NAME)') / /"--------------------------------------------------------------" /"Start LMS " /"--------------------------------------------------------------" /ASSIGN-SYSOUT TO=*DUMMY /START-LMS /HOLD-PROGRAM /ASSIGN-SYSOUT TO=*PRIMARY / /"-----------------------------------------------------------------" /"Set timeout to 0 when switching from line mode to full screen " /"-----------------------------------------------------------------" /MODIFY-TERMINAL-OPTIONS OVERFLOW-CONTROL = *TIME(TIMEOUT = 0) / /"--------------------------------------------------------------" /"Call main procedure (screen01) " /"--------------------------------------------------------------" /INCLUDE-PROCEDURE *LIBRARY-ELEMENT(LIBRARY = &(LIBRARY-NAME) - / ,ELEMENT = SCREEN01) / /"--------------------------------------------------------------" /"Stop LMS " /"--------------------------------------------------------------" /RESUME-PROGRAM //END
Prozedur: SCREEN01
/declare-variable screen01(type=*structure(*by-syscmd)) /begin-structure / declare-element name = filelist (type = *structure(*by-syscmd)) - / ,multiple-elements = *list / begin-structure / declare-element choice / declare-element f-size / declare-element cat-id / declare-element user-id / declare-element short-f-name / end-structure / declare-element name = sdfplist-modindex (type = integer) - / ,multiple-elements = *list / declare-element sdfplist-topindex(initial-value = 1) / declare-element sdfplist-botindex / declare-element sdfplist-numrow / declare-element file-menu / declare-element file-choice /end-structure / /declare-variable i(type = *integer) / /while (true) / / "initialize modindex list for 50 elements " / " (fhs requirement) " / for i = *counter(1,50) / screen01.sdfplist-modindex#&(i) = 0 / end-for / / "get library names" / exec-cmd cmd=(show-file-attributes - / select=*by-attributes(type-of-files = *plam-library) - / ,info=*name-and-space - / ) - / ,structure-output=screen01.filelist - / ,text-output=*none - / ,returncode=*variable(subcode2=sub2 - / ,subcode1=sub1 - / ,maincode=main) / / if (sub1 ne 0) / write-text 'Error &sub2 &sub1 &main returned by EXEC-CMD' / write-text 'LIBRARY MANAGER V1.0 abnormally terminated' / exit-procedure / end-if / / syspinfo.resource = 'screen01' / syspinfo.service = '*display' / syspinfo.refresh = '*yes' / syspinfo.command = '' / screen01.sdfplist-numrow = size('screen01.filelist') / screen01.file-menu=0 / screen01.file-choice=0 / transmit-by-stream variable-name = screen01 - / ,stream-name = presentation - / ,control-var-name = syspinfo / / if ( (syspinfo.std-header.returncode.maincode == 'IDH0004') - / or (syspinfo.std-header.returncode.maincode == 'IDH0008')) / write-text 'LIBRARY MANAGER V1.0 normally terminated' / exit-procedure / end-if / / if (syspinfo.std-header.returncode.maincode ne 'IDH0000') / sub2 = syspinfo.std-header.returncode.subcode2 / sub1 = syspinfo.std-header.returncode.subcode1 / main = syspinfo.std-header.returncode.maincode / write-text 'Error &sub2 &sub1 &main returned by FHS server' / write-text 'LIBRARY MANAGER V1.0 abnormally terminated' / exit-procedure / end-if / / if screen01.file-menu ne 0 / if screen01.file-choice == 9 / write-text 'LIBRARY MANAGER V1.0 normally terminated' / exit-procedure / else-if screen01.file-choice == 1 / for i = *counter(1,size('screen01.sdfplist-modindex')), - / cond=(screen01.sdfplist-modindex#i ne 0) / screen01-curr-index = screen01.sdfplist-modindex#i / if screen01.filelist#screen01-curr-index.choice == '/' / syspinfo-save = syspinfo / include-procedure - / name=*library-element(&library-name. - / ,screen02) - / ,procedure-parameters=(&(screen01.filelist#screen01-currindex.short-f-name)) / if-cmd-error / write-text 'LIBRARY MANAGER V1.0 abnormally terminated' / exit-procedure / else / save-returncode / if (maincode() = 'STOP0OK') / write-text 'LIBRARY MANAGER V1.0 normally terminated' / exit-procedure / end-if / end-if / syspinfo = syspinfo-save / end-if / end-for / end-if / end-if / / if (syspinfo.command ne '') / exec-cmd cmd=(&(syspinfo.command)) - / ,text-output=*none - / ,returncode=*variable(subcode2=sub2 - / ,subcode1=sub1 - / ,maincode=main) / / if (sub1 ne 0) / write-text 'Error &sub2 &sub1 &main returned by command server' / write-text 'LIBRARY MANAGER V1.0 abnormally terminated' / exit-procedure / end-if / end-if /end-while
Prozedur: SCREEN02
/begin-parameter-declaration / declare-parameter library /end-parameter-declaration / /declare-variable screen02(type=*structure(*by-syscmd)) /begin-structure / declare-element name = elemlist(type = *structure(*dynamic)) - / ,multiple-element = *list / declare-element name = sdfplist-modindex(type = *integer) - / ,multiple-element = *list / declare-element sdfplist-topindex(initial-value = 1) / declare-element sdfplist-botindex / declare-element sdfplist-numrow / declare-element file-menu / declare-element file-choice /end-structure / /declare-variable sysout(type = *string), multiple-elements = *list /declare-variable error-on-print( type = *boolean, initial-value = false ) /declare-variable i(type = *integer) / /resume-program //open-library library = &library.,mode = *update /hold-program / /while (true) / / "initialize modindex list for 50 elements " / " (fhs requirement) " / for i = *counter(1,50) / screen02.sdfplist-modindex#&(i) = 0 / end-for / / assign-sysout to = *variable(sysout) / resume-program // show-element-attributes - // element = *library-element(library = *std - // ,element = *all ( version = *all ) - // ,type = *all) - // ,information = *maximum - // ,sort = *by-name - // ,structure-output = screen02.elemlist / hold-program / assign-sysout to = *primary / / if ( stmt-spinoff() == 'YES' ) / show-variable sysout, information = *parameters( name = *none ) / maincode = 'LMS0ERR' / goto end / end-if / / "Following loop is only necessary to rep a problem between" / "FHS and VAS. Correction in VAS V02.0A85, FHS V08.1A75" / for i = *counter(1,size('screen02.elemlist')) / screen02.elemlist#i.choice = ' ' / end-for / / syspinfo.resource = 'screen02' / syspinfo.service = '*display' / syspinfo.refresh = '*yes' / syspinfo.command = '' / screen02.sdfplist-numrow = size('screen02.elemlist') / screen02.file-menu=0 / screen02.file-choice=0 / transmit-by-stream variable-name = screen02 - / ,stream-name = presentation - / ,control-var-name = syspinfo / / if ( (syspinfo.std-header.returncode.maincode == 'IDH0004') - / or (syspinfo.std-header.returncode.maincode == 'IDH0008')) / maincode = 'FHSEXIT' / goto end / end-if / / if (syspinfo.std-header.returncode.maincode ne 'IDH0000') / sub2 = syspinfo.std-header.returncode.subcode2 / sub1 = syspinfo.std-header.returncode.subcode1 / main = syspinfo.std-header.returncode.maincode / write-text 'Error &sub2 &sub1 &main returned by FHS server' / maincode = 'FHS0ERR' / goto end / end-if / / if screen02.file-menu ne 0 / if screen02.file-choice == 9 / maincode = 'FHS0RET' / goto end / else / for i = *counter(1,size('screen02.sdfplist-modindex')), - / cond=(screen02.sdfplist-modindex#i ne 0) / screen02-curr-index = screen02.sdfplist-modindex#i / if screen02.elemlist#screen02-curr-index.choice == '/' / element = screen02.elemlist#screen02-curr-index.elem / version = screen02.elemlist#screen02-curr-index.version / type = screen02.elemlist#screen02-curr-index.type / if screen02.file-choice == 1 "delete element" / assign-sysout to = *variable(sysout) / resume-program // delete-element element = *library-element - // ( library = *std - // , element = &element.- // ( version = &version. ) - // , type = &type. ) / hold-program / assign-sysout *primary / else-if screen02.file-choice == 2 "edit element" / assign-sysout to = *variable(sysout) / resume-program // edit-element element = *library-element - // ( library = *std - // , element = &element. - // ( version = &version. ) - // , type = &type. ) / hold-program / assign-sysout *primary / else-if screen02.file-choice == 3 "copy element" / write-text 'Function not implemented' / else-if screen02.file-choice == 4 "print element" / assign-sysout to = *variable(sysout) / print-file *library-element - / ( library = &library. - / , element = &element. - / ( version = &version. ) - / , type = &type. ) / if-cmd-error / error-on-print = true / end-if / assign-sysout *primary / else-if screen02.file-choice == 5 "select element" / assign-sysout to = *variable(sysout) / resume-program // extract-element element = *library-element - // ( library = *std - // , element = &element. - // ( version = &version. ) - // , type = &type. ) - // ,to-file = *std / hold-program / assign-sysout *primary / else-if screen02.file-choice == 6 "add element" / write-text 'Function not implemented' / end-if / / if ( error-on-print ) / show-variable sysout, information = *parameters( name = *none ) / maincode = 'PRT0ERR' / goto end / end-if / / if ( stmt-spinoff() == 'YES' ) / show-variable sysout, information = *parameters( name = *none ) / maincode = 'LMS0ERR' / goto end / end-if / end-if / end-for / end-if / end-if / / if (syspinfo.command ne '') / exec-cmd cmd=(&(syspinfo.command)) - / ,text-output=*none - / ,returncode=*variable(subcode2=sub2 - / ,subcode1=sub1 - / ,maincode=main) / / if (sub1 ne 0) / write-text 'Error &sub2 &sub1 &main returned by command server' / maincode = 'CMD0ERR' / goto end / end-if / end-if /end-while / / /end: /if ( (maincode = 'CMD0ERR') - / or (maincode = 'PRT0ERR') - / or (maincode = 'LMS0ERR') - / or (maincode = 'FHS0ERR') - / ) / exit-procedure error = *yes(subcode2 = 0 - / ,subcode1 = 64 - / ,maincode = STOPERR) /else-if (maincode = 'FHSEXIT') / exit-procedure error = *yes(subcode2 = 0 - / ,subcode1 = 0 - / ,maincode = STOP0OK) /else-if (maincode = 'FHS0RET') / exit-procedure /else / write-text 'Error &(sc2()) &(sc1()) &(mc()) reported' / exit-procedure error = *yes(subcode2 = 0 - / ,subcode1 = 64 - / ,maincode = STOPERR) /end-if
Unter der Voraussetzung, dass FHS-PRIV geladen ist, kann der Bibliotheksmanager folgendermaßen aufgerufen werden:
/CALL-PROCEDURE FROM-FILE=*LIBRARY-ELEMENT(LIBRARY-MANAGER.PL, RUN)
Es muss dann eine Bildschirmanzeige (unter Benutzung von SCREEN01) erscheinen, welche die Namen der in der Kennung enthaltenen Bibliotheken auflistet, wie z.B:
Man hat nun z.B. die Möglichkeit, eine der aufgelisteten Bibliotheken zu öffnen und sich die jeweiligen Elemente anzeigen zu lassen. Dazu kennzeichnet man mit einem „/“ am Zeilenanfang die zu öffnende Bibliothek, springt dann mit der Tabulatortaste zum Feld „FILE“ (links oben), drückt die
-Taste und gibt in dem erscheinenden Pull-Down-Menü „1“ an.Die folgende Bildschirmausgabe soll dies verdeutlichen:
Nach nochmaligem Drücken der
-Taste, erscheinen in einer weiteren Bildschimausgabe (unter Benutzung von SCREEN02) die jeweiligen Elementnamen dieser Bibliothek (zusammen mit Datum und Zeit ihrer Erstellung sowie dem Typ usw.).Weiter hat man nun die Möglichkeit, eines der aufgelisteten Elemente zu bearbeiten. Dazu kennzeichnet man mit einem „/“ am Zeilenanfang das zu bearbeitende Element (z.B. PHKEY), springt dann mit der Tabulatortaste zum Feld „FILE“ (links oben), drückt die
-Taste und gibt in dem erscheinenden Pull-Down-Menü die Zahl an, die markiert, wie man das Element bearbeiten will: z.B. „4“, um es auszudrucken.Mit Betätigung der
Soviel zu einigen Anwendungsmöglichkeiten: Mit der [F3]-Taste kann man den Bibliotheksmanager verlassen bzw. zum Ausgangsmenü zurückkehren.
Im Übrigen kann man mit Eingabe von „+“ oder „-“ in der Zeile „COMMAND“ nach dem Pfeil scrollen. Ein Hilfemenü ist durch Auslösen der
-Taste zu erreichen.