时间戳错误
Timestamp Error
因此,到目前为止在我们的 Production iSeries 中 运行 正常的程序之一出现错误。
Statement in Error . . . . . . . . . . : 00051900
RPG Routine . . . . . . . . . . . . . : REPROMIS
Number of Parameters . . . . . . . . . : 005
Message Type . . . . . . . . . . . . . : RNX
Additional Message Info . . . . . . . : 0114
Message Data . . . . . . . . . . . . . :
The year portion of a Date or Timestamp value is not in the correct range.
以上是错误。所以我知道错误的语句是 519 也就是这个
RepromiseMode();
所以这只是在 iSeries 程序中调用的一个过程。正如我在之前的一篇文章中提到的,我仍在学习如何读取假脱机文件。我浏览了作业日志,下面是我认为可能相关的内容:
Message . . . . : Data mapping error on member FG205L01.
Cause . . . . . : A data mapping error occurred on field
Max(FG205F_1.QSRDTE) in record number 0, record format *FIRST, member number
1, in member FG205L01 file FG205L01 in library FILES, because of error code
18. The error code meanings follow: 1 -- There is data in a decimal field
that is not valid. 2 -- A significant digit was truncated. 3 -- A floating
point value exceeded the maximum representable value. 4 -- A floating point
value was less than the minimum representable value. 5 -- A binary floating
正如上面的消息所说,错误代码 18 是:
18 -- 日期、时间或时间戳字段中的数据无效。
现在对如何前进有点迷茫。这只是数据问题还是需要更改代码的程序相关问题?
下面是我放置假脱机文件的保管箱 link。
https://www.dropbox.com/s/1jbgqvqn9zaac8g/PD001R_Error.txt?dl=0
任何关于如何前进的指导都会有所帮助
**
Update - 1
**
就我目前所做的研究而言,我需要专注于以下程序
P RepromiseMode B
// ...... Define the procedure interface
D RepromiseMode PI
/Free
//- Spin the whole file
CallP PW012R('INFO':'PD001R0055':ModuleName:' ':
' ':' ':' ':'0':' ':P_COMOrd:P_ItmSeq:
' ':' ':' ':' ':' ');
If P_COMOrd = *Blanks;
Setll (*Loval) PD002F;
Read PD002F;
Else;
If P_ItmSeq = *Zeros;
Setll (1:'1':P_COMOrd) PD002F;
Reade (1:'1':P_COMOrd) PD002F;
Else;
Setll (1:'1':P_COMOrd:%Dec(P_ItmSeq:7:0)) PD002F;
Reade (1:'1':P_COMOrd:%Dec(P_ItmSeq:7:0)) PD002F;
EndIf;
EndIf;
Dow Not %Eof(PD002F);
wOrdCmp = E_A2AENB;
wOrdTyp = E_A2DCCD;
wOrdNbr = E_A2CVNB;
wItmSeq = E_A2FCNB;
wModel = E_A2MODL;
hldInvDt = E_A2INVD;
hldBldDt = E_A2BLDA;
hldQuaDt = LowDate;
hldTrnDt = LowDate;
hldShpDt = LowDate;
hldPrmDt = LowDate;
MoreDates = *Off;
GAC03 NextRecord = *Off;
GAC11 //- Check if it is the correct repromise
GAC11 CorrectOrd = *Off;
GAC11 Exec Sql
GAC11 Select '1' into :CorrectOrd
GAC11 From mbc6res0
GAC11 Inner Join pd001f On a1ordy=c6uucc And a1adr0=c6uuca
GAC11 where c6aenb=:wOrdCmp And c6dccd=:wOrdTyp
GAC11 And c6cvnb=:wOrdNbr And a1dvnm=:ModuleName;
GAC11 If SqlCode > 100;
GAC11 // Actually nothing yet if error then it will not run past here
GAC11 EndIf;
GAC11 //- If the record is for this repromise continue
GAC11 If CorrectOrd;
//- Conitune if the PD002F is written
GetInvDate();
If PD002Good;
Chain (wOrdCmp:wOrdTyp:wOrdNbr:wItmSeq) FG263L02;
If %Found(FG263L02);
Chain (K_FGVIN#) FG203F;
If %Found(FG203F);
If hldBldDt > *Loval;
wInventoryDt = hldBldDt;
Else;
wInventoryDt = %Date();
EndIf;
//- Shippable is Yes
If V_SHIP = 'Y';
wFinGood = 'Y';
wSalFmy = V_SFMLY;
wPline = V_PLINE;
wHouse = V_CHOUSE;
ProcRePromise();
GetPD002F();
//- Shippable is NO
Else;
CallP PW012R('INFO':'PD001R0090':ModuleName:V_CHOUSE:
V_VIN:V_MODEL:' ':%Char(V_ORDCMP):V_ORDTYP:
V_ORDNBR:'0':' ':' ':' ':' ':' ');
LoopDone = *On;
wFinGood = 'Y';
wSalFmy = V_SFMLY;
wPline = V_PLINE;
wHouse = V_CHOUSE;
ProcRepromise();
GetPD002F();
EndIf;
GAC03 //- Some how there is a valid vin in FG263F but not FG203F then...
GAC03 Else;
GAC04 CallP PW012R('INFO':'PD001R0210':ModuleName:' ':
GAC04 K_FGVIN#:' ':' ':%Char(wOrdCmp):wOrdTyp:
GAC04 wOrdNbr:%Char(wItmSeq):' ':' ':' ':' ':' ');
GAC03 SendEmail = *On;
GAC04 GetPD009F();
EndIf;
//- No VIN was found
Else;
Chain (wOrdCmp:wOrdtyp:wOrdNbr:wItmSeq) PW019L01;
If %Found(PW019L01);
//- Found in PW019F and it is a Finshed Good VIN
If N_B0FASG = 'Y';
//- End the process the order has not been assigned in the warehouse
// yet, but there is a label waiting for assignment all is good.
CallP PW012R('INFO':'PD001R0185':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):' ':' ':' ':' ':' ');
Else;
//- Looks for a slot record
Chain (wOrdCmp:wOrdtyp:wOrdNbr:wItmSeq) PW014F;
If %Found(PW014F);
hldBldDt = P_B5PDAT;
MoreDates = *On;
//- No slot record look for a MO order
Else;
Chain (wOrdCmp:wOrdtyp:wOrdNbr:wItmSeq) MOMASTLG;
If %Found(MOMASTLG);
hldBldDt = %Date(M_ODDTMY:*CYMD);
MoreDates = *On;
//- No MO record send an error email
Else;
CallP PW012R('INFO':'PD001R0170':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):' ':' ':' ':' ':' ');
SendEmail = *On;
GAC04 GetPD009F();
EndIf;
EndIf;
EndIf;
//- Error because not in PW019F
Else;
CallP PW012R('INFO':'PD001R0175':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):' ':' ':' ':' ':' ');
SendEmail = *On;
GAC04 GetPD009F();
EndIf;
//- If there needs to be more dates calculate
If MoreDates;
GetSalesFamly();
P_NumDays = *Zeros;
wModel = E_A2MODL;
CallP PD005R(wSalFmy:' ':wModel:P_NumDays);
DecNumDays = %Dec(P_NumDays:4:0);
If DecNumDays = *Hival;
CallP PW012R('INFO':'PD001RE025':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):'PD005R came back with 9999 days':
' ':' ':' ':' ');
SendEmail = *On;
NextRecord = *On;
GetPD009F();
Else;
Chain (1:'1':wOrdNbr:wItmSeq) MBCDRES0;
If %Found(MBCDRES0);
wHouse = B_CDA3CD;
Chain (1:'1':wOrdNbr:wItmSeq) MOMASTLG;
If %Found(MOMASTLG);
Chain (M_FIWHMY) WHSMST;
If %Found(WHSMST);
//- Move forward number of days agains work cacendar
CYMDDate = %Dec(%Char(hldBldDt:*CYMD0):7:0);
Setll (W_CALP:CYMDDate) CALNDRL0;
For j = 0 to DecNumDays;
Reade (W_CALP) CALNDRL0;
CYMDDate = CDTECA;
EndFor;
EndIf;
//- Now update the Quality Date
hldBldDt = %Date(CYMDDate:*CYMD);
wInventoryDt = hldBldDt;
CallP PW012R('INFO':'PD001R0125':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):' ':' ':' ':' ':' ');
GetPD002F();
EndIf;
GAC05 Else;
GAC05 // DO not send email on this because the file is empty
GAC05 CallP PW012R('INFO':'PD001R0230':ModuleName:wHouse:
GAC05 ' ':' ':' ':'0':' ':wOrdNbr:%Char(wItmSeq):
GAC05 ' ':' ':' ':' ':' ');
GAC05 NextRecord = *On;
EndIf;
//- Get all the dates needed
wFinGood = 'N';
If Not NextRecord;
QualityDate();
CallP PW012R('INFO':'PD001R0140':ModuleName:' ':' ':wModel:
' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:%Char(wItmSeq):
' ':' ':' ':' ':' ');
EndIf;
If Not NextRecord;
TransferDate();
CallP PW012R('INFO':'PD001R0122':ModuleName:' ':' ':wModel:
' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:%Char(wItmSeq):
' ':' ':' ':' ':' ');
EndIf;
If Not NextRecord;
ShipWedgeDate();
CallP PW012R('INFO':'PD001R0123':ModuleName:' ':' ':wModel:
' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:%Char(wItmSeq):
' ':' ':' ':' ':' ');
GetPD002F();
EndIf;
EndIf;
EndIf;
EndIf;
EndIf;
GAC11 EndIf;
If P_COMOrd = *Blanks;
Read PD002F;
Else;
If P_ItmSeq = *Zeros;
Reade (1:'1':P_COMOrd) PD002F;
Else;
Reade (1:'1':P_COMOrd:%Dec(P_ItmSeq:7:0)) PD002F;
EndIf;
EndIf;
EndDo;
/End-Free
P RepromiseMode E
我目前正在对此进行调试,但到目前为止它还没有崩溃,无法查明哪个 日期 assignment/date 相关操作 导致了问题。
UPDATE - 2
在上面的过程中,正在读取一个文件PD002F。要查看具有日期数据类型的所有字段的日期值,我尝试使用客户端访问中的“导出”选项将此文件提取到 Excel,但随后引发了相同的错误:
CWBDB0099 - No more data is available for the stream fetch request
SQL0181 - Value in date, time, or timestamp string not valid.
Cause . . . . . : The string representation of a date, time or timestamp value is not in the acceptable range. *N is either the character string constant that is not valid or the column or host variable that contained the string.
那么是文件损坏了还是怎么的?
UPDATE -3
我尝试通过客户端访问使用 RRN < 2 仅提取一条记录,但效果很好!但是当我给 RRN < 3 时,抛出了同样的错误。这进一步加强了我的怀疑,即此问题仅针对特定记录出现。
Update 4
这是转储中的违规数据,以及相关的日期操作:
hldInvDt = E_A2INVD;
hldBldDt = E_A2BLDA;
hldQuaDt = LowDate;
hldTrnDt = LowDate;
hldShpDt = LowDate;
hldPrmDt = LowDate;
wInventoryDt = hldBldDt;
wInventoryDt = %Date();
hldBldDt = P_B5PDAT;
hldBldDt = %Date(M_ODDTMY:*CYMD);
CYMDDate = %Dec(%Char(hldBldDt:*CYMD0):7:0);
hldBldDt = %Date(M_ODDTMY:*CYMD);
CYMDDate = %Dec(%Char(hldBldDt:*CYMD0):7:0);
CYMDDate = CDTECA;
hldBldDt = %Date(CYMDDate:*CYMD);
HLDINVDT DATE(10) '2017-02-10'
E_A2INVD DATE(10) '2017-02-10'
LOWDATE DATE(10) '0001-01-01'
HLDQUADT DATE(10) '0001-01-01'
HLDTRNDT DATE(10) '0001-01-01'
HLDSHPDT DATE(10) '0001-01-01'
HLDPRMDT DATE(10) '0001-01-01'
WINVENTORYDT DATE(10) '2017-02-10'
P_B5PDAT DATE(10) '0017-02-10'
WINVENTORYDT DATE(10) '2017-02-10'
HLDBLDDT DATE(10) '0017-02-10'
M_ODDTMY PACKED(7,0) 1170210.
CYMDDATE ZONED(7,0) 1170210
CDTECA PACKED(7,0) 1170126
IBM i 在日期字段中使用多种日期格式。它们根据日期的年份部分的格式持有不同的日期范围。
Number of Digits in Year Range of Years
2 (*YMD, *DMY, *MDY, *JUL) 1940 to 2039
3 (*CYMD, *CDMY, *CMDY) 1900 to 2899
4 (*ISO, *USA, *EUR, *JIS, *LONGJUL) 0001 to 9999
您收到的错误表明您试图将 4 位数年份的日期移动到 2 或 3 位数年份的日期,并且年份值超出目标日期的范围。在这种情况下,特定的违规者似乎是 hldBldDt
,在错误发生时的年份是 0017
,并且大概是 *ISO
格式。您可以在几个地方执行此操作:
CYMDDate = %Dec(%Char(hldBldDt:*CYMD0):7:0);
我怀疑其中一个触发了您的错误,因为 hldBldDt
的年份是 0017
而 *CYMD
超出了范围(*CYMD
的允许范围是 1900 - 2899)。问题是这是从哪里来的,因为 hldBldDt
通常使用 *CYMD
填充,这应该使日期保持在范围内。查看数据,我看到 P_B5PDAT
也有 0017
的年份,并且您将 P_B5PDAT
直接分配给 hldBldDt
。因此,如果这 运行 没问题,要么 P_B5PDAT
中的值未被使用,要么你在那里度过了糟糕的一年。
因此,到目前为止在我们的 Production iSeries 中 运行 正常的程序之一出现错误。
Statement in Error . . . . . . . . . . : 00051900
RPG Routine . . . . . . . . . . . . . : REPROMIS
Number of Parameters . . . . . . . . . : 005
Message Type . . . . . . . . . . . . . : RNX
Additional Message Info . . . . . . . : 0114
Message Data . . . . . . . . . . . . . :
The year portion of a Date or Timestamp value is not in the correct range.
以上是错误。所以我知道错误的语句是 519 也就是这个
RepromiseMode();
所以这只是在 iSeries 程序中调用的一个过程。正如我在之前的一篇文章中提到的,我仍在学习如何读取假脱机文件。我浏览了作业日志,下面是我认为可能相关的内容:
Message . . . . : Data mapping error on member FG205L01.
Cause . . . . . : A data mapping error occurred on field
Max(FG205F_1.QSRDTE) in record number 0, record format *FIRST, member number
1, in member FG205L01 file FG205L01 in library FILES, because of error code
18. The error code meanings follow: 1 -- There is data in a decimal field
that is not valid. 2 -- A significant digit was truncated. 3 -- A floating
point value exceeded the maximum representable value. 4 -- A floating point
value was less than the minimum representable value. 5 -- A binary floating
正如上面的消息所说,错误代码 18 是:
18 -- 日期、时间或时间戳字段中的数据无效。
现在对如何前进有点迷茫。这只是数据问题还是需要更改代码的程序相关问题?
下面是我放置假脱机文件的保管箱 link。
https://www.dropbox.com/s/1jbgqvqn9zaac8g/PD001R_Error.txt?dl=0
任何关于如何前进的指导都会有所帮助
**
Update - 1
**
就我目前所做的研究而言,我需要专注于以下程序
P RepromiseMode B
// ...... Define the procedure interface
D RepromiseMode PI
/Free
//- Spin the whole file
CallP PW012R('INFO':'PD001R0055':ModuleName:' ':
' ':' ':' ':'0':' ':P_COMOrd:P_ItmSeq:
' ':' ':' ':' ':' ');
If P_COMOrd = *Blanks;
Setll (*Loval) PD002F;
Read PD002F;
Else;
If P_ItmSeq = *Zeros;
Setll (1:'1':P_COMOrd) PD002F;
Reade (1:'1':P_COMOrd) PD002F;
Else;
Setll (1:'1':P_COMOrd:%Dec(P_ItmSeq:7:0)) PD002F;
Reade (1:'1':P_COMOrd:%Dec(P_ItmSeq:7:0)) PD002F;
EndIf;
EndIf;
Dow Not %Eof(PD002F);
wOrdCmp = E_A2AENB;
wOrdTyp = E_A2DCCD;
wOrdNbr = E_A2CVNB;
wItmSeq = E_A2FCNB;
wModel = E_A2MODL;
hldInvDt = E_A2INVD;
hldBldDt = E_A2BLDA;
hldQuaDt = LowDate;
hldTrnDt = LowDate;
hldShpDt = LowDate;
hldPrmDt = LowDate;
MoreDates = *Off;
GAC03 NextRecord = *Off;
GAC11 //- Check if it is the correct repromise
GAC11 CorrectOrd = *Off;
GAC11 Exec Sql
GAC11 Select '1' into :CorrectOrd
GAC11 From mbc6res0
GAC11 Inner Join pd001f On a1ordy=c6uucc And a1adr0=c6uuca
GAC11 where c6aenb=:wOrdCmp And c6dccd=:wOrdTyp
GAC11 And c6cvnb=:wOrdNbr And a1dvnm=:ModuleName;
GAC11 If SqlCode > 100;
GAC11 // Actually nothing yet if error then it will not run past here
GAC11 EndIf;
GAC11 //- If the record is for this repromise continue
GAC11 If CorrectOrd;
//- Conitune if the PD002F is written
GetInvDate();
If PD002Good;
Chain (wOrdCmp:wOrdTyp:wOrdNbr:wItmSeq) FG263L02;
If %Found(FG263L02);
Chain (K_FGVIN#) FG203F;
If %Found(FG203F);
If hldBldDt > *Loval;
wInventoryDt = hldBldDt;
Else;
wInventoryDt = %Date();
EndIf;
//- Shippable is Yes
If V_SHIP = 'Y';
wFinGood = 'Y';
wSalFmy = V_SFMLY;
wPline = V_PLINE;
wHouse = V_CHOUSE;
ProcRePromise();
GetPD002F();
//- Shippable is NO
Else;
CallP PW012R('INFO':'PD001R0090':ModuleName:V_CHOUSE:
V_VIN:V_MODEL:' ':%Char(V_ORDCMP):V_ORDTYP:
V_ORDNBR:'0':' ':' ':' ':' ':' ');
LoopDone = *On;
wFinGood = 'Y';
wSalFmy = V_SFMLY;
wPline = V_PLINE;
wHouse = V_CHOUSE;
ProcRepromise();
GetPD002F();
EndIf;
GAC03 //- Some how there is a valid vin in FG263F but not FG203F then...
GAC03 Else;
GAC04 CallP PW012R('INFO':'PD001R0210':ModuleName:' ':
GAC04 K_FGVIN#:' ':' ':%Char(wOrdCmp):wOrdTyp:
GAC04 wOrdNbr:%Char(wItmSeq):' ':' ':' ':' ':' ');
GAC03 SendEmail = *On;
GAC04 GetPD009F();
EndIf;
//- No VIN was found
Else;
Chain (wOrdCmp:wOrdtyp:wOrdNbr:wItmSeq) PW019L01;
If %Found(PW019L01);
//- Found in PW019F and it is a Finshed Good VIN
If N_B0FASG = 'Y';
//- End the process the order has not been assigned in the warehouse
// yet, but there is a label waiting for assignment all is good.
CallP PW012R('INFO':'PD001R0185':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):' ':' ':' ':' ':' ');
Else;
//- Looks for a slot record
Chain (wOrdCmp:wOrdtyp:wOrdNbr:wItmSeq) PW014F;
If %Found(PW014F);
hldBldDt = P_B5PDAT;
MoreDates = *On;
//- No slot record look for a MO order
Else;
Chain (wOrdCmp:wOrdtyp:wOrdNbr:wItmSeq) MOMASTLG;
If %Found(MOMASTLG);
hldBldDt = %Date(M_ODDTMY:*CYMD);
MoreDates = *On;
//- No MO record send an error email
Else;
CallP PW012R('INFO':'PD001R0170':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):' ':' ':' ':' ':' ');
SendEmail = *On;
GAC04 GetPD009F();
EndIf;
EndIf;
EndIf;
//- Error because not in PW019F
Else;
CallP PW012R('INFO':'PD001R0175':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):' ':' ':' ':' ':' ');
SendEmail = *On;
GAC04 GetPD009F();
EndIf;
//- If there needs to be more dates calculate
If MoreDates;
GetSalesFamly();
P_NumDays = *Zeros;
wModel = E_A2MODL;
CallP PD005R(wSalFmy:' ':wModel:P_NumDays);
DecNumDays = %Dec(P_NumDays:4:0);
If DecNumDays = *Hival;
CallP PW012R('INFO':'PD001RE025':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):'PD005R came back with 9999 days':
' ':' ':' ':' ');
SendEmail = *On;
NextRecord = *On;
GetPD009F();
Else;
Chain (1:'1':wOrdNbr:wItmSeq) MBCDRES0;
If %Found(MBCDRES0);
wHouse = B_CDA3CD;
Chain (1:'1':wOrdNbr:wItmSeq) MOMASTLG;
If %Found(MOMASTLG);
Chain (M_FIWHMY) WHSMST;
If %Found(WHSMST);
//- Move forward number of days agains work cacendar
CYMDDate = %Dec(%Char(hldBldDt:*CYMD0):7:0);
Setll (W_CALP:CYMDDate) CALNDRL0;
For j = 0 to DecNumDays;
Reade (W_CALP) CALNDRL0;
CYMDDate = CDTECA;
EndFor;
EndIf;
//- Now update the Quality Date
hldBldDt = %Date(CYMDDate:*CYMD);
wInventoryDt = hldBldDt;
CallP PW012R('INFO':'PD001R0125':ModuleName:' ':
' ':wModel:' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:
%Char(wItmSeq):' ':' ':' ':' ':' ');
GetPD002F();
EndIf;
GAC05 Else;
GAC05 // DO not send email on this because the file is empty
GAC05 CallP PW012R('INFO':'PD001R0230':ModuleName:wHouse:
GAC05 ' ':' ':' ':'0':' ':wOrdNbr:%Char(wItmSeq):
GAC05 ' ':' ':' ':' ':' ');
GAC05 NextRecord = *On;
EndIf;
//- Get all the dates needed
wFinGood = 'N';
If Not NextRecord;
QualityDate();
CallP PW012R('INFO':'PD001R0140':ModuleName:' ':' ':wModel:
' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:%Char(wItmSeq):
' ':' ':' ':' ':' ');
EndIf;
If Not NextRecord;
TransferDate();
CallP PW012R('INFO':'PD001R0122':ModuleName:' ':' ':wModel:
' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:%Char(wItmSeq):
' ':' ':' ':' ':' ');
EndIf;
If Not NextRecord;
ShipWedgeDate();
CallP PW012R('INFO':'PD001R0123':ModuleName:' ':' ':wModel:
' ':%Char(wOrdCmp):wOrdtyp:wOrdNbr:%Char(wItmSeq):
' ':' ':' ':' ':' ');
GetPD002F();
EndIf;
EndIf;
EndIf;
EndIf;
EndIf;
GAC11 EndIf;
If P_COMOrd = *Blanks;
Read PD002F;
Else;
If P_ItmSeq = *Zeros;
Reade (1:'1':P_COMOrd) PD002F;
Else;
Reade (1:'1':P_COMOrd:%Dec(P_ItmSeq:7:0)) PD002F;
EndIf;
EndIf;
EndDo;
/End-Free
P RepromiseMode E
我目前正在对此进行调试,但到目前为止它还没有崩溃,无法查明哪个 日期 assignment/date 相关操作 导致了问题。
UPDATE - 2
在上面的过程中,正在读取一个文件PD002F。要查看具有日期数据类型的所有字段的日期值,我尝试使用客户端访问中的“导出”选项将此文件提取到 Excel,但随后引发了相同的错误:
CWBDB0099 - No more data is available for the stream fetch request
SQL0181 - Value in date, time, or timestamp string not valid.
Cause . . . . . : The string representation of a date, time or timestamp value is not in the acceptable range. *N is either the character string constant that is not valid or the column or host variable that contained the string.
那么是文件损坏了还是怎么的?
UPDATE -3
我尝试通过客户端访问使用 RRN < 2 仅提取一条记录,但效果很好!但是当我给 RRN < 3 时,抛出了同样的错误。这进一步加强了我的怀疑,即此问题仅针对特定记录出现。
Update 4
这是转储中的违规数据,以及相关的日期操作:
hldInvDt = E_A2INVD;
hldBldDt = E_A2BLDA;
hldQuaDt = LowDate;
hldTrnDt = LowDate;
hldShpDt = LowDate;
hldPrmDt = LowDate;
wInventoryDt = hldBldDt;
wInventoryDt = %Date();
hldBldDt = P_B5PDAT;
hldBldDt = %Date(M_ODDTMY:*CYMD);
CYMDDate = %Dec(%Char(hldBldDt:*CYMD0):7:0);
hldBldDt = %Date(M_ODDTMY:*CYMD);
CYMDDate = %Dec(%Char(hldBldDt:*CYMD0):7:0);
CYMDDate = CDTECA;
hldBldDt = %Date(CYMDDate:*CYMD);
HLDINVDT DATE(10) '2017-02-10'
E_A2INVD DATE(10) '2017-02-10'
LOWDATE DATE(10) '0001-01-01'
HLDQUADT DATE(10) '0001-01-01'
HLDTRNDT DATE(10) '0001-01-01'
HLDSHPDT DATE(10) '0001-01-01'
HLDPRMDT DATE(10) '0001-01-01'
WINVENTORYDT DATE(10) '2017-02-10'
P_B5PDAT DATE(10) '0017-02-10'
WINVENTORYDT DATE(10) '2017-02-10'
HLDBLDDT DATE(10) '0017-02-10'
M_ODDTMY PACKED(7,0) 1170210.
CYMDDATE ZONED(7,0) 1170210
CDTECA PACKED(7,0) 1170126
IBM i 在日期字段中使用多种日期格式。它们根据日期的年份部分的格式持有不同的日期范围。
Number of Digits in Year Range of Years 2 (*YMD, *DMY, *MDY, *JUL) 1940 to 2039 3 (*CYMD, *CDMY, *CMDY) 1900 to 2899 4 (*ISO, *USA, *EUR, *JIS, *LONGJUL) 0001 to 9999
您收到的错误表明您试图将 4 位数年份的日期移动到 2 或 3 位数年份的日期,并且年份值超出目标日期的范围。在这种情况下,特定的违规者似乎是 hldBldDt
,在错误发生时的年份是 0017
,并且大概是 *ISO
格式。您可以在几个地方执行此操作:
CYMDDate = %Dec(%Char(hldBldDt:*CYMD0):7:0);
我怀疑其中一个触发了您的错误,因为 hldBldDt
的年份是 0017
而 *CYMD
超出了范围(*CYMD
的允许范围是 1900 - 2899)。问题是这是从哪里来的,因为 hldBldDt
通常使用 *CYMD
填充,这应该使日期保持在范围内。查看数据,我看到 P_B5PDAT
也有 0017
的年份,并且您将 P_B5PDAT
直接分配给 hldBldDt
。因此,如果这 运行 没问题,要么 P_B5PDAT
中的值未被使用,要么你在那里度过了糟糕的一年。