× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Wed, 2009-09-16 at 12:35 -0700, Jeff Young wrote:
I have a subfile with 15 lines per page and 3 records per line.
The normal way the system loads the subfile is down and then across.
I would like to load it across, then down.

Ex: Record 1 = RR# 1
Record 2 = RR# 16
Record 3 = RR# 31

Record 4 = RR# 2
Record 5 = RR# 17
Record 6 = RR# 32
.....

Does anyone have a formula or method that will do this?


TIA

Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3

Greetings,

Each of the solutions I have here uses an array. That is fine, of
course, but here is another way of doing it. The page size is
smaller, just because I did not read Jeff's question very carefully.

===== start dspf =====
A R LISTREC SFL
A 4 2'Number:'
A NBR 3 0B +1EDTCDE(Z)
A 4 20' '
A
A
A R CONTROL SFLCTL(LISTREC)
A 03 SFLCLR
A N03 SFLDSPCTL
A 02 SFLDSP
A SFLLIN(4)
A
A SFLSIZ(16) SFLPAG(15)
A N01 SFLEND(*MORE)
A
A 3 2'Column headings would go +
A here if +
A I had anything to say'
A COLOR(WHT)

===== start rpgle =====
H dftactgrp(*no) actgrp('AA5614')
H
Faa5611 cf e workstn sfile( listrec : recno )
D recno s 4 0
D
D flip pr 3 0
D colheight 3 0 value
D rowwidth 3 0 value
D seqnbr 3 0 value
D
D colheight c 5
D rowwidth c 3
D
C/free

*in03 = *on;
write control;
*in03 = *off;

recno = *zero;
for nbr = 1 to 31;
recno = flip( colheight : rowwidth : nbr );
write listrec;
endfor;
*in02 = *on;
exfmt control;

*inlr = *on;
/end-free

Pflip b
D flip pi 3 0
D colheight 3 0 value
D rowwidth 3 0 value
D seqnbr 3 0 value
D
D result s like(flip)
D pagesize s 3 0
D nbrofs s 3 0
D pagofs s 3 0
D colofs s 3 0
D rowofs s 3 0
C/free
pagesize = colheight * rowwidth;
ï nbrofs = seqnbr - 1;
pagofs = %int( nbrofs / pagesize );
rowofs = %int( %rem( nbrofs : pagesize ) / rowwidth );
colofs = %rem( nbrofs : rowwidth );
result = 1 + pagofs * pagesize
+ colofs * colheight
+ rowofs;
return result;
/end-free
Pflip e

===== end source code ======

Cheers,
Terry.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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.