580 pts.
0
Q:
AS/400 iSeries Submitted Job/Batch Record Lock issue
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
ASKED: Nov 26 2008  2:50 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
23625 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button

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.
Last Answered: Nov 26 2008  3:03 PM GMT by Gilly400   23625 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Kevleemor   580 pts.  |   Nov 26 2008  3:16PM GMT

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

 

Gilly400   23625 pts.  |   Nov 26 2008  4:53PM GMT

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.

 

Kevleemor   580 pts.  |   Nov 26 2008  9:46PM GMT

Hi Gil, it is in the HI position to check if the record is not found.

Kevin

 

Sloopy   1930 pts.  |   Nov 28 2008  10:12AM GMT

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

 
0