File size distribution: Difference between revisions
Content added Content deleted
m (added a ;Task: section header, added whitespace before the table-of-contents (TOC), separated suggestions and a query from the task's requirements..) |
(→{{header|REXX}}: added support for an alternative comma, added a programming note (before the output section).) |
||
Line 430: | Line 430: | ||
_=linein(dirOUT); if left(_, 1)==' ' then iterate /*process data. */ |
_=linein(dirOUT); if left(_, 1)==' ' then iterate /*process data. */ |
||
parse upper var _ dat tim sz . /*uppercase suffix*/ |
parse upper var _ dat tim sz . /*uppercase suffix*/ |
||
if pos(' |
if pos(',', sz) \==0 then sz=space( translate(sz, , ",ÿ"), 0) /*SZ has commas? */ |
||
if |
if \datatype(sz,'W') then do; #=left(sz, length(sz) - 1) /*SZ has a suffix?*/ |
||
⚫ | |||
if \datatype(sz,'W') then do; #=left(sz, length(sz) - 1) /*SZ has a suffix?*/ |
|||
sfx=right(sz, 1) /*get the suffix. */ |
|||
sz=#*1024**pos(sfx,'KMGTPEZYX')/1 /*compute true val*/ |
|||
⚫ | |||
end |
end |
||
$=$ + sz /*keep a running total for the filesize*/ |
$=$ + sz /*keep a running total for the filesize*/ |
||
Line 468: | Line 467: | ||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
commas: parse arg _; do jc=length(_)-3 to 1 by -3; _=insert(',', _, jc); end; return _</lang> |
commas: parse arg _; do jc=length(_)-3 to 1 by -3; _=insert(',', _, jc); end; return _</lang> |
||
This REXX program makes use of '''LINESIZE''' REXX program (or BIF) which is used to determine the screen width (or linesize) of the terminal (console). |
|||
<br>The '''LINESIZE.REX''' REXX program is included here ──► [[LINESIZE.REX]].<br> |
|||
{{out|output|text= when using the default input: (which in this case was the '''C:''' drive.)}} |
{{out|output|text= when using the default input: (which in this case was the '''C:''' drive.)}} |
||
<pre> |
<pre> |