因此,到目前为止,我们的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-日期、时间或时间戳字段中存在无效数据。
现在有点困惑于如何前进。这只是一个数据问题,还是一个需要更改代码的程序相关问题?
下面是放置假脱机文件的dropbox链接。
https://www.dropbox.com/s/1jbgqvqn9zaac8g/PD001R_Error.txt?dl=0
任何关于如何前进的指导都将有助于
**
更新-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
我目前正在对此进行调试,但到目前为止,它还没有崩溃,无法确定是哪个日期分配/日期相关操作导致了问题。
更新-2
在上面的过程中,正在读取一个文件PD002F。为了查看所有具有日期数据类型的字段的日期值,我试图使用CLient访问中的Export选项将该文件提取到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.
那么这个文件是不是已经损坏了?
更新-3
我试图使用RRN<2通过客户端访问,效果很好!但是当我给出RRN<3,抛出了相同的错误。这进一步加强了我的怀疑,即这个问题只出现在特定的记录中。
更新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在一个日期字段中使用了多种日期格式。根据日期的年份部分的格式,它们有不同的日期范围。
年份范围内的位数2(*YMD,*DMY,*MDY,*JUL)1940年至2039年3(*CYMD、*CDMY、*CMDY)1900至28994(*ISO,*USA,*EUR,*JIS,*LONGJUL)0001至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
中的值没有被使用,要么不知何故,你今年过得不好。