RPGIV @ Work

A unique site for RPG and System i Lovers

Welcome!

Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

Record Locks Print E-mail
User Rating: / 0
PoorBest 
Written by Chamara Withanachchi   
 

Skip past locked records. If you are processing records in a primary file and you want to just skip any records that get input errors, you can code an INFSR subroutine for the file. On the ENDSR of the subroutine, code '*GETIN'. That will cause control to go to the part of the cycle that gets the next record.

Fmyfile    ip   e             disk    infsr(myinfsr)
		C     myinfsr       begsr
		C                   ... file error
		C                   endsr     '*GETIN'

If you also want to ignore program errors encountered when processing the data in a record, code a *PSSR subroutine the same way. If you don't have any file-specific processing in your INFSR subroutine, you can use the *PSSR as the INFSR.

Fmyfile    ip   e             disk    infsr(*pssr)
		C     *pssr         begsr
		C      &n            ... general error
		C        bsp;;           endsr     '*GETIN'

If you don't always want to just go straight to the next record, you can soft-code the return point on the ENDSR.

Fmyfile    ip   e             disk    infsr(myinfsr)
		D infsrEnd        s              6a
		D recordLock      c                   1218
		C     myinfsr       begsr
		C                   eval      infsrEnd = '*CANCL'
		C                   if        %status(myfile) = recordLock
		C                   eval      infsrEnd = '*GETIN'
		C                   endif
		C                   endsr     infsrEnd
<Previous   Next>