|
Hi All,
I have a program that will take any IBMi file and create an excel.
Works great and is used daily. Users are creating new files using Query all the time.
I retrieve the fields for the file using QUSLFLD and are loaded into arrays.
FInput IF F32766 DISK UsrOpn ExtFile(FileOverride)
F InfDS(InputDS)
DInputDS DS
D InputRecords 156 159I 0
D InputRRN 397 400I 0
D DS INZ
D NumericFld 1 16P 0
D AlphaFld 1 16
IINPUT NS
I 132766 InputData
// Seperate Field
Data = %SubSt(InputData : FldStart(X) : FldLength(x));
// Load Field From String
%SubSt(AlphaFld : 17 - FldLength(X)) = %Trim(Data);
Here is the scenario.
The field must be packed, odd number of digits, must be using all digits AND first 2 digits contain 40.
Example: P5,0 contains 40000 it fails. If it contains 4000 no issue. If it contains 41000 no issue.
I read a record from Input and start parsing out the fields.
When it does the SubSt to the alphafld the result (NumericFld) contains invalid data and further in the code gets a decimal data error. Yes, I can add a monitor to trap it.
I know when it is going to happen because I can test on field type (P), length (Odd digits) and first position of Data contains X'40'.
First, Why does it decide to interpret the X'40' as a space I assume only in the scenario?
What can I do about it?
Is there a better way of parsing out the data?
As an Amazon Associate we earn from qualifying purchases.
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.