|
To group and range, try with something like this declare XX cursor for SELECT city, MIN(zip_code), MAX(zip_code) * from zip_input_file order by city, group by city. open xx fetch xx into :Vcity, Vmin, Vmax dow sqlcode=*zero output file fetch xx into :Vcity, Vmin, Vmax end Fernando ----- Remitido por Fernando Garcia/swift con fecha 19/10/2004 16:18 ----- fkany@averittexpres s.com Para: CN=RPG programming on the AS400/O=iSeries Enviado por: <rpg400-l@xxxxxxxxxxxx> rpg400-l-bounces@mi cc: drange.com Asunto: RE: Trivia: How many lines of code are allowed in an RPG Program? 19/10/2004 16:15 Por favor, responda a RPG programming on the AS400 / iSeries Dan, I'm trying to group/range Canadian zip codes. Here's how I want to range the Canadian zip codes: Program reads an Input file similar to this(zip codes are real, city1-city4 do not exist ;-): CITY1 T0B0Z0 CITY2 T0A0A0 CITY3 T0A0C0 CITY4 T4A1A1 CITY4 T4A1A2 CITY4 T4A1A3 CITY4 T4A1B1 CITY4 T4A1B2 CITY4 T4A1B3 CITY4 T4A1D1 CITY4 T4A1D2 CITY4 T4A1D3 Output file: Program needs to group/range the zip codes like this: CITY1 T0B0Z0 - 000000 CITY2 T0A0A0 - 000000 CITY3 T0A0C0 - 000000 CITY4 T4A1A1 - T4A1B3 CITY4 T4A1D1 - T4A1D3 Frank "Dan Bale" <dbale@xxxxxxxxxxxxx>@midrange.com on 10/19/2004 01:51:37 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> cc: Subject: RE: Trivia: How many lines of code are allowed in an RPG Program? Frank, far be it from me to steal your joy. <g,d,&r> Dang those Canadiens, eh? I won't even begin to guess how this can be shortened. Typically, when I look at a complex problem like this, I get a long continuous scrap of green bar and sketch out scenarios. I did this with my fanciful "subset sum problem" that I detailed here last month. I think I remember you mentioning this particular problem not too long ago. I checked the archives and couldn't find it. Could you either restate the problem or provide an archive link? Just looking at the code you provided doesn't tell me what you're trying to accomplish. There's gotta be a way. db -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
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.