AS/400 iSeries Submitted Job/Batch Record Lock issue

605 pts.
Tags:
AS/400 jobs
Record lock
I have looked at the other record lock questions/answers on this board but have been unable to find an answer to this problem. I am trying to capture a record lock error in a submitted program. The program is coded to capture the File Status as shown below. I have tested this same record locking capture code in an interactive program and it works with no problems. But for some reason the submitted program doesn't not work the same way.
FSRBNAM    UF   E           K DISK    infds(SRWNAM) 
D SRWNAM          DS        
D  Status           *Status 
C                   DOU       Status <> 1218                         
C                   EVAL      EVENT = 1                              
C                   EVAL      FMCUST = '000016'                      
C*                                                                   
C* Read the Customer Master Record                                   
C     FMCUST        CHAIN(E)  SRBNAM                             99  
C*                                                                   
C* Check the File Status, if record was locked, execute subroutine   
C*                  IF        %Status(SRBNAM) = 1218                 
C* Execute Subroutine to handle record lock                          
C                   EXSR      SR90                                   
C*                  ENDIF                                            
C*                                                                   
C                   ENDDO                                            
My problem is that the subroutine SR90 is not being executed, although I have verified that the Customer Record for 000016 is locked by another program. When this program is actively running in batch I've looked at the job log and see these entries:
>> CALL PGM(A3DEVSRA/RCDLCKTST2)                     
   Record 26603 in use by job 245024/KLM/QPADEV0149. 
 ? C                                                 
   Record 26603 in use by job 245024/KLM/QPADEV0149. 
 ? C  
No one is manually answering the message, I've looked at the system reply list and don't see a "1218" auto message reply entry. When I cancel the batch job and look at the job log I see these entries:
00   11/26/08  09:15:43.725168  QWTPCRJA     QSYS        010F     *EXT       
  Message . . . . :   Job 246458/KLM/RECORDLOCK submitted.                   
     11/26/08  09:15:43.725624  QWTSCSBJ                 *N       QCMD       
  Message . . . . :  -CALL PGM(A3DEVSRA/RCDLCKTST2)                          
30   11/26/08  09:16:46.741920  QDBSIGEX     QSYS        01EA     QDBSIGEX   
  Message . . . . :   Record 26603 in use by job 245024/KLM/QPADEV0149.    
30   11/26/08  09:16:46.741936  QDBSIGEX     QSYS        01EA     RCDLCKTST2 
  To module . . . . . . . . . :   RCDLCKTST2                                 
  To procedure  . . . . . . . :   RCDLCKTST2                                 
  Statement . . . . . . . . . :   141                                        
  Message . . . . :   Record 26603 in use by job 245024/KLM/QPADEV0149.      
     11/26/08  09:16:46.742104  QMHCHGEM     QSYS        0146     RCDLCKTST2 
  To module . . . . . . . . . :   RCDLCKTST2                                 
  To procedure  . . . . . . . :   RCDLCKTST2                                 
  Statement . . . . . . . . . :   141                                        
  Message . . . . :   C                                                      
     11/26/08  09:16:46.742112  QMHCHGEM     QSYS        0146     QDBSIGEX   
  Message . . . . :   C                                                      
What do I need to change to get my submitted program running in batch to capture the record lock status and allow the subroutine to handle the situation. Kevin

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi,

I suggest you take a look at the job attributes – check what the “Inquiry message reply” is set to. Use DSPJOB/WRKJOB option 2, 2nd page.

When the job is submitted it can have the value *JOBD/*RQD/*DFT/*SYSRPYL

Regards,

Martin Gilbert.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • kevleemor
    I looked at the Job Definition Attributes of the submitted job, it is set to *RQD.
    Job:   RECORDLOCK     User:   KLM            Number:   246458   
                                                                    
    Default output queue  . . . . . . . . . . . . . . :   QPRINT    
      Library . . . . . . . . . . . . . . . . . . . . :     QGPL    
    Job date  . . . . . . . . . . . . . . . . . . . . :             
    Date format . . . . . . . . . . . . . . . . . . . :   *MDY      
    Date separator  . . . . . . . . . . . . . . . . . :   /         
    Time separator  . . . . . . . . . . . . . . . . . :   :         
    Time zone . . . . . . . . . . . . . . . . . . . . :   QN0500EST3
    Decimal format  . . . . . . . . . . . . . . . . . :   *BLANK    
    Job switches  . . . . . . . . . . . . . . . . . . :             
    Inquiry message reply . . . . . . . . . . . . . . :   *RQD      
    
    605 pointsBadges:
    report
  • Gilly400
    Hi Kevin, The job is set to *RQD and it still auto replies to the locked record messages in the joblog? Which column is your indicator 99 in for your CHAIN opcode? Regards, Martin Gilbert.
    23,730 pointsBadges:
    report
  • kevleemor
    Hi Gil, it is in the HI position to check if the record is not found. Kevin
    605 pointsBadges:
    report
  • Sloopy
    I tested your code on my system, using the following two programs (file changed to suit our database) : TSTLCK1 program....
    FCUSTL1    UF   E           K DISK    infds(SRWNAM)
    D SRWNAM          DS                               
    D  Status           *Status                        
                                                       
    D Response        S              1    Inz('A')     
                                                       
    C     K_CS          KLIST                          
    C                   KFLD                    CSSTAT 
    C                   KFLD                    CSCUST 
                                                       
    C                   EVAL      CSSTAT = 0           
    C                   EVAL      CSCUST = 'GBSIMON1'  
                                                       
    C                   DOU       Status <> 1218       
                                                       
    C* Read the Customer Master Record                 
    C     K_CS          CHAIN(E)  CS                                 99
                                                                       
    C* Check the File Status, if record was locked, execute subroutine 
    C                   IF        %Status(CUSTL1) = 1218               
    C     Status        DSPLY     'BLECMD'      Response               
    C                   ENDIF                                          
                                                                       
    C                   ENDDO                                          
                                                                       
    C                   EVAL      *INLR = *ON                          
    
    TSTLCK2 program....
    FCUSTL1    UF   E           K DISK    infds(SRWNAM)                
    D SRWNAM          DS                                               
    D  Status           *Status                                        
                                                                       
    D Response        S              1    Inz('A')                     
                                                                       
    C     K_CS          KLIST                                          
    C                   KFLD                    CSSTAT                 
    C                   KFLD                    CSCUST                 
                                                                       
    C                   EVAL      CSSTAT = 0                           
    C                   EVAL      CSCUST = 'GBSIMON1'                  
                                                                       
    C* Read the Customer Master Record                                 
                                                                       
    C     K_CS          CHAIN(E)  CS                                 99
                                                                       
    C     Status        DSPLY                   Response               
                                                                       
    C                   EVAL      *INLR = *ON  
    
    Running TSTLCK2 interactively holds the record lock until a reply is entered. Sending TSTLCK1 to run in batch results in a wait on the locked record (1 minute), then the DSPLY operation sends its message to my message queue requiring a response. In the batch job, Inquiry Message Reply is *RQD. So; I can't see any reason why your code should not work in batch. Try using the DSPLY or DUMP operations to see the contents of the STATUS variable; and make sure that there really IS a lock on the record you expect. Regards, Sloopy
    2,195 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following