On Fri, 15 May 2020, at 19:48, Charles Mills wrote: > But everything to do with how big a stem variable array it can build.
But there's no need, if counting the records in a file (or even summing their lengths as well) to store them all. Use something like: /* REXX Call as: %linkount dsn num where: dsn is fully qualified, with/without quotes num is number of lines read at a time, default is 500 */ parse arg dsname chunksize ; dsname = strip(dsname,"B","'") if ^datatype(chunksize,"W") then chunksize = 500 address tso "allocate fi(huge) da('"dsname"') shr reuse" linecount = 0 do forever "execio" chunksize "diskr huge (stem somelines."; erc = rc linecount = linecount + somelines.0 if erc > 0 then leave end "execio 0 diskr huge (finis"; "free fi(huge)" /* close+free */ say dsname "has" linecount "lines." One could possibly preface that code with one of the LISTDSI-based solutions to get an approximate idea of the allocated size of the file & hence determine an appropriate chunksize, depending on whether you want the count to be faster/slower or to waste more/less memory while running. -- Jeremy Nicoll - my opinions are my own. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN