I have an issue with using HISTORY_LOG_INFO from imbedded SQL. I consistently get from the pre-compiler:
Position 34 Variable RSET not defined or not usable.
Reason: A member of the host structure does not have an
equivalent SQL data type.
In the following code:
DDoIt S 256 Inz('select * -
D from table(-
D qsys2/history_log_info() ) -
D where message_id in (-
D ''CPF1124'', ''CPF1164'')')
D RSet DS Qualified
D Ordinal_...
D Position 10i 0 Integer
D Message_...
D Id 7 Varying VarChar(7)
D Message_...
D Type 13 Varying VarChar(13)
D Message_...
D SubType 22 Varying VarChar(22)
D Severity 5i 0 SmallInt
D Message_...
D TimeStamp Z TimeStamp
D From_User 10 Varying VarChar(10)
D From_Job 28 Varying VarChar(28)
D From_Program 10 Varying VarChar(10)
D Message_...
D Library 10 Varying VarChar(10)
D Message_...
D File 10 Varying VarChar(10)
D Message_...
D Tokens 4096C Varying VarChar(4096) for bit
D Message_...
D Text 1024G Varying VarGraphic(1024)
D Message_Second_Level_...
D Text 4096G Varying VarGraphic(4096)
D Syslog_event 2048G Varying VarGraphic(2048)
D SysLog_...
D Facility 10I 0 Integer
D SysLog_...
D Severity 10I 0 Integer
D SysLog_...
D Priority 10i 0 Integer
Exec SQL Prepare SqlStmt from doIt ;
If SqlCode <> 0;
DsplText = 'SQL Prepare Error';
Dsply dsplText '' Answer;
*InLR = *On;
Return;
EndIf;
Exec SQL Declare C1 Cursor for SqlStmt;
Exec SQL Open C1;
If SqlCode <> 0;
DsplText = 'SQL Open Error';
Dsply dsplText '' Answer;
*InLR = *On;
Return;
EndIf;
DoU SqlCode <> 0 or @End;
Exec SQL Fetch C1 into :RSet;
If SqlCode = 0;
It is a pity that the above code didn't get formatted to be more readable...
RSet definition is from IBM: https://www.ibm.com/docs/en/i/7.2?to...table-function
Any comments/suggestions would be greatly appreciated.
Position 34 Variable RSET not defined or not usable.
Reason: A member of the host structure does not have an
equivalent SQL data type.
In the following code:
DDoIt S 256 Inz('select * -
D from table(-
D qsys2/history_log_info() ) -
D where message_id in (-
D ''CPF1124'', ''CPF1164'')')
D RSet DS Qualified
D Ordinal_...
D Position 10i 0 Integer
D Message_...
D Id 7 Varying VarChar(7)
D Message_...
D Type 13 Varying VarChar(13)
D Message_...
D SubType 22 Varying VarChar(22)
D Severity 5i 0 SmallInt
D Message_...
D TimeStamp Z TimeStamp
D From_User 10 Varying VarChar(10)
D From_Job 28 Varying VarChar(28)
D From_Program 10 Varying VarChar(10)
D Message_...
D Library 10 Varying VarChar(10)
D Message_...
D File 10 Varying VarChar(10)
D Message_...
D Tokens 4096C Varying VarChar(4096) for bit
D Message_...
D Text 1024G Varying VarGraphic(1024)
D Message_Second_Level_...
D Text 4096G Varying VarGraphic(4096)
D Syslog_event 2048G Varying VarGraphic(2048)
D SysLog_...
D Facility 10I 0 Integer
D SysLog_...
D Severity 10I 0 Integer
D SysLog_...
D Priority 10i 0 Integer
Exec SQL Prepare SqlStmt from doIt ;
If SqlCode <> 0;
DsplText = 'SQL Prepare Error';
Dsply dsplText '' Answer;
*InLR = *On;
Return;
EndIf;
Exec SQL Declare C1 Cursor for SqlStmt;
Exec SQL Open C1;
If SqlCode <> 0;
DsplText = 'SQL Open Error';
Dsply dsplText '' Answer;
*InLR = *On;
Return;
EndIf;
DoU SqlCode <> 0 or @End;
Exec SQL Fetch C1 into :RSet;
If SqlCode = 0;
It is a pity that the above code didn't get formatted to be more readable...
RSet definition is from IBM: https://www.ibm.com/docs/en/i/7.2?to...table-function
Any comments/suggestions would be greatly appreciated.