Adding Lawson Table Process?

 4 Replies
 0 Subscribed to this topic
 18 Subscribed to this forum
Sort:
Author
Messages
Ron McDuffee
New Member
Posts: 3
New Member
We have a custom Interface Program that gets data for 401k payroll deductions.  Our Database is SQL Server.  This program already reads data from tables EMPLOYEE and PAYDEDUCTN.  I need to add a read for the PRDISTRIB table. I have added code to build the filter and perform the PERFORM 850-FILTER-BEGRNG-PRDSET2 command.  The program compiles but the program always returns PRDISTRIB-NOTFOUND as True. I am sure I have not performed a neccesary step or steps. Can anyone point me in the right direction for documantation or provide the steps? 
John Henley
Posts: 3364
New Poster
New Poster
Congrats on posting!
Engaged Reader
Engaged Reader
You are an engaged reader!
Avid Reader
Avid Reader
Avid Reader art thou!
Ron, what code do you have prior to PERFORM 850-FILTER-BEGRNG-PRDSET2 ??

It should look something like this:
MOVE xxx TO DB-COMPANY.
MOVE xxx TO DB-EMPLOYEE.
MOVE PRDSET2-EMPLOYEE TO WS-DB-BEG-RNG.

Also please post the code you are using to create the filter.
Thanks for using the LawsonGuru.com forums!
John
Ron McDuffee
New Member
Posts: 3
New Member
Here is the actual code including the PERFORM:

     MOVE PRM-COMPANY            TO DB-COMPANY.
      MOVE SPACES                 TO FILTER-STRING.
      MOVE WS-PRD-FILTER          TO FILTER-STRING.
      PERFORM 890-CREATE-FILTER.
      MOVE PRM-FROM-DATE          TO FILTER-STRING.
     PERFORM 890-SET-DATETIME-FILTER-VALUE.
     MOVE PRM-FROM-DATE          TO FILTER-STRING.
      PERFORM 890-SET-DATETIME-FILTER-VALUE.
      MOVE "0"                     TO FILTER-STRING.
      PERFORM 890-SET-ALPHANUM-FILTER-VALUE.

      MOVE PRDSET2-COMPANY        TO WS-DB-BEG-RNG.
     PERFORM 850-FILTER-BEGRNG-PRDSET2.

Below is the Filter definition in Working Storage:
     02  WS-PRD-FILTER-GROUP.
         03  FILLER              PIC X(23) VALUE
                               "((PRD-GL-DATE < ?) AND ".
         03  FILLER              PIC X(23) VALUE
                               "(PRD-RUN-DATE < ?) AND ".
         03  FILLER              PIC X(19) VALUE
                               "(PRD-CHECK-ID > ?))".
     02  FILLER REDEFINES WS-PRD-FILTER-GROUP.
         03  WS-PRD-FILTER       PIC X(65).

This should equate to the SQL statement:
SELECT * FROM PRDISTRIB
WHERE PRM-COMPANY = COMPANY
AND GL_DATE < PRM-FROM-DATE
AND RUN_DATE< PRM-FROM-DATE
AND CHECK_ID > 0   (zero)

John Henley
Posts: 3364
New Poster
New Poster
Congrats on posting!
Engaged Reader
Engaged Reader
You are an engaged reader!
Avid Reader
Avid Reader
Avid Reader art thou!
You kept overwriting FILTER-STRING with the values that you want inserted into the string.
Also changed the check-id to a numeric...

See if this works...

MOVE WS-PRD-FILTER TO FILTER-STRING.
PERFORM 890-CREATE-FILTER.

MOVE PRM-FROM-DATE TO DATETIME-FILTER-VALUE.
PERFORM 890-SET-DATETIME-FILTER-VALUE.

MOVE PRM-FROM-DATE TO DATETIME-FILTER-VALUE.
PERFORM 890-SET-DATETIME-FILTER-VALUE.

MOVE 0 TO NUMERIC-FILTER-VALUE.
PERFORM 890-SET-NUMERIC-FILTER-VALUE.

MOVE PRM-COMPANY TO DB-COMPANY.
MOVE PRDSET2-COMPANY TO WS-DB-BEG-RNG.
PERFORM 850-FILTER-BEGRNG-PRDSET2.
Thanks for using the LawsonGuru.com forums!
John
Ron McDuffee
New Member
Posts: 3
New Member
THANK YOU, THANK YOU.  Can't believe I have been looking at that code for so long and missed that.  That solved the connection problem. Thanks again!!!