simple request/complex solution?

Michael C. Lee mclsys@home.com
Fri, 07 Aug 1998 08:44:07 -0700


I have some questions for your user. Will she sometimes enter the EMP-NO and
other times the ACCT-NO and yet other times the PAY-PERIOD-NO? Or will she
enter all three fields at one time and if so, why is she doing this?  Take the
following data (Please):
    EMP-NO    ACCT-NO    PAY-PERIOD-NO
        1                A-901                98-04
        2                A-902                98-04
        3                A-903                98-04
        4                A-904                98-05
        5                A-905                98-06

If the user entered in EMP-NO 1, 2, 3 and account numbers A-901, A-904 and Pay
period 98-04 what would they like to see? EMP-NO 1 reported 3 times? If this
still makes sense you might want to find out which key value is most likely to
be used and which will return the least values and use it in your CHOOSE
statement and the other fields in a SELECT statement. These should be for in a
QUICK screen with temps and you could create a job script using a temporary
file that will be submitted at the end of data entry. The job script
(Powerhouse part only) would like something like this...
    EXECUTE program NOGO
    CHOOSE EMP-NO '1', '2', '3'
    SELECT IF (ACCT-NO = 'A-901' OR ACCT-NO = 'A-904') and &
                        (PAY-PERIOD-NO = '98-04)
    GO
This will report only the data that meets all three criteria (AND condition).
To get data that meets at least one criteria ("OR") you would have to use
SELECTS and no CHOOSE statement.
    EXECUTE program NOGO
    SELECT IF EMP-NO = '1' or EMP-NO = '2' or EMP-NO = '3' or &
                        ACCT-NO = 'A-901' or ACCT-NO = 'A-904' or &
                        PAY-PERIOD-NO = '98-04'
    GO
If this is the case (and the user can handle it) it would be better to create
three different reports to increase performance.

;------------------------------------------------------------------------
If it's the first scenario where the user wants to enter one of EMP-NO or
ACCT-NO or PAY-PERIOD-NO then perhaps you could build a QUIZ job in the
background that creates a job as follows:

If the user enters EMP-NO '1', '2', '3'
    EXECUTE program NOGO
    CHOOSE EMP-NO '1', '2' , '3'
    GO

If the user enters ACCT-NO A-901, A-904
    EXECUTE program NOGO
    CHOOSE ACCT-NO 'A-901', 'A-904'
    GO

If the user enters PAY-PERIOD-NO 98-04
    EXECUTE program NOGO
    {AND} SELECT IF PAY-PERIOD-NO = '98-04' <--- {AND} if a SELECT

already exists
    GO


Michael Lee
MCL Systems Inc.




Pablo Grim wrote:

> Hey folks,
>
> I have a simple request from a user.  She wants to be able to retrieve data
> from a gl history file on a regular basis with the following selection
> criteria:  employees 1-N,  account numbers 1-N, and a single range of pay
> periods 1-4.
>
> All of the necessary information is contained in the GL-HISTORY file.  The
> file has a data structure like so:
>
>     Record:             GL-HISTORY
>     of File:            GL-HISTORY
>     Organization:       INDEXED
>
> -- Record Contents --
>     Item                                 Type            Size  Occ  Offset
>     EMP-KEY                              CHARACTER         32            0
>     .EMP-NO                              CHARACTER          6            0
>     .PAY-PERIOD-NO                       CHARACTER          6            6
>     .ACCT-NO                             CHARACTER         20           12
>     PAY-AMOUNT                           INTEGER SIGNED     8           44
>
>  ** EMP-KEY is a 32 byte  REPEATING PRIMARY ASCENDING  index **
>
>     Segment                              Type            Size
>     EMP-KEY                              CHARACTER         32
>
>  ** GL-KEY is a 26 byte  REPEATING ALTERNATE ASCENDING  index **
>
>     Segment                              Type            Size
>     ACCT-NO                              CHARACTER         20
>     EMP-NO                               CHARACTER          6
>
> This report will take a long time to run, so it must execute in batch.
> Input of selection criteria will be done from a quick screen, which will
> then create and submit the batch job.
>
> Now if i were to simply do a CHOOSE EMP-KEY PARM thing, the user would be
> forced to enter all of the combinations (permutations?) of the selection
> criteria values, and I believe (my discrete mathmatics is rusty) that this
> could be an exponential amount of data entry, hmmm, or actually something
> like N1 * N2 * 2.  In other words, not acceptable.
>
> The only way I can think of doing this is to create some kind of
> intermediate works files and some nested while loops to load them with all
> of the possible combinations of data values.  Then use the work file to
> link to the gl-history file.
>
> Seems like kind of a lot of work for a simple request.
>
> ideas?
>
> thanks for hangin' in this far
>
> p
>
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
> Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
> powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
> This list is closed, thus to post to the list, you must be a subscriber.



= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.