Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Branching to a user program while a member is being listed

The user program lists only the first 10 input records of a member.

If a member consists of less than 10 records, the program pads it out with additional records of its own to bring it up to 10.

/start-lms ---------------------------------------------------------------  (1)  

//modify-logging-parameters logging=*maximum ----------------------------   (2)

//open-library library=use.lib,mode=*update -----------------------------   (3)

//show-element (element=uselst,type=s) ----------------------------------   (4)

INPUT  LIBRARY= :1OSQ:$USER.USE.LIB
INPUT  ELEMENT= (S)USELST/@(0001)/2011-02-19
*       TITLE 'USEREXIT FOR THE FUNCTION: LST'
*

*            1.) BY CONNECTING WITH THIS UNDERPROGRAM ONLY THE
*                FIRST 10 RECORDS PER ELEMENT ARE LISTED.
*

*            2.) IF THE ELEMENT HAS LESS THAN 10 RECORDS,
*                FURTHER RECORDS ARE INSERTED.
* INPUT FROM LMS: R1=A(PARAMETER LIST)

*               R13=A(SAVEAREA), 18 WORDS
*               R14=RETURN ADDRESS
*               R15=A(USERPROGRAM)
*

PARDSEC  DSECT
AUFTRAG  DS    A             A(TASK FROM LMS)
*                          - 'BOE':START OF ELEMENT
*                          - 'REC':RECORD ORDERED
*                          - 'EOE':END OF ELEMENT
ANTWORT  DS    A             A(ANSWER FROM USERPROGRAM)
*                          - 'CON':CONTINUE
*                          - 'DEL':DELETE RECORD
*                          - 'INS':INSERT NEW RECORD
SATZ    DS    A             A(RECORD, INCL. 4 BYTE HEADER)
*                          -

(1)

LMS is called.

(2)

All messages and statements are logged.

(3)

Library USE.LIB is assigned.

(4)

User source program USELST is listed.

PARDSECL EQU   *-PARDSEC       L'DSECT
USELST   CSECT PAGE
         STM   0,15,0(13)      SAVE REGISTERS
         LR    10,15           BASE
         USING PARDSEC,1       LMS PARAMETERLIST
         USING USELST,10
         L     6,AUFTRAG       A(TASK)
         L     7,ANTWORT       A(ANSWER)
         L     8,SATZ          A(RECORD)
         CLC   0(3,6),REC      RECORD ORDERED?
         BE    DOSATZ          YES ---?
         CLC   0(3,6),BOE      START OF ELEMENT
         BE    DOBOE           YES ---?
         CLC   0(3,6),EOE      END OF ELEMENT
         BE    DOEOE           YES ---?
         B     RETURN
*
DOBOE    EQU   *
         ZAP   ANZAHL,P0       COUNTER := 0
         B     RETURN
*
DOSATZ   EQU   *
         CP    ANZAHL,P10      ALREADY 10 RECORDS LISTED?
         BNL   DODEL           YES (REST IGNORE) ---?
         AP    ANZAHL,P1       COUNTER := COUNTER +1
         B     DOCON
*
DOEOE    EQU   *
         CP    ANZAHL,P10      ALREADY 10 RECORDS LISTED?
         BNL   DOCON           YES (NO INSERT) ---?
         AP    ANZAHL,P1       COUNTER := COUNTER +1
         B     DOINS
*
DOINS    EQU   *
         MVC   0(3,7),INS      INSERT RECORD
         LA    9,INSSATZ
         ST    9,SATZ          A(RECORD TO BE INSERTED)
         B     RETURN
*
DODEL    EQU   *
         MVC   0(3,7),DEL      DELETE RECORD
         B     RETURN
*
DOCON    EQU   *
         MVC   0(3,7),CON      CONTINUE
* 

RETURN   EQU   *

         LM    0,15,0(13)      RESTORE REGISTERS

         BR    14
         TITLE 'KONSTANTEN UND VARIABLE'

BOE      DC    'BOE'           START OF ELEMENT

REC      DC    'REC'           RECORD ORDERED
EOE      DC    'EOE'           END OF ELEMENT

CON      DC    'CON'           CONTINUE

DEL      DC    'DEL'           DELETE RECORD
INS      DC    'INS'           INSERT NEW RECORD

ANZAHL   DC    PL2'0'

P0       DC    PL2'0'
P1       DC    PL2'1'

P10      DC    PL2'10'

INSSATZ  DC    Y(INSSATZE-INSSATZ)
         DC    XL2'4040'

         DC    '**************** INSERT BY USER-PROGRAM  *************'

INSSATZE EQU   *
         LTORG

         END

NUMBER OF PROCESSED RECORDS IS      89

//activate-user-exit function=*show-elem,entry=uselst,lib=use.lib -------   (5) 

//show-element (element=einaus,type=s) ----------------------------------   (6)

INPUT  LIBRARY= :1OSQ:$USER.USE.LIB
INPUT  ELEMENT= (S)EINAUS/@(0001)/2011-02-19
USER EXIT USELST IN USE.LIB IS ACTIVE

   #286  >          TITLE 'SEIZE OF DATES'
   #287  >          PRINT NOGEN
   #288  >  ERFAS   START
   #289  >          BALR  5,0
   #290  >          USING *,5
   #291  >          OPEN  DATEI,OUTPUT
   #292  >  LESEN   RDATA SATZ,ENDPGM
   #293  >          CLC   TEXT(4),=C'/EOF'
   #294  >          BE    ENDPGM
   #295  >          MVC   ATEXT,TEXT
NUMBER OF PROCESSED RECORDS IS 10

(5)

Before listing an input record LMS branches to user program USELST, which resides in library USE.LIB.

(6)

The first 10 records of member EINAUS of the assigned library USE.LIB are listed.

//show-user-exits --------------------------------------------------------  (7)

FUNCTION  ENTRY    LIBRARY                                          INT
SHOW     USELST   USE.LIB                                         V1

//show-element (element=persdat,type=s) ----------------------------------  (8)  

INPUT  LIBRARY= :1OSQ:$USER.USE.LIB
INPUT  ELEMENT= (S)PERSDAT/@(0001)/2011-02-19
USER EXIT USELST IN USE.LIB IS ACTIVE

  #1113  >  BACH         SEBASTIAN     MUENCHEN      AUF DER HOEHE 7    AB 3
  #1114  >  BERGMANN     NORBERT       MUENCHEN      TORWEG 10          AB 5
  #1115  >  FINK         SUSANNE       NUERNBERG     RINGSTR. 23        AB 1
  #1116  >  MEYER        FRANZ         NUERNBERG     WASSERMUNGENWEG    AB 1
  #1117  >  GRUNDLER     WOLFGANG      BASEL         SONNENSTR. 11      AB 2
  #1118  >  KNOLL        MONIKA        FRANKFURT     BAUMALLEE 12       AB 3
  #1119  >  LIEDL        ERIKA         MUENCHEN      IN DER BREITE 1    AB 5
  #1120  >  WAGNER       JOHANN        AUGSBURG      AM SEE 45          AB 4
**************** INSERT BY USER-PROGRAM  *********
**************** INSERT BY USER-PROGRAM  *********
NUMBER OF PROCESSED RECORDS IS     10

//end --------------------------------------------------------------------  (9)

(7)

The active user exits are displayed.

(8)

Member PERSDAT is listed. Since it is shorter than 10 records it is padded with records by the user program.

(9)

LMS is terminated.