home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / viscobv6.zip / vac22os2 / ibmcobol / samples / elookup1 / elk.cbv < prev    next >
Text File  |  1997-08-19  |  11KB  |  293 lines

  1.  
  2.       * Feature source code generation begins here...
  3.       * method
  4.        IDENTIFICATION DIVISION.
  5.        METHOD-ID. "showResults".
  6.        DATA DIVISION.
  7.        WORKING-STORAGE SECTION.
  8.        LOCAL-STORAGE SECTION.
  9.       *
  10.       * Begin handcoded Message Box parameters
  11.       *
  12.        01 MsgText.
  13.           03 MsgText-Length      PIC 9(9) COMP-5.
  14.           03 MsgText-String.
  15.              05 MsgText-Chars  PIC X
  16.                   OCCURS 1 TO 255 TIMES
  17.                   DEPENDING ON MsgText-Length.
  18.        01 MsgSeverityIcon      PIC 9(9) COMP-5 VALUE 2.
  19.            88  MsgSeverityIcon-None  VALUE  1.
  20.            88  MsgSeverityIcon-Information  VALUE  2.
  21.            88  MsgSeverityIcon-Query  VALUE  3.
  22.            88  MsgSeverityIcon-Warning  VALUE  4.
  23.            88  MsgSeverityIcon-Error  VALUE  5.
  24.        01 MsgButtons      PIC 9(9) COMP-5 VALUE 1.
  25.            88  MsgButtons-Ok  VALUE  1.
  26.            88  MsgButtons-OkCancel  VALUE  2.
  27.            88  MsgButtons-Cancel  VALUE  3.
  28.            88  MsgButtons-Enter  VALUE  4.
  29.            88  MsgButtons-EnterCancel  VALUE  5.
  30.            88  MsgButtons-RetryCancel  VALUE  6.
  31.            88  MsgButtons-AbortRetryIgnore  VALUE  7.
  32.            88  MsgButtons-YesNo  VALUE  8.
  33.            88  MsgButtons-YesNoCancel  VALUE  9.
  34.        01 MsgDefaultButton      PIC 9(9) COMP-5 VALUE 1.
  35.            88  MsgDefaultButton-Button1  VALUE  1.
  36.            88  MsgDefaultButton-Button2  VALUE  2.
  37.            88  MsgDefaultButton-Button3  VALUE  3.
  38.        01 MsgModality      PIC 9(9) COMP-5 VALUE 1.
  39.            88  MsgModality-Application  VALUE  1.
  40.            88  MsgModality-System  VALUE  2.
  41.        01 MsgMoveable      PIC 9(9) COMP-5 VALUE 0.
  42.           88 MsgMoveable-False    VALUE 0.
  43.           88 MsgMoveable-True    VALUE 1.
  44.        01 MsgHelpId PIC 9(9) COMP-5 VALUE 0.
  45.        01 MsgResponse      PIC 9(9) COMP-5.
  46.            88  MsgResponse-OK  VALUE  1.
  47.            88  MsgResponse-Cancel  VALUE  2.
  48.            88  MsgResponse-Retry  VALUE  4.
  49.            88  MsgResponse-Abort  VALUE  8.
  50.            88  MsgResponse-Ignore  VALUE  16.
  51.            88  MsgResponse-Yes  VALUE  32.
  52.            88  MsgResponse-No  VALUE  64.
  53.            88  MsgResponse-Enter  VALUE  128.
  54.       *
  55.       * End handcoded Message Box parameters
  56.       *
  57.  
  58.       *
  59.       * Begin hand coding for using a Container
  60.       *
  61.        01 ContainerRecord USAGE OBJECT REFERENCE.
  62.        01 Contents.
  63.           03 Contents-Length      PIC 9(9) COMP-5.
  64.           03 Contents-String.
  65.              05 Contents-Chars  PIC X
  66.                   OCCURS 1 TO 255 TIMES
  67.                   DEPENDING ON Contents-Length.
  68.        01 ParentIndex PIC 9(9) COMP-5.
  69.        01 RecordIndex PIC 9(9) COMP-5.
  70.       *
  71.       * End hand coding for using a Container
  72.       *
  73.        01 VDE-RC      PIC S9(9) USAGE COMP-5.
  74.        01 Lindex      PIC 9(2).
  75.  
  76.        LINKAGE SECTION.
  77.        01  DataArea.
  78.            COPY 'dataarea.cpy'.
  79.  
  80.        PROCEDURE DIVISION USING DataArea .
  81.       * ========================================
  82.  
  83.       *
  84.            If CS-Return-Code = 0
  85.  
  86.               Perform varying Lindex from 1 by 1
  87.                              until Lindex > Results-Knt
  88.       *
  89.       * Put each column into the data area of THEDATA class
  90.       *
  91.                 Move 15 to Contents-Length
  92.                 Move cs-Emp-Last-Data(Lindex) to Contents-String
  93.                 INVOKE thedata1 "setEmpLastn"
  94.                      USING Contents
  95.                 Move 12 to Contents-Length
  96.                 Move cs-Emp-First-Data(Lindex) to Contents-String
  97.                 INVOKE thedata1 "setEmpFirstn"
  98.                      USING Contents
  99.                 Move 1 to Contents-Length
  100.                 Move cs-Emp-Initial(Lindex) to Contents-String
  101.                 INVOKE thedata1 "setEmpMidn"
  102.                      USING Contents
  103.       *
  104.       * Add the Container record
  105.       *
  106.                 MOVE 0 TO ParentIndex
  107.                 SET ContainerRecord TO thedata1
  108.                 INVOKE InterfaceManager "addContainerRecordWithDetails"
  109.                        USING CContainerControl1 ParentIndex
  110.                        ContainerRecord
  111.                        RETURNING RecordIndex
  112.       * Retrieve the return code from the previous INVOKE
  113.       *
  114.                 INVOKE InterfaceManager "getErrorCode" USING
  115.                        CContainerControl1 RETURNING VDE-RC
  116.  
  117.       *        Save the key (RecordIndex) of the first entry in
  118.       *        the list so that a selected record's key can be
  119.       *        converted to an offset in the results table.
  120.                 If Lindex = 1 Then
  121.                   invoke thedata1 "setFirstRecId" USING RecordIndex
  122.                 End-If
  123.               End-perform
  124.            Else
  125.               If CS-No-Match
  126.                 Move 33 to MsgText-Length
  127.                 Move "Too bad, dude ... no match found."
  128.                     to MsgText-String
  129.                 Move 2 TO MsgSeverityIcon
  130.                 Move 1 TO MsgButtons
  131.                 Move 1 TO MsgDefaultButton
  132.                 Move 1 TO MsgModality
  133.                 Move 1 TO MsgMoveable
  134.                 Move 0 TO MsgHelpId
  135.                 INVOKE InterfaceManager "showMessage"
  136.                       USING MSG1 MsgText
  137.                        MsgSeverityIcon
  138.                        MsgButtons
  139.                        MsgDefaultButton
  140.                        MsgModality
  141.                        MsgMoveable
  142.                        MsgHelpId
  143.                     RETURNING MsgResponse
  144.               Else
  145.                If CS-DB-Error
  146.                   Move 42 to MsgText-Length
  147.                   String "Sorry, database error; SQL code: "
  148.                      CS-SQL-Code delimited by Size into MsgText-String
  149.                   Move 5 TO MsgSeverityIcon
  150.                   Move 1 TO MsgButtons
  151.                   Move 1 TO MsgDefaultButton
  152.                   Move 1 TO MsgModality
  153.                   Move 1 TO MsgMoveable
  154.                   Move 0 TO MsgHelpId
  155.                   INVOKE InterfaceManager "showMessage"
  156.                         USING MSG1 MsgText
  157.                          MsgSeverityIcon
  158.                          MsgButtons
  159.                          MsgDefaultButton
  160.                          MsgModality
  161.                          MsgMoveable
  162.                          MsgHelpId
  163.                      RETURNING MsgResponse
  164.                Else
  165.                   Move 32 to MsgText-Length
  166.                   Move "Bad news .... unexpected error."
  167.                                            to MsgText-String
  168.                   Move 5 TO MsgSeverityIcon
  169.                   Move 1 TO MsgButtons
  170.                   Move 1 TO MsgDefaultButton
  171.                   Move 1 TO MsgModality
  172.                   Move 1 TO MsgMoveable
  173.                   Move 0 TO MsgHelpId
  174.                   INVOKE InterfaceManager "showMessage"
  175.                         USING MSG1 MsgText
  176.                          MsgSeverityIcon
  177.                          MsgButtons
  178.                          MsgDefaultButton
  179.                          MsgModality
  180.                          MsgMoveable
  181.                          MsgHelpId
  182.                      RETURNING MsgResponse
  183.                End-if
  184.              End-if
  185.            End-If
  186.            GOBACK.
  187.  
  188.        END METHOD "showResults".
  189.  
  190.       * METHOD
  191.        IDENTIFICATION DIVISION.
  192.        METHOD-ID. "getdetails".
  193.        DATA DIVISION.
  194.        WORKING-STORAGE SECTION.
  195.       *
  196.        01 ContainerRecord USAGE OBJECT REFERENCE.
  197.        01 VDE-RC       PIC S9(9) USAGE COMP-5.
  198.        01 RecordIndex  PIC 9(9) COMP-5.
  199.       *
  200.       * Begin handcoded Message Box parameters
  201.       *
  202.        01 MsgText.
  203.           03 MsgText-Length      PIC 9(9) COMP-5.
  204.           03 MsgText-String.
  205.              05 MsgText-Chars  PIC X
  206.                   OCCURS 1 TO 255 TIMES
  207.                   DEPENDING ON MsgText-Length.
  208.        01 MsgSeverityIcon      PIC 9(9) COMP-5 VALUE 2.
  209.            88  MsgSeverityIcon-None  VALUE  1.
  210.            88  MsgSeverityIcon-Information  VALUE  2.
  211.            88  MsgSeverityIcon-Query  VALUE  3.
  212.            88  MsgSeverityIcon-Warning  VALUE  4.
  213.            88  MsgSeverityIcon-Error  VALUE  5.
  214.        01 MsgButtons      PIC 9(9) COMP-5 VALUE 1.
  215.            88  MsgButtons-Ok  VALUE  1.
  216.            88  MsgButtons-OkCancel  VALUE  2.
  217.            88  MsgButtons-Cancel  VALUE  3.
  218.            88  MsgButtons-Enter  VALUE  4.
  219.            88  MsgButtons-EnterCancel  VALUE  5.
  220.            88  MsgButtons-RetryCancel  VALUE  6.
  221.            88  MsgButtons-AbortRetryIgnore  VALUE  7.
  222.            88  MsgButtons-YesNo  VALUE  8.
  223.            88  MsgButtons-YesNoCancel  VALUE  9.
  224.        01 MsgDefaultButton      PIC 9(9) COMP-5 VALUE 1.
  225.            88  MsgDefaultButton-Button1  VALUE  1.
  226.            88  MsgDefaultButton-Button2  VALUE  2.
  227.            88  MsgDefaultButton-Button3  VALUE  3.
  228.        01 MsgModality      PIC 9(9) COMP-5 VALUE 1.
  229.            88  MsgModality-Application  VALUE  1.
  230.            88  MsgModality-System  VALUE  2.
  231.        01 MsgMoveable      PIC 9(9) COMP-5 VALUE 0.
  232.           88 MsgMoveable-False    VALUE 0.
  233.           88 MsgMoveable-True    VALUE 1.
  234.        01 MsgHelpId PIC 9(9) COMP-5 VALUE 0.
  235.        01 MsgResponse      PIC 9(9) COMP-5.
  236.            88  MsgResponse-OK  VALUE  1.
  237.            88  MsgResponse-Cancel  VALUE  2.
  238.            88  MsgResponse-Retry  VALUE  4.
  239.            88  MsgResponse-Abort  VALUE  8.
  240.            88  MsgResponse-Ignore  VALUE  16.
  241.            88  MsgResponse-Yes  VALUE  32.
  242.            88  MsgResponse-No  VALUE  64.
  243.            88  MsgResponse-Enter  VALUE  128.
  244.       *
  245.       * End handcoded Message Box parameters
  246.       *
  247.        LOCAL-STORAGE SECTION.
  248.        LINKAGE SECTION.
  249.        PROCEDURE DIVISION .
  250.       *
  251.       * Get the key (RecordIndex) of the selected record
  252.       *
  253.            SET ContainerRecord TO thedata1
  254.  
  255.            INVOKE InterfaceManager "getFirstSelected"
  256.                   USING CContainerControl1
  257.                   RETURNING RecordIndex
  258.  
  259.       * Retrieve the return code from previous INVOKE
  260.            Move 0 to VDE-RC
  261.            INVOKE InterfaceManager "getErrorCode" USING
  262.                   CContainerControl1 RETURNING VDE-RC
  263.  
  264.            If VDE-RC not equal 0 Then
  265.              Move 25 to MsgText-Length
  266.              Move "No employee was selected!" to MsgText-String
  267.              Move 5 TO MsgSeverityIcon
  268.              Move 1 TO MsgButtons
  269.              Move 1 TO MsgDefaultButton
  270.              Move 1 TO MsgModality
  271.              Move 1 TO MsgMoveable
  272.              Move 0 TO MsgHelpId
  273.              INVOKE InterfaceManager "showMessage" USING MSG1 MsgText
  274.                          MsgSeverityIcon
  275.                          MsgButtons
  276.                          MsgDefaultButton
  277.                          MsgModality
  278.                          MsgMoveable
  279.                          MsgHelpId
  280.                      RETURNING MsgResponse
  281.             Else
  282.       *       Process the key of the selected container record
  283.       *
  284.               Invoke thedata1 "setProcessIDX" USING RecordIndex
  285.            End-if
  286.  
  287.            GOBACK.
  288.  
  289.        END METHOD "getdetails".
  290.  
  291.       * Feature source code generation ends here.
  292.  
  293.