• Subject: RE: Problem with reading a file that does have keys
  • From: "Burrows, Thomas 1001" <Burrows.Thomas@xxxxxxxxxxxxxx>
  • Date: Tue, 23 Oct 2018 22:05:30 +0000
  • List-archive: <https://archive.midrange.com/rpg400-l/>
  • List-help: <mailto:rpg400-l-request@midrange.com?subject=help>
  • List-id: "RPG programming on the IBM i \(AS/400 and iSeries\)" <rpg400-l.midrange.com>
  • List-post: <mailto:rpg400-l@midrange.com>
  • List-subscribe: <https://lists.midrange.com/mailman/listinfo/rpg400-l>, <mailto:rpg400-l-request@midrange.com?subject=subscribe>
  • List-unsubscribe: <https://lists.midrange.com/mailman/options/rpg400-l>, <mailto:rpg400-l-request@midrange.com?subject=unsubscribe>
  • Msip_labels: MSIP_Label_be4b3411-284d-4d31-bd4f-bc13ef7f1fd6_Enabled=True; MSIP_Label_be4b3411-284d-4d31-bd4f-bc13ef7f1fd6_SiteId=63ce7d59-2f3e-42cd-a8cc-be764cff5eb6; MSIP_Label_be4b3411-284d-4d31-bd4f-bc13ef7f1fd6_Owner=thomas.burrows@xxxxxxxxxxxxxx; MSIP_Label_be4b3411-284d-4d31-bd4f-bc13ef7f1fd6_SetDate=2018-10-23T22:05:26.6427973Z; MSIP_Label_be4b3411-284d-4d31-bd4f-bc13ef7f1fd6_Name=Internal; MSIP_Label_be4b3411-284d-4d31-bd4f-bc13ef7f1fd6_Application=Microsoft Azure Information Protection; MSIP_Label_be4b3411-284d-4d31-bd4f-bc13ef7f1fd6_Extended_MSFT_Method=Automatic; MSIP_Label_a0819fa7-4367-4500-ba88-dd630d977609_Enabled=True; MSIP_Label_a0819fa7-4367-4500-ba88-dd630d977609_SiteId=63ce7d59-2f3e-42cd-a8cc-be764cff5eb6; MSIP_Label_a0819fa7-4367-4500-ba88-dd630d977609_Owner=thomas.burrows@xxxxxxxxxxxxxx; MSIP_Label_a0819fa7-4367-4500-ba88-dd630d977609_SetDate=2018-10-23T22:05:26.6427973Z; MSIP_Label_a0819fa7-4367-4500-ba88-dd630d977609_Name=Companywide usage; MSIP_Label_a0819fa7-4367-4500-ba88-dd630d977609_Application=Microsoft Azure Information Protection; MSIP_Label_a0819fa7-4367-4500-ba88-dd630d977609_Parent=be4b3411-284d-4d31-bd4f-bc13ef7f1fd6; MSIP_Label_a0819fa7-4367-4500-ba88-dd630d977609_Extended_MSFT_Method=Automatic; Sensitivity=Internal Companywide usage

More to the goal than was shown. Using the information from the original file to look into another file and move a bunch of data.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxx> On Behalf Of Alan Campin
Sent: Tuesday, October 23, 2018 5:04 PM
To: RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
Subject: Re: Problem with reading a file that does have keys

[ External Email ]

----------------------------------------------------------------------
I guess I have to ask. What was the ultimate goal of this program? It seems like a simply SQL statement would have done it all.


On Tue, Oct 23, 2018 at 2:33 PM Buck Calabro <kc2hiz@xxxxxxxxx> wrote:

On 10/23/2018 1:53 PM, Thomas Burrows wrote:
Here is what I mean from top to bottom on the file.
Using DBU here are the first three variables or columns.
Key 1 is the first column A5 length. Key 2 is the second column A14
length

company Customer National
Account
005 000059 000059
005 000117 000117
005 000125 000117
005 000133 000117
005 000141 000117
005 000158 000117
005 000166 021436
005 000174 074625
005 000182 000182
005 000208 000208
005 000224 000224

Code

setll (cuco: cucuno) arlcu;
dow not %eof(arlcu);
exsr mainloop;
enddo;

begsr mainloop;
read arlcu;
if cunano = ' 000117';
count4 = count4 + 1;
cunano = cunano;
endif;
count1 = count1 + 1;
endsr;

I get 14 for count4. And 36 thousand plus for counter1. Which is
the number of records in ARLCU.

If we can assume that the SETLL uses the lowest CUCO and CUCUNO
values, the DOW would start at the lowest record and run to %EOF.
COUNT1 would then be 36k, right?

And because the DOW doesn't stop when CUNO changes, or CUCUNO changes,
COUNT4 represents every row in the file that is for National Account
000117, regardless of CUNO or CUCUNO.

You might want a READE, to restrict the DOW just to the keys of interest.

One thing I've found personally helpful is my Best and Dearest Friend
QSYSPRT, and I mean that sincerely. I'd put in an EXCEPT at each of
the places where the counts are incrementing and some O-specs that
print the fields that will give me that Aha!. It seems faster for me
to reach that Aha! moment when I WRKSPLF than when I'm in debug.

Oh, one other thing - I used to leave debugging code like that in the
source, conditioned on U8 or some such. Today, I'd wrap it in
conditional compilation like this:

// uncomment below for printed debugging info // define DEBUG

/if defined(DEBUG)
except prtDetail;
/endif


Which in real life is a LF, but when I copied the file into my
library ARLCU became a PF.
Yep. What you want to do is CRTDUPOBJ the PF, make sure your library
is at the top of *LIBL, then CRTDUPOBJ the LF. Then you'll see the LF
in your lib pointing to the PF in your lib.

--
--buck

https://urldefense.proofpoint.com/v2/url?u=http-3A__wiki.midrange.com&;
d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGBz1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz
5KbIaikfo&m=RMU4cHjX1uoUquVjcp1KWTy-0qZTlqCdamdlune3qGc&s=oW2Ni19zweEX
-5xrcazIE7WSgzbehqAGQKRbvDSkClc&e=
Your updates make it better!

--
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.co
m_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=Iej4I5bEYPmgv5l2sS6i8A&r=XeGB
z1fvL6mzoxSW9-Fyt7Ajo0tG_mOKUz5KbIaikfo&m=RMU4cHjX1uoUquVjcp1KWTy-0qZT
lqCdamdlune3qGc&s=FHPO1hdtUonYctrj4eMYxpgF_gxEX3SSaUOBqbexl9E&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=RMU4cHjX1uoUquVjcp1KWTy-0qZTlqCdamdlune3qGc&s=_eGkPBaDSxXeX462bmMslcaWn9peSchNkNmxxau_Pxc&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_mOKUz5K
bIaikfo&m=RMU4cHjX1uoUquVjcp1KWTy-0qZTlqCdamdlune3qGc&s=60fqKRUnwrTkCn
p7pgOiag7c0gszm118YyWEQOgOOYA&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=RMU4cHjX1uoUquVjcp1KWTy-0qZTlqCdamdlune3qGc&s=FHPO1hdtUonYctrj4eMYxpgF_gxEX3SSaUOBqbexl9E&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=RMU4cHjX1uoUquVjcp1KWTy-0qZTlqCdamdlune3qGc&s=_eGkPBaDSxXeX462bmMslcaWn9peSchNkNmxxau_Pxc&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=RMU4cHjX1uoUquVjcp1KWTy-0qZTlqCdamdlune3qGc&s=60fqKRUnwrTkCnp7pgOiag7c0gszm118YyWEQOgOOYA&e=

This thread ...

Replies:

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

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