Hi Thomas
From what you have just described
The keys of this file are
10 Ar Company K01 CUCO A 5
20 Customer Number K02 CUCUNO A 14
The field cunano is NOT a key to this file
In a strsql session try this script
Select cunano, count(*) from ARLCU
Group by cunano
Order by 2 desc, cunano
And see if you get any cunano with a count of more than 1
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Burrows, Thomas 1001
Sent: Tuesday, October 23, 2018 4:53 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: [EXTERNAL] RE: Problem with reading a file that does have keys
H option(*NODEBUGIO) DATFMT(*ISO)
H DFTACTGRP(*NO)
FARLCU IF E DISK
FFIVXZFU0 UF A E K DISK
F*
D count1 S 10I 0
D count2 S 10I 0
D count3 S 10I 0
D count4 S 10I 0
D today S D
D todaydate S 8P 0
D todaytime S 6P 0
D savcuno S 14A
D pgmsds esds extname(sysapgpf)
count1 = *zero;
count2 = *zero;
count3 = *zero;
count4 = *zero;
savcuno = ' ';
today = %date();
zfstas = 'A';
dow not %eof(arlcu);
exsr mainloop;
enddo;
count1 = count1;
count2 = count2;
count3 = count3;
count4 = count4;
*INLR = *on;
return;
begsr mainloop;
read arlcu;
if cunano = savcuno;
count4 = count4 + 1;
endif;
savcuno = cunano;
count1 = count1 + 1;
Endsr;
Okay there is more to this program. But I have that commented out as I am not getting the READ to work on file ARLCU. Which has 35,815 records with unique keys. Two keys. First two fields.
DBU of ARLCU first record and only the first page of the fields.
Ar Company 005
Customer Number 000059
ational Account Number 000059
Lockbox Number
Federal Taxpayer Id
Sales Level Id
Salesperson Code TPK07
Customer Name GANDOLFO'S DELI - ONTARIO
Address Line 1 80 SE 2ND ST STE 2
Address Line 2
Address Line 3
Address Line 4
City ONTARIO
================
10 Ar Company K01 CUCO A 5
20 Customer Number K02 CUCUNO A 14
30 National Account Number CUNANO A 14
40 Lockbox Number CULKNO A 7
50 Federal Taxpayer Id CUTXID A 18
60 Sales Level Id CUSLID A 5
70 Salesperson Code CUSMAN A 5
80 Customer Name CUNAME A 30
This file is 25 plus years old. Cannot do anything about the field names.
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> On Behalf Of Kevin Bucknum
Sent: Tuesday, October 23, 2018 3:43 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Problem with reading a file that does have keys
[ External Email ]
----------------------------------------------------------------------
The code you are showing keeps changing and the old style names don't help. My first take on the code you posted was that CUCUNO is the customer number in the second column. CUNANO is the national number in the third column. If that is the case, then yes CUNANO will equal SAVCUNO in your example below with the data you showed us earlier. Create the smallest example that doesn't work the way you think it will, and cut and past the complete code here.
________________________________
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> on behalf of Burrows, Thomas 1001 <Burrows.Thomas@xxxxxxxxxxxxxx>
Sent: Tuesday, October 23, 2018 3:25 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Problem with reading a file that does have keys
Peter:
I had the "K" in column 34. Removed that and took out the SETLL. Get the exact same results. At no time should This statement be TRUE;
read arlcu;
if cunano = savcuno;
count4 = count4 + 1;
endif;
savcuno = cunano;
count1 = count1 + 1;
================
There are 36,815 records in ARLCU and not a single repeating CUNANO.
Not sure what is up.
Thomas
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> On Behalf Of Peter Dow
Sent: Tuesday, October 23, 2018 2:55 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Problem with reading a file that does have keys
[ External Email ]
----------------------------------------------------------------------
Hi Thomas,
In regards to your question "is there anything on the F specs I could be overlooking?", make sure there's a "K" in pos.34 of the F-spec, or if you're doing free-format, the KEYED keyword. Otherwise you'd be reading the file by RRN instead of by key.
--
*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
petercdow@xxxxxxxxx <mailto:petercdow@xxxxxxxxx> pdow@xxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxx> /
On 10/23/2018 8:45 AM, Thomas Burrows wrote:
I want to read a keyed file from top to bottom. i.e. I am finding that
I seem to read some records more than once.
is there anything on the F specs I could be overlooking?
I put a counter in for the read and I get the right number of times
through the read routine.
Doing a "DOU NOT %EOF(filename)
Then an EXSR X1 to the read routine where the read on the file is
BEGSR x1
READ FILENAME;
endsr
I put an if statement in after the read looking against one of the
account numbers that is only in the file being read from once. But I
get SEVEN or more hits in the IF statement checking against that one account number.
Thomas Burrows
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=QCA-vbpQGWbbjYIkv4DxXqDmou5ymphgVPPC2_71_Zc&s=pG265zx8Dj_eiwNFG11DCYAjFN0qynBK6I4ah2vDsoA&e=
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=QCA-vbpQGWbbjYIkv4DxXqDmou5ymphgVPPC2_71_Zc&s=g2oS2y-XDDaJJ-KJBgmcCio1ZM9INm0OAgGDBzLJVqY&e=.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://urldefense.proofpoint.com/v2/url?u=http-3A__amzn.to_2dEadiD&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=QCA-vbpQGWbbjYIkv4DxXqDmou5ymphgVPPC2_71_Zc&s=ayHN-DkHhblwl1N7OR1CpX7TwmAW_tvwOkX24AQwEAI&e=
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=Ltf06F_nGNctn5vwiiFVwoIKe3tOyk-ZNdWbI8AVjqY&s=d5aZ2b1ufuLsBihK2NuZDedeKGAfE9v2iPVeBsCZUqc&e=
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=Ltf06F_nGNctn5vwiiFVwoIKe3tOyk-ZNdWbI8AVjqY&s=bJzBbfB_YE3kqCb-EHiWsIYJtGOev-a3GRBObu948wA&e=.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://urldefense.proofpoint.com/v2/url?u=http-3A__amzn.to_2dEadiD&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=Ltf06F_nGNctn5vwiiFVwoIKe3tOyk-ZNdWbI8AVjqY&s=9Vdj5FVyGQy8dLtA0d1nHL2CmAAP8ZgNQFQz71Ualcg&e=
[
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.medtronsoftware.com_img_MedtronMinilogo.bmp&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=Ltf06F_nGNctn5vwiiFVwoIKe3tOyk-ZNdWbI8AVjqY&s=IyUId_xDQWSosrQkLFZmiulxVLCtOq4zLGUk52aOQXQ&e=] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://urldefense.proofpoint.com/v2/url?u=https-3A__www.medtronsoftware.com&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=Ltf06F_nGNctn5vwiiFVwoIKe3tOyk-ZNdWbI8AVjqY&s=qGTUTONZsvg_DOqGgsnKI-WaVK0TSnm0KbEqZNTcqm4&e=
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=Ltf06F_nGNctn5vwiiFVwoIKe3tOyk-ZNdWbI8AVjqY&s=d5aZ2b1ufuLsBihK2NuZDedeKGAfE9v2iPVeBsCZUqc&e=
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=Ltf06F_nGNctn5vwiiFVwoIKe3tOyk-ZNdWbI8AVjqY&s=bJzBbfB_YE3kqCb-EHiWsIYJtGOev-a3GRBObu948wA&e=.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://urldefense.proofpoint.com/v2/url?u=http-3A__amzn.to_2dEadiD&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=Ltf06F_nGNctn5vwiiFVwoIKe3tOyk-ZNdWbI8AVjqY&s=9Vdj5FVyGQy8dLtA0d1nHL2CmAAP8ZgNQFQz71Ualcg&e=
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.