Batch Processing API's

 6 Replies
 0 Subscribed to this topic
 11 Subscribed to this forum
Sort:
Author
Messages
wwaters
Basic Member
Posts: 11
Basic Member
    Has anyone used the Lawson Batch Processing API's? I am trying to use U@LOADJOB and U@CRTJOB to update my PO120 job definition. The program retrieves the current job definition via U@LOADJOB, changes the PO# field to the PO that I am working with, and then issues U@CRTJOB to update the PO120 definition. The program runs, but the job definition is not being updated. I am not seeing an error message anywhere indicating what went wrong. Please help!!
    John Henley
    Posts: 3353
      Posted By wwaters on 07/27/2011 11:28 AM
       changes the PO# field to the PO that I am working with

      Look again at your logic...I'm assuming you are copying the parameters block into a local variable, and then updating the PO#...but are you copying back the update local variable back to the parameters block before you call CRTJOB?
      Thanks for using the LawsonGuru.com forums!
      John
      wwaters
      Basic Member
      Posts: 11
      Basic Member
        John - Yes, my program will copy the parameters block into a local data structure, update the PO#, and then copy the local data structure  back to the parameters block.  The problem is that my program doesn't make it that far.  It appears that my program bombs when calling the U@LOADJOB procedure.  Here is a copy of the beginning of my code:

        /Free                                
                                             
             E@JRUSERNAME = USERNAME;        
             E@JRJOBNNAME = JOBNAME;         
                                             
             U@LOADJOB();                    
               IF E@JRERROR = 'N';           
                 MYDATAFLD1 = E@JRUSERNAME;  
                 MYDATAFLD2 = E@JRJOBNNAME;  
                 MYDATAFLD3 = PONUMBER;      
                 WRITE MYDATAFMT;           

        The reason that I believe the U@LOADJOB is not working is because MYDATAFMT never gets written.  Even if I write E@JRERROR to MYDATAFLD1 just after the U@LOADJOB statement, MYDATAFMT still does not get written.  Something is wrong with the U@LOADJOB statement but I don't know what.

        Thank you for your assistance!
        John Henley
        Posts: 3353
          I'm not sure about your example, but where is PONUMBER defined?
          When you call the LOADJOB, it will load the job parameters into E@JSPARAMS
          Have you looked at E@JSPARAMS(1) ?

          Thanks for using the LawsonGuru.com forums!
          John
          wwaters
          Basic Member
          Posts: 11
          Basic Member
            Hi John,

            First, thank you for your responses.  I appreciate your willingness to help.

            USERNAME, JOBNAME, and PONUMBER are all parameters that are being passed into this program.  E@JSPARAMS(1) is blank.  I don't think the job parameters are being loaded because of an error on the U@LOADJOB.  Maybe I'm missing a /COPY statement needed for the U@LOADJOB to work??  Do you have the source for a working program that you would not mind sharing?
            wwaters
            Basic Member
            Posts: 11
            Basic Member
              I finally found an error message.  When I submit the job vs calling it from the command line I get the following message:

              Unable to establish a database connection. Encountered error: Unable to attach the ladb shared memory segment. You should verify that the ladb process is running.

              Has anyone else ran across this message and, if so, what steps were taken to correct it?
              wwaters
              Basic Member
              Posts: 11
              Basic Member
                Got it working.  Had to include the following in my code:

                /Free                                                             
                                                                                  
                 // Set Control fields in E@CONTROL.                              
                     E@CONTROL@P  = %ADDR(E@ENTRY@CNTRL);                         
                 // Set the Product Line or Data Area to be updated.              
                     E@PRODUCTLINE = 'XXXXXXX       ';                            
                 // Set the User Name to be used for the update                   
                     E@USERNAME = 'XXXXXXXXX                     ';               
                 // This call sets up required values for database access.  It is
                 // required for both an online or a batch run of this program.   
                     U@@INITONLINE(%ADDR(E@CONTROL));                            


                BTW, I did not see this in the documentation anywhere!