|
On Apr 8, 2016, at 3:35 PM, Darryl Freinkel <dhfreinkel@xxxxxxxxx> wrote:
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
--
Darryl Freinkel
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
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.