Uniform Staff Payroll System(USPS)

Document Sample
Uniform Staff Payroll System(USPS) Powered By Docstoc
					Uniform Staff Payroll
System (USPS)




Programmer Handbook
Preface

Intended Audience
               This manual is intended for techincal staff of the SSDT.




                                                                          v
1   BENADJ Callable Interface


                Revised 23-Jun-1993




                                      1–1
BENADJ




BENADJ
            BENADJ is a subprogram to adjust benefit balances. BENADJ is automatically
            invoked by the ABSDET frame. This is done so the benefit balances are
            always adjusted whenever a transaction is written, rewritten, or deleted. The
            working storage fields used to call BENADJ are stored in the BENADJ frame.



FORMAT      BENADJ BENADJ-Action, BENADJ-Return,
                   BENADJ-Warning-Msg, BENADJ-Rec

RETURNS     None. Fatal conditions are signaled. Error conditions are returned via
            BENADJ-Return and BENADJ-Msg.



ARGUMENTS   BENADJ-Action
            VMS Usage: Character
            type:         PIC X
            access:       read-only
            mechanism: by REFERENCE
            Action to be taken by BENADJ.

            Table 1–1 Action Values
            Value    Action
            A        Add the amount to the benefit record
            D        Delete the amount from the benefit record


            BENADJ-Return
            VMS Usage: Character
            type:        PIC X(2)
            access:      write-only
            mechanism: by REFERENCE
            Status returned by BENADJ. Fatal errors will not return.

            Table 1–2 Return Values
            Value    Return Status
            "00"     BENADJ-SUCCESS
            "00"     BENADJ-IO-OK
            "1"      BENADJ-WARNING
            "11"     MAX-SICK-EXCEEDED
            "12"     MAX-VAC-EXCEEDED
            "13"     MAX-PER-EXCEEDED
            "23"     BENADJ-IO-INVALID-KEY


1–2
                                                                         BENADJ



              BENADJ-Warning-Msg
              VMS Usage: Character
              type:      PIC X(80)
              access:    write-only
              mechanism: by REFERENCE
              Warning message returned by BENADJ based on the return value.

              BENADJ-Rec
              VMS Usage: Character
              type:      PIC X(size of ABSDET record)
              access:    read-only
              mechanism: by REFERENCE
              The ABSDET transaction BENADJ should use to update the balances.



DESCRIPTION
              BENADJ adjusts the benefit balances based on the trasaction it is given.
              The calling program can tell BENADJ that the tranaction is either being
              added to the ABSDET file, or deleted from it. When a ABSDET record
              is being rewritten (modified), BENADJ needs to be called twice: once
              deleting the old (original) record, and again adding the new (modified)
              record. The ABSDET frame automatically does all of this, calling BENADJ
              whenever necessary. All necessary working storage fields used to call
              BENADJ are available in BENADJ.F.


              Example 1–1 Calling BENADJ

              01   BENADJ-ACTION        PIC   X.
              01   BENADJ-RETURN        PIC   XX.
              01   BENADJ-WARNING-MSG   PIC   X(80).
              01   BENADJ-REC           PIC   X(ABSDET-REC length).
              CALL "BENADJ" USING BENADJ-ACTION
                                  BENADJ-RETURN
                    BENADJ-WARNING-MSG
                    BENADJ-REC.




                                                                                 1–3
2   GETDIST Callable Interface


                Revised 25-Aug-1993




                                      2–1
GETDIST




GETDIST

          USPS subprogram to return district information. This program will return the
          following information to the calling program.
          •   District IRN
          •   District Name
          •   District Street
          •   District City
          •   District State
          •   District Zipcode
          •   District Zipcode Extension

          An error flag is setup to return the following error codes.
          •   Y - Yes valid data, No errors
          •   N - No valid data, errors occured

          The call for the program should look like the following.
          Example 2–1 Calling GETDIST

                   01   WS-PROCESSING-ERROR           PIC X.
                   01   WS-DISTRICT-TABLE         VALUE SPACES.
                        03 WS-TAB-IRN                 PIC X(6).
                        03 WS-TAB-DIST                PIC X(30).
                        03 WS-TAB-STREET              PIC X(30).
                        03 WS-TAB-CITY                PIC X(15).
                        03 WS-TAB-STATE               PIC X(2).
                        03 WS-ENTIRE-ZIP.
                            05 WS-TAB-ZIP             PIC X(5).
                            05 WS-TAB-ZIP-EXT         PIC X(4).
                   CALL "GETDIST" USING WS-DISTRICT-TABLE
                                        WS-PROCESSING-ERROR.




2–2
                                                                              GETDIST




GETDIST
              Returns district name and address information to the calling program.
              •   The subroutine stores the current name and address. It will only open the
                  table file once.
              •   Negative result sends back a processing error and blank address.



FORMAT        GETDIST District-Table, Processing-Error

RETURNS       District Name, and address data. Y for test passed, N for test failure.



ARGUMENTS     District-Table
              VMS Usage: char-string
              type:        character string
              access:      read-only
              mechanism: by REFERENCE.
              Contains district name and address information.

              Processing-error
              VMS Usage: char-string
              type:       character string
              access:     read-only
              mechanism: by REFERENCE.
              Returns results of file read.



DESCRIPTION   NONE




                                                                                        2–3
3   GETTABL Callable Interface


                Revised 20-July-1995




                                       3–1
GETTABL




GETTABL

          USPS subprogram returns all information on the "000001" record of
          the TABL.IDX file not available through the GETDIST or USPFLAGS
          subprograms.
          An error flag is setup to return the following error codes.
          •     Y - Yes valid data, No errors
          •     N - No valid data, errors occured

          The call for the program should look like the following.
          Example 3–1 Calling GETTABL

                   01 WS-PROCESSING-ERROR       PIC X.
                   01 WS-GETTABL-TABLE.
              05    WS-TAB-BOARD-CK     PIC X.
              05    WS-TAB-PER-CK     PIC X.
              05    WS-TAB-SICK-CK     PIC X.
              05    WS-TAB-VAC-CK     PIC X.
                    05 WS-TAB-SICK-EXEMPT       PIC X.
              05    WS-SHIFT-PREMIUM-SW     PIC X.
              05    WS-FIXED-SHIFT-PREM.
                    10 WS-TAB-2SHFH      PIC V9(2).
                    10 WS-TAB-2SHFD      PIC 9V9(2).
                    10 WS-TAB-3SHFH      PIC V9(2).
                    10 WS-TAB-3SHFD      PIC 9V9(2).
              05    WS-PERC            REDEFINES FIXED-SHIFT-PREM.
                    10 WS-TAB-2SH      PIC 9(3)V9(2).
                    10 WS-TAB-3SH      PIC 9(3)V9(2).
              05    WS-TAB-HIGHESTCK-NUM    PIC 9(6).
              05    WS-HIGH-DIRDEP-NUM     PIC 9(6).
              05    WS-TAB-WKDAYS     PIC 9(3).
              05    WS-TAB-HSR-DAYS     PIC 9(3).
              05    WS-TAB-BIWK-SERDYS     PIC 9(2)V9(2).
              05    WS-TAB-BIWK-DAYS     PIC 9(2)V9(2).
              05    WS-TAB-RET-SW     PIC X.
              05    WS-TAB-STRSAD-SW     PIC X.
              05    WS-TAB-ADV-AMT     PIC S9(6)V9(2)
                       SIGN TRAILING.
              05    WS-SERS-DIST-CODE     PIC X(6).
              05    WS-STRS-DIST-CODE     PIC X(6).
              05    WS-TAB-LATDIS-CK     PIC X.
              05    WS-TAB-SPECIAL-PAY-CK    PIC X.
              05    WS-WRITTEN-AMT-FLAG     PIC X.
              05    WS-WRITTEN-AMT-PAYDED    PIC X.
              CALL "GETTABL"
                  USING WS-GETTABL-TABLE, WS-PROCESSING-ERROR.




3–2
                                                                             GETTABL




GETTABL
              Returns USPS configuration data from the TABL.IDX file.
              •   The subroutine stores the configuration data. It will only open the table
                  file once.
              •   Negative result sends back a processing error and blank address.



FORMAT        GETTABL Gettabl-Table, Processing-Error

RETURNS       USPS configuration data. Y for test passed, N for test failure.



ARGUMENTS     Gettabl-Table
              VMS Usage: char-string
              type:       character string
              access:     read-only
              mechanism: by REFERENCE.
              Contains configuration information.

              Processing-error
              VMS Usage: char-string
              type:       character string
              access:     read-only
              mechanism: by REFERENCE.
              Returns results of file read.



DESCRIPTION   NONE




                                                                                        3–3
4   LOGCURCK Frame & Callable Interface


                Revised 18-Nov-1993




                                          4–1
      LOGCURCK




      LOGCURCK
                   For each employee (or job) with USPCURCK data, there is also corresponding
                   data stored in other files. The purpose of the LOGCURCK is to access all of
                   this data as one entity. Programs using LOGCURCK will be able to access
                   and manipulate this data without having direct interaction with the individual
                   files.
                   Given an SSN or an SSN/JOB combination, a read on the LOGCURCK will
                   provide the SPC with tables containing all of this "logical" USPCURCK data.
                   The SPC can add, modify, or delete items in these tables and rewrite the
                   LOGCURCK record to update the data stored in the individual files. It will be
                   LOGCURCK’s responsibility to reconcile any differences existing between the
                   tables and the data files.
                   The SPC will also be able to delete a LOGCURCK. This means that any
                   USPCURCK, USPCURPY, USPCURPA, or USPCURDA for that employee
                   or job would be deleted. The exception to this would be the USPCURDA
                   data, which can only be deleted by employee, not job. It would also be
                   possible to create LOGCURCK data by creating the tables and performing
                   a write. The LOGCURCK will be useful in situations where this same data
                   must be processed multiple times. For instance, there will be modules to
                   generate net pay and total gross. Some programs that use these will also
                   need to generate a detailed report showing the data used to arrive at those
                   amounts. If LOGCURCK is used, these files will only need to be read once.
                   The resulting tables can be used to generate the total gross, the net pay, and
                   the detailed report. Otherwise, the files would need to be read twice.
                   LOGCURCK will be comprised of several parts. They are listed below.
                   Each is described in greater detail in following pages.

                   Item             Description
                   LOGCURCK.F       Frame that is used in place of individual file.f copies.
                   LOGCURCK.FD      Defines the interface to the subprogram, including the table layouts.
                                    The code for reorganizing the tables is also in this frame.
                   LOGCURCK.S       Callable subprogram. Performs the I/O on the physical files.
                                    This one SPC will produce three subprograms: LOGCURCK,
                                    LOGCURCK2, and LOGCURCK3.



4.1   LOGCURCK.F
                   LOGCURCK.F provides the logical I/O routines. These routines mimic
                   those available in FILE.F. Each routine (read, read-next, write, etc.) is
                   actually a call to LOGCURCK with the proper arguments. This frame
                   copies in LOGCURCK.FD to define the table layouts.




      4–2
                                                         LOGCURCK.F



Table 4–1 LOGCURCK.F CAPvariables
CAPvariable       Description
;LOGCURCK         Frame prefix
;FILE             File prefix. Default value LOGCURCK
;CUR              Table prefix. Default is "CUR".
;PRIMARYKEY       The logical key, default is ;LOGCURCK-KEY.
;FILEVERSION      Default is ;OECNVERSION.
;LOGICAL          Default is "OECN$DTA".
;AUTOUNLOCK       Determines if the record is automatically unlocked after it is
                  read. Default is "NO".
;FILESHARING      Only value used is "YES". File sharing will be handled
                  manually by LOGCURCK.
;IOROUTINE        Values are "LOGCURCK", "LOGCURCK2", and
                  "LOGCURCK3". Determines which subprogram image
                  will be called. All subprograms are identical. You need to use
                  two subprograms if you intend to have two logical files open
                  at the same time.
;LOCKOPTION       Determines the action taken when a lock occurs.
                  "UNCONDITIONAL" retries until the lock clears
                  "unconditionally". "RETURN" retries 10 times, if unsuccessful
                  then returns filestatus 92. "ABORT" retries 5 times, if
                  unsuccessful prompts the user with "retry or cancel" if the
                  user selects cancel filestatus 92 is returned. The frame will
                  contain the code necessary to handle a locked record. The
                  sub-program will always return a filestatus 92 if it encounters
                  a locked record.
;LOGCURCKMODE     "E" or "J". Determines default mode at compile-time. Also
                  determines what the MAX size of the tables will be set to.
;FILES            Values are "C" and "F". Determines whether the default files
                  opened will be current or future files. Default is "C". The
                  value of the cobol ;LOGCURCK-FILES field can be changed
                  to override this default value at run-time.
;PROTVIOLATIONS   Determines how protection violations are handled. Default
                  "NO" causes the sub-program to abort if protection violation
                  occurs.
;USEPARAMETERS    Determines if the calling parameters are going to be used.
                  Default is "YES"
;USEPA            Use Pay Account table? (YES/NO). Default value is "NO".
;USEPY            Use Pay Amount table? (YES/NO). Default value is "NO".
;USEDA            Use Deduction Amount table? (YES/NO). Default value is
                  "NO".
;SOFTLOCKS        Respect soft locks? (YES/NO) Default value is "NO".
;IOSCRN           Name of screen to be displayed in the case of an unusual I/O
                  error. If you do not specify a screen, a DISPLAY statement
                  will be used to display the error message itself. Default is
                  ’ZR’.




                                                                             4–3
LOGCURCK.F



             Table 4–1 (Cont.) LOGCURCK.F CAPvariables
             CAPvariable          Description

             ;IOSCRNFRAME         Screen frame used if ;IOSCN is not null. Default is
                                  "RECLCK.GR".


             Table 4–2 LOGCURCK.F SECTIONS
             Section                  Description
             ;FILE-INOPEN             Open file for input
             ;FILE-OUOPEN             Open file for output
             ;FILE-IOOPEN             Open file for input/output
             ;FILE-SHOPEN             Open file for shared input/output
             ;FILE-CLOSE              Close file
             ;FILE-READNEXT           Read the next record
             ;FILE-READNEXTHOLD       Read the next record and hold it
             ;FILE-RESTART            Restarts the file (same as STARTEQ)
             ;FILE-READ               Read a record by key
             ;FILE-READHOLD           Read and hold a record by key
             ;FILE-REORG              Reorganize the tables. Deleted elements are removed
                                      and the tables are sorted. Dependencies between tables
                                      are also examined and elements without parents will be
                                      removed.
             ;FILE-WRITE              Write a record
             ;FILE-REWRITE            Rewrite an updated record
             ;FILE-START              Start at key not less than SSN/JOB
             ;FILE-STARTEQ            Start at key = SSN/JOB
             ;FILE-DELETE             Delete a record
             ;FILE-POSTIO             Analyzes the success of the IO
             ;FILE-HANDLE-LOCK        Handles record locks
             ;FILE-LOCK-PAUSE         Pauses before retrying locked record
             ;FILE-UNLOCK             Unlock the current record(s)
             ;FILE-UNLOCK-ALL         Same function as UNLOCK
             ;FILE-CALL-SUB           Calls the subprogram. DO NOT CALL THIS SECTION
                                      DIRECTLY!




4–4
                                                                           LOGCURCK.F



                      Example 4–1 Copying the LOGCURCK.F into the SPC

                      %+
                      % This copy uses the current files as the default.
                      % It will call the subprogram LOGCURCK.
                      %-
                      .COPY LOGCURCK.F
                      .REPLACE LOGCURCK   BY LOGCURCK
                      .REPLACE AUTOUNLOCK BY NO     % Unlock record after read?
                      .REPLACE IOROUTINE BY LOGCURCK      % LOGCURCK, LOGCURCK2 or LOGCURCK3
                      .REPLACE LOCKOPTION BY UNCONDITIONAL% Retry locks until successful.
                      .REPLACE LOGCURCKMODE BY ’E’     % Initial mode Employee or Job.
                      .REPLACE FILES     BY ’C’     % Initial files Current or Future
                      .REPLACE PROTVIOLATIONS BY NO     % Return to SPC on prot viol?
                      .REPLACE USEPA     BY YES     % Use Pay Account data?
                      .REPLACE USEPY     BY YES     % Use Pay Amount data?
                      .REPLACE USEDA     BY YES     % Use Deduction Amount data?
                      .END-COPY   %LOGCURCK
                      %+
                      % This copy uses the future files. In this
                      % particular example, it also does not use the deductions.
                      % It will call the subprogram LOGCURCK2.
                      %-
                      .COPY LOGCURCK.F
                      .REPLACE LOGCURCK   BY LOGFUTCK
                      .REPLACE AUTOUNLOCK BY NO     % Unlock record after read?
                      .REPLACE IOROUTINE BY LOGCURCK2     % LOGCURCK, LOGCURCK2 or LOGCURCK3
                      .REPLACE LOCKOPTION BY UNCONDITIONAL% Retry locks until successful.
                      .REPLACE LOGCURCKMODE BY ’E’     % Initial mode Employee or Job.
                      .REPLACE FILES     BY ’F’     % Initial files Current or Future
                      .REPLACE PROTVIOLATIONS BY NO     % Return to SPC on prot viol?
                      .REPLACE USEPA     BY YES     % Use Pay Account data?
                      .REPLACE USEPY     BY YES     % Use Pay Amount data?
                      .REPLACE USEDA     BY NO     % Use Deduction Amount data?
                      .END-COPY   %LOGCURCK




4.1.1   How do I use LOGCURCK.F?
                      For the most part, just like you would FILE.F. The difference is that
                      instead of having one record, you have one or more tables. Here are some
                      simple examples:
                      Example 4–2 Using the LOGCURCK.F sections

                      *+
                      * Open LOGCURCK.
                      *-
                          PERFORM LOGCURCK-IOOPEN.
                          (or)
                          PERFORM LOGCURCK-INOPEN.
                          (or)
                          PERFORM LOGCURCK-OUOPEN.
                      *+
                      * Read LOGCURCK
                      *-
                          MOVE "111223333" TO LOGCURCK-SSN.
                          MOVE "01" TO LOGCURCK-JOB.
                          PERFORM LOGCURCK-READ.
                          IF NOT LOGCURCK-IO-OK
                               (error reading LOGCURCK).


                      Example 4–2 Cont’d on next page

                                                                                           4–5
        LOGCURCK.F



                       Example 4–2 (Cont.) Using the LOGCURCK.F sections

                        *+
                        * Close LOGCURCK
                        *-
                            PERFORM LOGCURCK-CLOSE.
                        *+
                        * Write LOGCURCK. First move data out
                        * to the LOGCURCK tables. You must
                        * increment the table size before
                        * you add an element.
                        *-
                            INITIALIZE LOGCURCK-KEY.
                            MOVE "111224444" TO LOGCURCK-SSN.
                            ADD 1 TO CURCK-SIZE.
                            MOVE {CK data} TO CURCK-field(1).
                            ADD 1 TO CURPY-SIZE.
                            MOVE {PY data} TO CURPY-field(1).
                            ADD 1 TO CURPA-SIZE.
                            MOVE {PA data} TO CURPA-field(1).
                            ADD 1 TO CURPA-SIZE.
                            MOVE {PA data} TO CURPA-field(2).
                            PERFORM LOGCURCK-WRITE.




4.1.2   When Do I need values in the LOGCURCK-KEY?
                       When you are in Job mode, you should always make sure you have values
                       in both the LOGCURCK-SSN and LOGCURCK-JOB. When in employee
                       mode, you only need a value in LOGCURCK-SSN.


4.2     LOGCURCK.FD
                       LOGCURCK.FD provides the working storage fields for calling the
                       LOGCURCK subprogram, or the linkage section fields for receiving
                       the calling parameters. This frame also contains the code for the
                       reorganization of the tables. You can use the CAPvariables to select
                       what parts of the frame get copied in. For example, it is possible to copy
                       in only specific tables, leave off the ;LOGCURCK-PARAMETERS, and
                       not copy the code for the reorganization. This frame is copied by both
                       LOGCURCK.F and the LOGCURCK subprograms. The table layouts have
                       the same fields as the physical records, and are generated from the GFDs
                       of the individual files. Included with each table will be a count of the
                       number of elements stored in the table, and a maximum size for the table.
                       The maximum size for the table is necessary because different SPC’s
                       may have different size tables. The tables internal to the LOGCURCK
                       subprograms, however, will be a constant size. The maximum will ensure
                       LOGCURCK never creates a table larger than the SPC can handle. The
                       maximum may change depending on which mode (employee or job) is being
                       used.




        4–6
                                                          LOGCURCK.FD



Table 4–3 LOGCURCK.FD CAPvariables
CAPvariable          Description
;LOGCURCK            Frame prefix.
;SECTIONNAME         Default is "WORKING-STORAGE". Can also be "LINKAGE
                     SECTION".
;LOGCURCKMODE        "E" or "J". Determines default mode at compile-time. Also
                     determines what the MAX size of the tables will be set to.
;CUR                 Table prefix. Default is "CUR".
;FILES               Values are "C" and "F". Determines whether the default files
                     opened will be current or future files. Default is "C". The
                     value of the cobol ;LOGCURCK-FILES field can be changed to
                     override this default value at run-time.
;USEREORG            Include code for reorganization? (YES/NO). Default value is
                     "YES".
:USEPARAMETERS       Include ;LOGCURCK-PARAMETERS group? (YES/NO).
                     Default value is "NO".
;USEPA               Use Pay Account table? (YES/NO). Default value is "NO".
;USEPY               Use Pay Amount table? (YES/NO). Default value is "NO".
;USEDA               Use Deduction Amount table? (YES/NO). Default value is
                     "NO".
;MAXCK               The initial maximum size for the check table. Default value is
                     20.
;MAXDA               The initial maximum size for the deduction amount table.
                     Default value is 36.
;MAXPA               The initial maximum size for the pay account table. Default
                     value is 160.
;MAXPY               The initial maximum size for the pay amount table. Default
                     value is 80.


If you are not copying in LOGCURCK.FD by itself (i.e. you are
using LOGCURCK.F to copy it in), then you should not perform the
LOGCURCK.FD sections directly. Only the LOGCURCK.F sections should
be performed. The LOGCURCK.FD sections are being documented
because there are some subprograms that will only be copying
LOGCURCK.FD to use the working storage tables that are passed to
them. These subprograms will need access to the reoganization routines.
Note that some of the reorg sections will be selected out if all of the tables
are not used.

Table 4–4 LOGCURCK.FD SECTIONS
Section                              Description
;LOGCURCK-PROCESS-REORG              Main section for reorganization.
;LOGCURCK-CHECK-PY-DEPEND            Make sure there are parent CK elements.
;LOGCURCK-CHECK-PA-DEPEND            Make sure there are parent PY elements.
;LOGCURCK-CHECK-DA-DEPEND            Make sure there are parent CK elements.



                                                                                  4–7
LOGCURCK.FD



              Table 4–4 (Cont.) LOGCURCK.FD SECTIONS
              Section                          Description

              ;LOGCURCK-SORT-DELETE-CK         Removes elements with SSN of spaces, sorts
                                               the CK table.
              ;LOGCURCK-SORT-DELETE-PY         Removes elements with SSN of spaces, sorts
                                               the PY table.
              ;LOGCURCK-SORT-DELETE-PA         Removes elements with SSN of spaces, sorts
                                               the PA table.
              ;LOGCURCK-SORT-DELETE-DA         Removes elements with SSN of spaces, sorts
                                               the DA table.



              Example 4–3 Copying the LOGCURCK.FD into a subprogram

               *+
               * This is a subprogram that needs to accept LOGCURCK tables from
               * the program that is calling it.
               *
               * It will have available to it the section ;LOGCURCK-PROCESS-REORG.
               *-
               LINKAGE SECTION.
               .COPY LOGCURCK.FD
               .REPLACE LOGCURCK BY LOGCURCK
               .REPLACE SECTIONNAME BY ’LINKAGE SECTION’
               .REPLACE CUR BY CUR
               .REPLACE USEREORG BY YES % Include code for reorganization?
               .REPLACE USEPARAMETERS BY NO % Use the calling parameters?
               .REPLACE USEPA BY YES % Use the pay accounts?
               .REPLACE USEPY BY YES % Use the pay amounts?
               .REPLACE USEDA BY YES % Use the deductions?
               .REPLACE LOGCURCKMODE BY E
               .END-COPY
                PROCEDURE DIVISION USING CURCK-TABLE-GROUP
                    CURPA-TABLE-GROUP
                    CURPY-TABLE-GROUP
                    CURDA-TABLE-GROUP.




4–8
                                                    LOGCURCK subprograms




LOGCURCK subprograms
            Performs I/O on the physical files. Loads data into the tables (read), writes
            table data to the physical files (write), deletes all data from the physical files
            (delete), and reconciles table data with the physical records (rewrite).



FORMAT      LOGCURCK ;LOGCURCK-Parameters
                     ;CURCK-Table-Group,
                     ;CURPA-Table-Group,
                     ;CURPY-Table-Group,
                     ;CURDA-Table-Group

RETURNS     None. Error condition is signaled.



ARGUMENTS   ;LOGCURCK-Parameters
            VMS Usage: Group item
            type:       Group item
            access:     read-write
            mechanism: by REFERENCE.
            Group item that contains the calling parameters for the LOGCURCK
            subprogram. Does not include the tables.

            Table 4–5 Elements in ;LOGCURCK-Parameters
            Item                                     Picture              Description
            ;LOGCURCK-KEY                            Group size 11        Logical key.
            ;LOGGURCK-SSN                            PIC X(9)             Key SSN.
            ;LOGCURCK-JOB                            PIC X(2)             Key JOB.
            ;LOGCURCK-MODE                           PIC X                Employee or Job
                                                                          mode.
            ;LOGCURCK-FILES                          PIC X                Current or Future
                                                                          files.
            ;LOGCURCK-FUNCTION                       PIC X(2)             Function to perform.
            ;LOGCURCK-SUBFUNCTION                    PIC X(2)             Subfunction to
                                                                          perform.
            ;LOGCURCK-FILESTATUS                     PIC X(2)             Status of performed
                                                                          function.
            ;LOGCURCK-TABLE-ENABLE-FLAGS             Group Size 9         Flags to enable or
                                                                          disable the use of
                                                                          the tables.
            ;CURPA-Enable-Flag                       PIC X(3)             NO = Unused, YES
                                                                          = Used




                                                                                           4–9
LOGCURCK subprograms



            Table 4–5 (Cont.) Elements in ;LOGCURCK-Parameters
            Item                                    Picture       Description

            ;CURPY-Enable-Flag                      PIC X(3)      NO = Unused, YES
                                                                  = Used
            ;CURDA-Enable-Flag                      PIC X(3)      NO = Unused, YES
                                                                  = Used


            Table 4–6 Valid MODE settings
            Value   Mode           Required Key
            E       Employee       SSN
            J       Job            SSN, Job


            Table 4–7 Valid FILES settings
            Value   Files
            C       Current
            F       Future


            Table 4–8 Valid FUNCTION settings
            Value   Function
            OP      Open
            ST      Start
            RE      Read
            RN      Read Next
            WR      Write
            RO      Reorganize
            RW      Rewrite
            DE      Delete
            CL      Close
            UL      Unlock


            Table 4–9 Valid SUBFUNCTION settings
            Value   Subfuction           Corresponding Function
            IO      Input-Output         Open
            IN      Input                Open
            OU      Output               Open
            LO      Lock                 Read/Read-Next
            NL      No Lock              Read/Read-Next
            EQ      Key = SSN/JOB        Start




4–10
                                    LOGCURCK subprograms



;CURCK-Table-Group
VMS Usage: Group item
type:        Group item
access:      read-write
mechanism: by REFERENCE.
Group item that contains information pertaining to the check table.
Contains the following:

Table 4–10 Elements in ;CURCK-Table-Group
Item                 Picture     Description
;CURCK-Size          PIC 9(3)    Indicates the number of elements currently in
                                 the table. This is the DEPENDING on variable
                                 for the table.
;CURCK-Max           PIC 9(3)    Indicates the maximum number of elements
                                 possible in the table. This is the ’n’ variable in
                                 the "0 TO n times" phrase of the table.
;CURCK-Table         n/a         The table itself has the same field layout of
                                 the USPCURCK file. Is indexed by ;CURCK-C
                                 and ;CURCK-I.


CURPA-Table-Group
VMS Usage: Group item
type:        Group item
access:      read-write
mechanism: by REFERENCE.
Group item that contains information pertaining to the Payroll Accounts
table. Contains the following:

Table 4–11 Elements in ;CURPA-Table-Group
Item                 Picture     Description
;CURPA-Size          PIC 9(3)    Indicates the number of elements currently in
                                 the table. This is the DEPENDING on variable
                                 for the table.
;CURPA-Max           PIC 9(3)    Indicates the maximum number of elements
                                 possible in the table. This is the ’n’ variable in
                                 the "0 TO n times" phrase of the table.
;CURPA-Table         n/a         The table itself has the same field layout of
                                 the USPCURPA file. Is indexed by ;CURPA-C
                                 and ;CURPA-I.


;CURPY-Table-Group
VMS Usage: Group item
type:        Group item
access:      read-write
mechanism: by REFERENCE.
Group item that contains information pertaining to the Pay Amounts
table. Contains the following:


                                                                             4–11
LOGCURCK subprograms



              Table 4–12 Elements in ;CURPY-Table-Group
              Item                 Picture      Description
              ;CURPY-Size          PIC 9(3)     Indicates the number of elements currently in
                                                the table. This is the DEPENDING on variable
                                                for the table.
              ;CURPY-Max           PIC 9(3)     Indicates the maximum number of elements
                                                possible in the table. This is the ’n’ variable in
                                                the "0 TO n times" phrase of the table.
              ;CURPY-Table         n/a          The table itself has the same field layout of
                                                the USPCURPY file. Is indexed by ;CURPY-C
                                                and ;CURPY-I.


              ;CURDA-Table-Group
              VMS Usage: Group item
              type:       Group item
              access:     read-write
              mechanism: by REFERENCE.
              Group item that contains information pertaining to the Deduction
              Amounts table. Contains the following:

              Table 4–13 Elements in ;CURDA-Table-Group
              Item                 Picture      Description
              ;CURDA-Size          PIC 9(3)     Indicates the number of elements currently in
                                                the table. This is the DEPENDING on variable
                                                for the table.
              ;CURDA-Max           PIC 9(3)     Indicates the maximum number of elements
                                                possible in the table. This is the ’n’ variable in
                                                the "0 TO n times" phrase of the table.
              ;CURDA-Table         n/a          The table itself has the same field layout of the
                                                USPCURDA file. Indexed by ;CURDA-C and
                                                ;CURDA-I.




DESCRIPTION
              Use Of Tables By SPCs
              Normally, all SPCs will interact with LOGCURCK via the LOGCURCK.F
              frame. This frame acts much like FILE.F and should be usable for most
              applications. The FD file is automatically copied in by LOGCURCK.F, so
              the table definitions and the calling parameters will already be available
              to the SPC in working storage. The call to the subprogram is taken care
              of by LOGCURCK.F, and it sets the function and subfunction arguments
              based on the I-O operation being performed. Direct interaction with the
              LOGCURCK, LOGCURCK2, or LOGCURCK3 subprograms should not be
              necessary.
              Because SPCs can add items to and delete items from the tables, it is
              imperative the count of table elements be updated whenever an element is
              written or deleted.


4–12
                                      LOGCURCK subprograms



It is estimated these tables will take up an average of 25 pages of memory.
To reduce memory paging, table elements not used will never be touched.
VMS does not bother swapping in table elements that are never accessed.
This means the tables will never be initialized. LOGCURCK and any
SPCs using the tables will use the TABLE-??-SIZE fields to determine how
many elements are being used in each table. To "initialize" a table, set it’s
size field to zero.
Removing elements from tables
To remove elements from the tables, the SPC will move spaces to the SSN
field of the element to be deleted. This element will then be removed from
the table by LOGCURCK at the time a WRITE or REWRITE is done. A
section called ;FILE-REORG will also be available to reorganize a table.
In addition to sorting the tables and removing "deleted" elements, it also
removes any elements that were "dependent" on elements that have been
deleted. The dependency rules are illustrated in the following table.

Table           Elements                     Dependencies.
USPCURCK        Checks                       No dependency.
USPCURPY        Pay Amounts                  Require parent check element.
USPCURPA        Pay Accounts                 Require parent pay amount element.
USPCURDA        Deduction Amounts            Require parent check element.

So, for example, if a check element was removed from the table, REORG
would also remove all of the pay amounts and deductions that belonged to
that check. It would then remove all of the pay accounts that belonged to
the pay amounts.
The Rewrite Function
It is possible that the SPC may modify elements in any of the tables, and
may also add or delete elements. LOGCURCK must decide how to rewrite
these tables to the physical files.
An efficient method would be for LOGCURCK to compare the elements in
the table to the physical records. The processing would occur as follows:

Table Element      File Record      Action
Yes                Yes              Rewrite file record.
Yes                No               Write file record.
No                 Yes              Delete file record.

This method may not be implemented right away. An easier method is to
simply delete all of the file records and write out all of the table elements.
This is more costly in file I/O, but would be simpler to code initially.
File Sharing and Record Locking
File sharing and record locking will always be handled manually by
LOGCURCK. The files will be opened "ALLOWING ALL". In order to
maintain integrity between the table data and the physical files, record
locks will be based on the USPCURCK file. If a process holds a lock on a
USPCURCK record, it also holds a "logical" lock on all of the associated


                                                                             4–13
LOGCURCK subprograms



            data. The only record physically locked is the USPCURCK record. Record
            locking will be handled manually by LOGCURCK.
            Purpose Of The Max-Size Fields
            Some SPCs may require smaller or larger table sizes than other SPCs.
            The subprogram, however, must use a fixed-size table to serve all of the
            SPCs. The ???-Max-Size fields serve as a way for the subprogram to
            know what table size the SPC wishes to use. If a READ or READNEXT
            operation ever exceeds this maximum size, the program will abort with a
            fatal error message.
            LOGCURCK, LOGCURCK2, and LOGCURCK3 Subprograms.
            Since the physical I/O is done via the LOGCURCK subprogram, it
            presents a problem in that the calling program cannot process the both
            the current and future files at the same time. Regardless of how many
            times LOGCURCK.F was copied in, there would still only be one image of
            the subprogram. To get around this, three versions of the subprogram will
            exist.
            The first version of the subprogram will be called LOGCURCK. This is
            the version that will be used if the ;IOROUTINE CAPvariable is set to
            "LOGCURCK". The second and third versions of the subprogram will
            be called LOGCURCK2 and LOGCURCK3. These are the versions that
            will be used if the ;IOROUTINE CAPvariable is set to "LOGCURCK2" or
            "LOGCURCK3". All three of these subprograms are identical. Any one of
            them can be used to process the current files or the future files.
            To see an example of how the subprogram will be determined, see the
            LOGCURCK.F description.


            Example 4–4 Calling LOGCURCK subprogram

            *+
            * Opens the current files for input.
            * The mode is by JOB.
            *-
                MOVE "123456789" TO SSN.
                MOVE "01" TO JOB.
                MOVE "J" TO MODE.
                MOVE "C" TO FILES.
                MOVE "OP" TO FUNCTION.
                MOVE "IN" TO SUBFUNCTION.
                CALL "LOGCURCK" USING
                 BY REFERENCE LOGCURCK-PARAMETERS
                 BY REFERENCE CK-TABLE-GROUP
                 BY REFERENCE PA-TABLE-GROUP
                 BY REFERENCE PY-TABLE-GROUP
                 BY REFERENCE DA-TABLE-GROUP.




4–14
5   USPFLAGS Callable Interface


                Revised 06-Jan-1995




                                      5–1
USPFLAGS




USPFLAGS

           USPFLAGS is used to set, reset and test program flags in the table file. For
           USPS V4.0 there are six flags that are checked or set with this routine.
           The flags used in this routine are:
           •   TAB-INICAL-CK
           •   TAB-CALCPAY-CK
           •   TAB-BUDPRO-CK
           •   TAB-CHKPRT-CK
           •   TAB-PAYDED-CK
           •   TAB-PAYDIR-CK

           The call for the program should look like the following.
           Example 5–1 Calling USPFLAGS

               01   WS-FUNCTION PIC X(2).
               01   WS-PROGRAM PIC X(8).
               01   WS-RETURN-VALUE PIC X.
               01   WS-MESSAGE PIC X(80).
               CALL "USPFLAGS" USING
                   BY REFERENCE    WS-FUNCTION,
                   BY REFERENCE    WS-PROGRAM,
                   BY REFERENCE    WS-RETURN-VALUE
                   BY REFERENCE    WS-MESSAGE.


           The following tables show all of the valid function calls and the flags that are
           set. For the test function, the flag values shown are the values needed to
           pass the test. Flags that are marked with an "*" in the file are considered
           to be "on". Flags that are marked with a " " are considered to be "off". The
           CHKPRT flag has two additional flag values. These values are "I" and "U".
           The "I" indicates that CHKPRT is in progress, while the "U" indicates that
           CHKUPD is in progress. These flags values were added to allow USPS
           programs to check the status of CHKPRT and CHKUPD to prevent processing
           while either program is in progress.




5–2
                                                               USPFLAGS - Test




USPFLAGS - Test
            Sends back results of program flag test.
            •   Should be called in program before files are opened.
            •   Negative result sends back descriptive message of failure.



FORMAT      USPFLAGS Function, Program-sequence,
                     Return-Value, Message

RETURNS     Y for test passed, N for test failure. Message is returned for failed test.



ARGUMENTS   Function
            VMS Usage:      char-string
            type:           character string
            access:         read-write
            mechanism:       by REFERENCE.
            For this call   value is "T".

            Program-sequence
            VMS Usage: char-string
            type:        character string
            access:      read-only
            mechanism: by REFERENCE.
            Name of testing procedure.

            Return-value
            VMS Usage: char-string
            type:       character string
            access:     write-only
            mechanism: by REFERENCE.
            Returns results of flag test.

            Message
            VMS Usage: Char-string
            type:       character string
            access:     write-only
            mechanism: by REFERENCE.
            The error message returned when test fails.




                                                                                      5–3
USPFLAGS - Test



              Table 5–1 TESTING PROCEDURES
                     Program
              Func   Sequence        Flags               Status
              T      PAYINPRO        INICAL-CK           on
                                     CALCPAY-CK          on or off
                                     BUDPRO-CK           on or off
                                     CHKPRT-CK           on or off


              T      BUDPRO          INICAL-CK           on
                                     CALCPAY-CK          on
                                     BUDPRO-CK           on or off
                                     CHKPRT-CK           on or off


              T      CHKPRT          INICAL-CK           on
                                     CALCPAY-CK          on
                                     BUDPRO-CK           on
                                     CHKPRT-CK           on or off


              T      CHKUPD          INICAL-CK           on
                                     CALCPAY-CK          on
                                     BUDPRO-CK           on
                                     CHKPRT-CK           on


              T      PAYDED          PAYDED-CK           off


              T      PAYDIR          PAYDIR-CK           off


              A valid or "Y" response from the call means the test was passed.
              INICAL will use the PAYINPRO testing procedure to determine if there is
              a pay in process. The result of the test will direct the file setup routines
              used in INICAL. CALCPAY will also use PAYINPRO. The test will have to
              be will have to be valid before CALCPAY can be run.




5–4
                                                             USPFLAGS - Reset




USPFLAGS - Reset
            Resets flags in table file to " ".
            •   Should be called when a program ends abnormally.
            •   Return-Value is "N" when call fails.
            •   Program sequence should be the program you want the user to rerun.



FORMAT      USPFLAGS Function, Program-sequence,
                     Return-Value, Message

RETURNS     Y for test passed, N for test failure. Message is returned for failed call.



ARGUMENTS   Function
            VMS Usage:      char-string
            type:           character string
            access:         read-write
            mechanism:       by REFERENCE.
            For this call   value is "R".

            Program-sequence
            VMS Usage: char-string
            type:       character string
            access:     read-only
            mechanism: by REFERENCE.
            Name of program to be forced to rerun.

            Return-value
            VMS Usage: char-string
            type:       character string
            access:     write-only
            mechanism: by REFERENCE.
            Returns results of flag test.

            Message
            VMS Usage: Char-string
            type:       character string
            access:     write-only
            mechanism: by REFERENCE.
            The error message returned when test fails.




                                                                                      5–5
USPFLAGS - Reset



              Table 5–2 RESET PROCEDURES
                    Program
             Func   Sequence       Flags                Status
             R      INICAL         INICAL-CK            off
                                   CALCPAY-CK           off
                                   BUDPRO-CK            off
                                   CHKPRT-CK            off


             R      CALCPAY        INICAL-CK            on
                                   CALCPAY-CK           off
                                   BUDPRO-CK            off
                                   CHKPRT-CK            off


             R      BUDPRO         INICAL-CK            on
                                   CALCPAY-CK           on
                                   BUDPRO-CK            off
                                   CHKPRT-CK            off


             R      CHKPRT         INICAL-CK            on
                                   CALCPAY-CK           on
                                   BUDPRO-CK            on
                                   CHKPRT-CK            off


             R      PAYDED         PAYDED-CK            off


             R      PAYDIR         PAYDIR-CK            off


             The RESET routines are used to force, or allow, the user to rerun a specific
             program. The value of the program sequence should be the program that
             is to be rerun.




5–6
                                                                 USPFLAGS - Set




USPFLAGS - Set
            Sets the proper flags for program completion.
            •   Should be called when program completes normally.
            •   Return-Value is "N" when call fails.
            •   Program sequence is the program that has completed.



FORMAT      USPFLAGS Function, Program-sequence,
                     Return-Value, Message

RETURNS     Y for test passed, N for test failure. Message is returned for failed call.



ARGUMENTS   Function
            VMS Usage:      char-string
            type:           character string
            access:         read-write
            mechanism:       by REFERENCE.
            For this call   value is "S".

            Program-sequence
            VMS Usage: char-string
            type:       character string
            access:     read-only
            mechanism: by REFERENCE.
            Name of program that has completed.

            Return-value
            VMS Usage: char-string
            type:       character string
            access:     write-only
            mechanism: by REFERENCE.
            Returns results of flag test.

            Message
            VMS Usage: Char-string
            type:       character string
            access:     write-only
            mechanism: by REFERENCE.
            The error message returned when test fails.




                                                                                      5–7
USPFLAGS - Set



                 Table 5–3 SET PROCEDURES
                      Program
             Func     Sequence    Flags               Status


             S        INICAL      INICAL-CK           on
                                  CALCPAY-CK          off
                                  BUDPRO-CK           off
                                  CHKPRT-CK           off


             S        CALCPAY     CALCPAY-CK          on
                                  BUDPRO-CK           off
                                  CHKPRT-CK           off


             S        BUDPRO      BUDPRO-CK           on


             S        CHKPRT      CHKPRT-CK           on


             S        CHKUPD      INICAL-CK           off
                                  CALCPAY-CK          off
                                  BUDPRO-CK           off
                                  CHKPRT-CK           off
                                  PAYDIR-CK           off
                                  PAYDED-CK           on


             S        PAYDED      PAYDED-CK           on


             S        PAYDIR      PAYDIR-CK           on


             The SET routines above show exactly what flags are set when called. Any
             flag that is not shown in this table will retain its previous value. The
             value of the program sequence should be the name of the program that
             called USPFLAGS.




5–8
                                                       USPFLAGS - Inprogress




USPFLAGS - Inprogress
            Sets process named to be in progress.
            •   Should be called when program starts normally.
            •   Return-Value is "N" when call fails.
            •   Program sequence program that is in progress.



FORMAT      USPFLAGS Function, Program-sequence,
                     Return-Value, Message

RETURNS     Y for test passed, N for test failure. Message is returned for failed call.



ARGUMENTS   Function
            VMS Usage:      char-string
            type:           character string
            access:         read-write
            mechanism:       by REFERENCE.
            For this call   value is "I".

            Program-sequence
            VMS Usage: char-string
            type:       character string
            access:     read-only
            mechanism: by REFERENCE.
            Name of program in progress.

            Return-value
            VMS Usage: char-string
            type:       character string
            access:     write-only
            mechanism: by REFERENCE.
            Returns results of flag test.

            Message
            VMS Usage: Char-string
            type:       character string
            access:     write-only
            mechanism: by REFERENCE.
            The error message returned when test fails.




                                                                                      5–9
USPFLAGS - Inprogress



              Table 5–4 SET PROCEDURES
                     Program
              Func   Sequence        Flags               Status


              S      CHKPRT          CHKPRT-CK           "I" CHKPRT in progress


              S      CHKUPD          INICAL-CK           "U" CHKUPD in progress


              The in progress routines above show exactly what flags are set when
              called. Any flag that is not shown in this table will retain its previous
              value. The value of the program sequence should be the name of the
              program that called USPFLAGS.




5–10