Function SET185B - Refresh Message List
FUNCTION OPTIONS(*DIRECT *DBOPTIMISE);
********** COMMENT(=======================================================);
********** COMMENT(This function is used to refresh the contents of);
********** COMMENT(a specific session id (S_185SESI) group contained);
********** COMMENT(in file SETOMQ. The data written represents the);
********** COMMENT(current contents of the specified message queue);
********** COMMENT(=======================================================);
EXCHANGE FIELDS(#S_185SESI) OPTION(*ALWAYS);
********** COMMENT(-----------------);
********** COMMENT(Local definitions);
********** COMMENT(-----------------);
GROUP_BY NAME(#S_185ROW) FIELDS((#S_185SESI)(#S_185MSGN)(#S_185QUE)(#S_185KEY)(#S_185LVL1)(#S_185MSGI)(#S_185SEV)(#S_185SEND)(#S_185RTNT));
********** COMMENT(---------------------------------------);
********** COMMENT(Assign a session identifier if required);
********** COMMENT(---------------------------------------);
IF_NULL FIELD(#S_185SESI);
CHANGE FIELD(#S_185SESI) TO(*AUTONUM15S_185SESI);
ENDIF;
********** COMMENT(--------------------------------------);
********** COMMENT(Delete all records for this session id);
********** COMMENT(--------------------------------------);
DELETE FROM_FILE(SETOMQ) WITH_KEY(#S_185SESI);
********** COMMENT(----------------------------------);
********** COMMENT(Now copy all message into the file);
********** COMMENT(-----------------------------------);
CHANGE FIELD(#S_185FON) TO(F);
CHANGE FIELD(#S_185MSGN) TO(0);
CALL PGM(SETGETMSGQ) PARM(#S_185QUE #S_185FON #S_185KEY #S_185LVL1 #S_185MSGI #S_185SEV #S_185SEND #S_185RTNT) NUM_LEN(*DEFINED);
DOWHILE COND('#S_185RTNT *NE *BLANKS');
CHANGE FIELD(#S_185MSGN) TO('#S_185MSGN + 1');
INSERT FIELDS(#S_185ROW) TO_FILE(SETOMQ);
CHANGE FIELD(#S_185FON) TO(N);
CALL PGM(SETGETMSGQ) PARM(#S_185QUE #S_185FON #S_185KEY #S_185LVL1 #S_185MSGI #S_185SEV #S_185SEND #S_185RTNT) NUM_LEN(*DEFINED);
ENDWHILE;
********** COMMENT(--------);
********** COMMENT(Finished);
********** COMMENT(--------);
RETURN;
FUNCTION OPTIONS(*DIRECT *DBOPTIMISE);
********** COMMENT(=======================================================);
********** COMMENT(This function is used to refresh the contents of);
********** COMMENT(a specific session id (S_185SESI) group contained);
********** COMMENT(in file SETOMQ. The data written represents the);
********** COMMENT(current contents of the specified message queue);
********** COMMENT(=======================================================);
EXCHANGE FIELDS(#S_185SESI) OPTION(*ALWAYS);
********** COMMENT(-----------------);
********** COMMENT(Local definitions);
********** COMMENT(-----------------);
GROUP_BY NAME(#S_185ROW) FIELDS((#S_185SESI)(#S_185MSGN)(#S_185QUE)(#S_185KEY)(#S_185LVL1)(#S_185MSGI)(#S_185SEV)(#S_185SEND)(#S_185RTNT));
********** COMMENT(---------------------------------------);
********** COMMENT(Assign a session identifier if required);
********** COMMENT(---------------------------------------);
IF_NULL FIELD(#S_185SESI);
CHANGE FIELD(#S_185SESI) TO(*AUTONUM15S_185SESI);
ENDIF;
********** COMMENT(--------------------------------------);
********** COMMENT(Delete all records for this session id);
********** COMMENT(--------------------------------------);
DELETE FROM_FILE(SETOMQ) WITH_KEY(#S_185SESI);
********** COMMENT(----------------------------------);
********** COMMENT(Now copy all message into the file);
********** COMMENT(-----------------------------------);
CHANGE FIELD(#S_185FON) TO(F);
CHANGE FIELD(#S_185MSGN) TO(0);
CALL PGM(SETGETMSGQ) PARM(#S_185QUE #S_185FON #S_185KEY #S_185LVL1 #S_185MSGI #S_185SEV #S_185SEND #S_185RTNT) NUM_LEN(*DEFINED);
DOWHILE COND('#S_185RTNT *NE *BLANKS');
CHANGE FIELD(#S_185MSGN) TO('#S_185MSGN + 1');
INSERT FIELDS(#S_185ROW) TO_FILE(SETOMQ);
CHANGE FIELD(#S_185FON) TO(N);
CALL PGM(SETGETMSGQ) PARM(#S_185QUE #S_185FON #S_185KEY #S_185LVL1 #S_185MSGI #S_185SEV #S_185SEND #S_185RTNT) NUM_LEN(*DEFINED);
ENDWHILE;
********** COMMENT(--------);
********** COMMENT(Finished);
********** COMMENT(--------);
RETURN;