SUBROUTINE NAME(PRT_ERROR)
DEFINE FIELD(#ERRTXT) TYPE(*CHAR) LENGTH(100) LABEL(‘Error :’)
DEFINE FIELD(#RETCODE) TYPE(*CHAR) LENGTH(2)
DEF_LINE NAME(#ERROR) FIELDS((#ERRTXT)) IDENTIFY(*LABEL)
USE BUILTIN(GET_MESSAGE) TO_GET(#RETCODE #ERRTXT)
DOWHILE COND(‘#RETCODE *EQ OK’)
PRINT LINE(#ERROR)
USE BUILTIN(GET_MESSAGE) TO_GET(#RETCODE #ERRTXT)
ENDWHILE
ENDROUTINE