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



I have a program that is converting a .txt file into a table. The fields in
the table are defined as varchar length 100 allocate 1. I have done this
often.

Today, this program is failing. I have about 20 varchar fields and cannot
determine which field is the problem. I just get this message:

----------------------------
Additional Message Information



Message ID . . . . . . : RNX0115 Severity . . . . . . . : 50

Message type . . . . . : Escape

Date sent . . . . . . : 04/08/16 Time sent . . . . . . :
14:06:14


Message . . . . : Length of varying length variable is out of range.

Cause . . . . . : The length of a varying length character or DBCS
variable
is less than 0 or greater than its declared maximum length in RPG
procedure
BUILD_MAST in program LIBERTY/IMPORT01.

Recovery . . . : Contact the person responsible for program maintenance
to
determine the cause of the problem.

----------------------------

Here is the code:

----------------------------
P* -------------------------------------------------
P* Phase 2 - Build master records
P*
P* -------------------------------------------------

p Build_Master_record...
p b
d pi
d
d wRecord_found s N
d
c/free

// reset fields

Exec Sql Delete from Liberty_Master_Record;

wRecord_Found = *off;

Exec Sql Open Apple_01;
Exec Sql Fetch FIRST from Apple_01 into :rrn, :dsApple_01;

DoW SqlCod <> 100 and SqlCod >= 0;


If wRecord_Found;
If Col_02 = 'Customer' or
Col_02 = 'Vendor' or
Col_02 = 'Employee' or
Col_02 = 'Personal' ;
Exec Sql Insert into Liberty_Master_Record
values(:dsMaster) ;

Clear dsMaster;
wRecord_Found = *off;
Endif ;
ENDIF;

Select;
When Rcd_type = 'Customer' and (
Col_02 = 'Customer' or
Col_02 = 'Vendor' or
Col_02 = 'Employee' or
Col_02 = 'Personal' );
wRecord_Found = *on;
Ledger = Rcd_Type;
Account_No = %trim(Col_01);
Col_04 = %replace('':Col_04:1:1);
Acct_Bal = %dec(%trim(Col_04):11:2);
When Rcd_type = 'Customer' and Col_02 = 'Active';
Card_ID = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'First Address:';
Address1 = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'City:';
City = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'State:';
State = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'ZIP:';
ZIP = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Country:';
Country = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Phone #1:';
Phone1 = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Phone #2:';
Phone2 = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Phone #3:';
Phone3 = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'FAX #:';
Fax = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Email:';
Email = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Salutation:';
Salutation = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Contact:';
Contact = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Notes:';
Notes = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Price Level:';
Price_lvl = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Payment Due:';
Paymnt_due = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Days Due/Date:';
Days_Due = %trim(Col_04);
When Rcd_type = 'Customer' and Col_02 = 'Active';
Status = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Credit Limit:';
Cr_Limit = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Email:';
Email = %trim(Col_04);
When Rcd_type = 'Customer' and Col_03 = 'Email:';
Email = %trim(Col_04);

Other;

EndSL;

Exec Sql Fetch NEXT from Apple_01 into :rrn, :dsApple_01;
ENDDO;
Exec Sql Close Apple_01;

If wRecord_Found;
Exec Sql Insert into Liberty_Master_Record
values(:dsMaster) ;
Endif ;

/end-free

p Build_Master_Record...
p e
p
P* -------------------------------------------------

----------------------------

TIA


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.