× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Like I always say "Avoid surprise, INITIALIZE!"
Add the INZ keyword to the xRecord data structure.

-Bob Cozzi
www.RPGxTools.com
RPG xTools - Enjoy programming again.


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Taylor, Mark W
Sent: Thursday, September 08, 2005 12:15 PM
To: RPG400-L@xxxxxxxxxxxx
Subject: Getting error message when calling procedure

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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.