|
I am trying to write a procedure that accepts a record (as a data structure)
and writes it to
a file. Then, passes back an error code to tell the calling program whether the
write worked
or not.
There are no errors creating the modules or binding them into a program. But
I'm getting error
message RNQ0202 "The call to WRTORDX00 ended in error" when I call the program.
When I look in the joblog I have error message MCH1202 "Decimal data error."
right after the
call to the program.
Is there something that I don't have setup correctly in the prototype?
Here is the calling procedure to test the WRTORDX00 procedure:
*************** Beginning of data ***************
H Option(*NoDebugIO:*SrcStmt)
FORDER IF E K DISK UsrOpn
* Prototype
D WrtOrdx00 PR 5 0
D InputRecord LikeRec(ORDRF:*Input)
* Data Structures
D xRecord DS LikeRec(ORDRF)
D ErrorCode S 5 0
/Free
Open ORDER;
xRecord.XHTKN1 = 100; //Numeric Identifier
xRecord.XHCPY1 = 1; //Company Number
xRecord.XHTYP1 = '1'; //Record Type
xRecord.XHRPL1 = 'N'; //Order Type
xRecord.XHMOR1 = ' 1'; //Order Number
xRecord.XHCAT1 = '10'; //Customer Category Co
xRecord.XHCPO1 = 'PO1'; //PO Number
xRecord.XHCON1 = 'MARK TAYLOR'; //Contact Name
xRecord.XHFON1 = '123/456-7890'; //Phone Number
xRecord.XHCDT1 = *Zeros; //Create Date
xRecord.XHCTM1 = *Zeros; //Create Time
xRecord.XHLCD1 = *Zeros; //Last Changed Date
xRecord.XHLCT1 = *Zeros; //Last Changed Time
xRecord.XHUSR1 = *Blanks; //Last Changed By User
xRecord.XHPGM1 = *Blanks; //Last Changed By Prog
ErrorCode = WrtOrdx00(xRecord);
Close ORDER;
*InLR = *On;
/End-Free
****************** End of data ******************
Here is the procedure source code:
*************** Beginning of data ***************
H NoMain Option(*NoDebugIO)
* Order File
FORDER UF A E K DISK UsrOpn
* Prototype
D WrtOrdx00 PR 5 0
D InputRecord LikeRec(ORDRF:*Input)
* Data Structures
D OutputRecord DS LikeRec(ORDRF:*Output)
D KeyFields DS LikeRec(ORDRF:*Key)
* Work Fields
D ErrorCode S 5 0 Inz(*Zeros)
P WrtOrdx00 B Export
D WrtOrdx00 PI 5 0
D InputRecord LikeRec(ORDRF:*Input)
/Free
Open(E) ORDER;
If %Error;
ErrorCode = %Status;
EndIf;
If ErrorCode = *Zeros;
// ** There is code here to do validation and what-not **
Write(E) ORDRF OutputRecord;
If %Error;
ErrorCode = %Status;
EndIf;
EndIf;
If %Open(ORDER);
Close ORDER;
EndIf;
*InLR = *On;
Return ErrorCode;
/End-Free
P WrtOrdx00 E
****************** End of data ******************
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.