Title: Comment Attachment Processing
Description: Copying from One comment type to another
podavennai - November 6, 2006 07:53 PM (GMT)
I need to have comment automatically copied from one type to another when a record is released . Can you seggest me some way to do it ?
I tried with Lawson APIs but could not get it to work
Milo - November 7, 2006 02:44 PM (GMT)
What is your code? Post a snippet here and I can check the API manual to see if it conforms. Working with API's is sometimes a little tricky.
Also - in order that the correct API manual is consulted - What level apps are you working with?
schroncd - November 7, 2006 03:59 PM (GMT)
Although I STRONGLY recommend utilizing the Lawson APIs, if you can't find one to accomplish this task for you it might be a good place to implement a database trigger. But I'd suggest an exhaustive search of the APIs first... No doubt Milo can help you there - he's MUCH better with the Lawson code than I ever hope to be.
podavennai - November 7, 2006 08:10 PM (GMT)
Milo ,
Here is the code snippet
IF (KP12FC = "R")
PERFORM 451-CPY-CMT
THRU 451-END
END-IF
******************************************************************
451-CPY-CMT.
******************************************************************
MOVE "R" TO CMTRQH-TYPE.
MOVE SPACES TO CMTRQH-NAME.
PERFORM 900-FIND-BEGRNG-CMT-REQHEADER.
PERFORM
UNTIL (CMTRQH-NOTFOUND)
MOVE CMTRQH-NAME TO WS-RQH-CMTNAME
MOVE CMTRQH-EXT-TEXT-SZ
TO WS-RQH-EXT-TEXT-SZ
SET CMTRQH-NO-SOFT-RTN TO TRUE
PERFORM 900-GET-TEXT-CMT-REQHEADER
MOVE CMTRQH-EXTRACT-TEXT
TO WS-RQH-EXTRACT-TEXT
MOVE SPACES TO CMTRQH-EXT-TEXT
PERFORM 900-GET-TEXT-CMT-REQHEADER
PERFORM
UNTIL (CMTRQH-EOT)
MOVE CMTRQH-EXTRACT-TEXT
TO WS-RQH-TEMPCT (I1)
MOVE SPACES TO CMTRQH-EXT-TEXT
PERFORM 900-GET-TEXT-CMT-REQHEADER
ADD 1 TO I1
END-PERFORM
PERFORM 900-CREATE-CMT-REQHEADER
MOVE "P" TO CMTRQH-TYPE
MOVE WS-RQH-CMTNAME TO CMTRQH-NAME
MOVE WS-RQH-EXT-TEXT-SZ
TO CMTRQH-EXT-TEXT-SZ
MOVE WS-RQH-EXTRACT-TEXT TO
CMTRQH-EXTRACT-TEXT
PERFORM 900-STORE-CMT-REQHEADER
PERFORM
VARYING I2 FROM 1 BY 1
UNTIL (I2 > I1)
MOVE CMTRQH-EXTRACT-TEXT
TO CMTRQH-EXT-TEXT
PERFORM 900-APPEND-CMT-REQHEADER
MOVE SPACES TO CMTRQH-EXT-TEXT
END-PERFORM
MOVE "R" TO CMTRQH-TYPE
MOVE SPACES TO CMTRQH-NAME
PERFORM 900-FIND-NXTRNG-CMT-REQHEADER
END-PERFORM.
451-END.
Thanks in advance
podavennai - November 8, 2006 01:45 PM (GMT)
Milo - November 10, 2006 03:22 PM (GMT)
Ragu:
I apologize, I'm not in a position to test your code. I downloaded it, restored correct indenting, printed it out, and pored over it while comparing it to the API manual.
I noticed this: The 8.0.3 API manual shows Comment Variables on pages 139 and 140. Then on page 141 look at the example for 900-GET-TEXT-CMT-FileName. There's a variable there, CMTCOM-FIRST-CMT-LINE, that does not appear in the Comment Variables list, yet it seems to be an important part of the comment processing system! Your code does not have this, and it may be critical. This is typical of Lawson documentation, especially with newer APIs -- they often don't get the documentation completely right the first time.
My suggestion to you is two-fold. First, do a qcompile with -l and check the comment variables in the completely-built COBOL source code. You may find more undocumented Comment Variables than just -FIRST-CMT-LINE. Secondly, either use DEBUG or drop in DISPLAY statements to see what's going on as the program steps through module 451-CPY-CMT. That will help you trace what's happening and where the problem occurs.
Good luck!
podavennai - November 10, 2006 04:22 PM (GMT)
podavennai - November 17, 2006 04:29 PM (GMT)
We were able to get it to work.
Primary index for REQHEADER is rqhset7
but i was using rqhset1
and there were some minor changes
Thanks for the help
Milo - November 20, 2006 02:26 PM (GMT)
I'm sorry, I don't see RQHSET1 anywhere in the source code you posted. Is what you're saying this: That the code you posted works, but you were pointing to the wrong record? (It bugs the $#!% out of me not to understand what's going on.)