I have to admit my use of RWCS is weak because for almost all of the sites I worked at this was an extra charge faciltiy and they did not want to pay any more :(
It is only on old m/f kit from ICL that I used it as against IBM, Honeywell, Burroughs, Dec, Univax etc, etc.
I now am using it for a very old Payroll (USA) application that I have decided to rewrite it into Cobol from CBasic usibng RW in the hope it will cut down coding - but fo far not so much :(
And no, I am based in the UK so I am strongly using the old code base for payroll proceses and procedures etc. with the intention of adding it into my Open Source ACAS Accounting systems.
At almost 79 - I need something to occupy my mind etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In my experience, I have never encountered any shop using Report Writer.
Control break programming is generally used.
Report Writer is generally easy to use but time consuming to setup.
And requires good knowledge of it's features
It would probably would have been easier to convert the code to use control break's.
Secondly, no one uses fixed font line printers any more.
The data is used as input to other programs, such as spreadsheet's or programs that create PDF's.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In my experience, I have never encountered any shop using Report Writer.
A lot of my code does not make use of RW at least for the rest of my
ACAS application but as I started coding Payroll I decided to use it as
it does keep the PD area light weight and yes it does seem to create a
lot more coding in the RD areas but what you loose from PD it make up
for in RD but it is easier to read should the need arise to do so some
months later.
Control break programming is generally used.
Report Writer is generally easy to use but time consuming to setup.
And requires good knowledge of it's features
Well I have a reasonable knowledge of it but it does go back a long time
read that as the 70's - 80's.
This was mostly m/f and not ever shop bought the RW modules from what
ever 3rd party supplier was supplying it. Not so many Cobol compilers
had it inbuilt.
However MF compilers did do so but these days it is far too rich for my
wallet at least now I? have made all the code O/S.
It would probably would have been easier to convert the code to use
control break's.
Possibly but that is not the point here - it is getting the GC compiler
to work correctly with it.
Secondly, no one uses fixed font line printers any more.
Well my code uses terminal programs to run as it does not make use of a
GUI as there are too many across differing platforms such as for Linux
and KDE, Gnome to name but two, then there is Windows - another bag of
worms.
The data is used as input to other programs, such as spreadsheet's or
programs that create PDF's.
I have a Linux script that runs Enscript to convert a text file as
created by any program for its reporting to a pdf that can be printed or
just read as user needs it.
After the print file is closed I have a internal script that runs lpr
with various settings depending on if report is < 85 chars or 120 or
greater.
This gets issued after file closed and before program terminates.
There is not a lot of scope using GnuCobol any way.
For example using ACCEPT verb with numbers such as money it is extremely
basic with no editing capability so I am forced to try using Chucks
accept_numeric routine as it acts like a calculator for input. This has
been a major problem since the early days of v0.33
000521*> create act table for the possible 5 entries NEEDS CHANGES000522*>000523*> THIS IS A TEST FOR VARYING ONLY00052403 line +1 varyingAfrom1 by1.*> until A > PY-PR1-Max-Dist-Accts.warning:RWVARYINGclauseisnotimplementederror:AisnotvalidforVARYING00052505 col51 pic zzz9 sourceEmp-Dist-Acct(A)presentwhenEmp-Dist-Acct(A)not =zero.00052605 col56 pic x(24) sourceAct-Desc.00052705 col87 pic zz9.99 sourceEmp-Dist-Pcent(A).
The sub clause was in containing until ... but had same error so kept it simple but not logical as will not work as need a stop after 5 etc.
As it is had to do the same text for all occurrences of the data.
My experiments with v3.3 falls in various places so sticking to v3.2 and as v4 is very alpha I am keeping well away from it and no do not remember what was wrong with v3.3 but did also play with a special version of it from Chuck.
I need the programs to work !
The above code is my attempt to convert a old cbasic application of Payroll for the USA. IT give me some thing to do which I consider wise as I am 79 in June.
Vince
Last edit: Simon Sobisch 2026-01-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
again: if you provide a minimal, complete example, then I can ensure that it works, ideally by including it in the testsuite - otherwise its just "something doesn't work as you expected" but I'm not 100% sure what and can't test it.
Also: if there are any "failing experiments" with 3.3 - please say exactly which, as the RC1 is now planned for February (not sure that I'll make it, but still).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That will take far too long to edit for but here is a edited copy of the .prn file to use as input.
There are some errors for fileds missing - thats ok I took the code from another simlar program but have not got to that point yet for changing the code.
compile as cobc -m empprint.pro -T empprint.prn
Then look at lines at bottom showing :
empprint.pro:1686: warning: RW VARYING clause is not implemented
empprint.pro:1686: error: A is not valid for VARYING
In this instance I remarked out the "until A > PY-PR1-Max-Dist-Accts." to keep it simplier
I gave but a small element for what I had tried to do but the code is a
lot more for example here is the real coding that includes the problem
areas : (Warning it s along block)
RD Employee-Master-Report
control Final
Page Limit WS-Page-Lines
Heading 1
First Detail 5
Last Detail WS-Page-Lines. > > Print layouts to 132 cols Landscape >
01 Report-Emp-Head Type is Page Heading.
03 line 1.
05 col 50 pic x(40) source UserA.
05 col 110 pic x(10) source WS-Date. > IS this
correct format ? Check report
05 col 122 pic x(8) source WSD-Time.
03 line 2.
05 col 1 pic x(17) source Prog-Name.
05 col 51 pic x(19) value "ACAS Payroll System".
05 col 124 pic x(5) value "Page ".
05 col 129 pic zz9 source Page-Counter.
03 Line 3.
05 col 53 pic x(53) value "Employee Master Report".
03 line 4.
05 col 61 pic x(20) source WS-RS-Title. >
01 Employee-Report-Foot Type Report Footing.
03 line + 2.
05 col 5 pic x(22) value "Total Records printed ".
05 col 28 pic zzz9 source WS-Rec-Cnt. >
01 Employee-Detail type is detail. > ALL to be CHANGED
03 line 6.
05 col 39 value "Social Security".
05 col 69 value "Head of".
05 col 87 value "Taxing".
05 col 95 value "Pension".
05 col 107 value "Bank Account". >
03 line 7.
05 col 3 value "No.".
05 col 11 value "Name and Address".
05 col 43 value "Number".
05 col 56 value "Sex".
05 col 60 value "Married".
05 col 68 value "Household".
05 col 79 value "Status".
05 col 88 value "State".
05 col 96 value "Plan".
05 col 110 value "Number". >
03 line 9.
05 col 1 pic x(7) source Emp-No.
05 col 9 pic x(32) source Emp-Name.
05 col 41 pic x(11) source WS-SSN. > CHANGE - mod
frm ws-ssn9 rep / for - using ws-ssn
05 col 57 pic x source Emp-Sex.
05 col 63 pic x source Emp-Marital.
05 col 71 value "Yes" present when
Emp-Cal-Head-Of-House = "Y".
05 col 71 value "No" present when
Emp-Cal-Head-Of-House = "N". >
05 col 77 value "Active" present when
Emp-Status = "A".
05 col 77 value "Terminated" present when
Emp-Status = "T".
05 col 77 value "On-Leave" present when
Emp-Status = "L".
05 col 77 value "Deleted" present when
Emp-Status = "D". >
05 col 89 pic xx source PY-PR1-Co-State. >
Emp-Taxing-State$ NOT USED AT PRESENT << CHECK THIS !
05 col 97 value "No" present when
Emp-Pension-Used = "N".
05 col 97 value "Yes" present when
Emp-Pension-Used = "Y".
05 col 103 pic x(24) source Emp-Bank-Acct-No. >
03 line 10.
05 col 9 pic x(32) source Emp-Address-1. >
03 line 11.
05 col 9 pic x(32) source Emp-Address-2.
05 col 50 value "Date".
05 col 99 value "Rate".
05 col 108 value "Accumulated".
05 col 123 value "Used". >
03 line 12.
05 col 9 pic x(28) source Emp-Address-3. > fld = 32 ch
05 col 38 value "Birth".
05 col 48 pic 99/99/9999 source WS-Emp-Birth. > needs to
be converted ditto
05 col 59 value "Job Code:".
05 col 69 pic xxx source Emp-Job-Code.
05 col 83 value "Vacation".
05 col 93 pic zzz,zz9.99 source Emp-Vac-Rate.
05 col 105 pic zzz,zz9.99 source Emp-Vac-Accum.
05 col 117 pic zzz,zz9.99 source Emp-Vac-Used. >
03 line 13.
05 col 9 pic x(32) source Emp-Address-4. > fld = 32 ch
05 col 38 value "Start".
05 col 48 pic 99/99/9999 source WS-Start-Date. > Converted
05 col 59 value "Interval:".
05 col 69 value "Weekly" present when
Emp-Pay-Interval = "W".
05 col 69 value "Monthly" present when
Emp-Pay-Interval = "M".
05 col 69 value "Bi-Weekly" present when
Emp-Pay-Interval = "B".
05 col 69 value "Semi-Monthly" present when
Emp-Pay-Interval = "S".
05 col 83 value "Sick Leave".
05 col 93 pic zzz,zz9.99 source Emp-SL-Rate.
05 col 105 pic zzz,zz9.99 source Emp-SL-Accum.
05 col 117 pic zzz,zz9.99 source Emp-SL-Used. >
03 line 14.
05 col 9 pic xx source Emp-State.
05 col 12 pic x(10) source Emp-Zip.
05 col 38 value "Terminate".
05 col 48 pic 99/99/9999 source WS-Term-Date. > Converted
05 col 59 value "Pay Type:".
05 col 69 pic x(8) value "Hourly" present when
Emp-HS-Type = "H".
05 col 69 pic x(8) value "Salaried" present when
Emp-HS-Type = "S".
05 col 83 value "Comp Time".
05 col 105 pic zzz,zz9.99 source Emp-Comp-Accum.
05 col 117 pic zzz,zz9.99 source Emp-Comp-Used. >
03 line 15.
05 col 12 pic x(12) source WS-Phone-No. > converted
in Proc
05 col 59 value "Pay Frequency: ".
05 col 74 pic z9 source Emp-Pay-Freq. >
03 line 17.
05 col 48 value "Pay Rates".
05 col 101 value "FWT SWT LWT". >
03 line 18.
05 col 8 value "Current Apply No:".
05 col 26 pic z9 source Emp-Cur-Apply-No.
05 col 32 pic x(15) source PY-PR1-Rate-Name (1).
05 col 47 pic zzz,zz9.99 source Emp-Rate (1).
05 col 62 value "Number Of Witholding
Allowances:".
05 col 101 pic z9 source Emp-FWT-Allow.
05 col 106 pic z9 source Emp-SWT-Allow.
05 col 111 pic z9 source Emp-LWT-Allow. >
03 line 19.
05 col 32 pic x(15) source PY-PR1-Rate-Name (2).
05 col 47 pic zzz,zz9.99 source Emp-Rate (2).
05 col 62 value "Number Of Deduction
Allowances (Cal):".
05 col 106 pic z9 source Emp-Cal-Ded-Allow. >
03 line 20.
05 col 32 pic x(15) source PY-PR1-Rate-Name (3).
05 col 47 pic zzz,zz9.99 source Emp-Rate (3). >
03 line 21.
05 col 32 pic x(15) source PY-PR1-Rate-Name (4).
05 col 47 pic zzz,zz9.99 source Emp-Rate (4).
05 col 62 value "Tax Exemptions:".
05 col 79 pic x(50) source WS-Tax-Exemptions. *>
Set in P D. created by ::
> REM OBTAIN EXEMPTION STRING > exempt$ = null$ > if emp.fwt.exempt% then exempt$ = exempt$ + "FWT " > if emp.swt.exempt% then exempt$ = exempt$ + "SWT " > if emp.lwt.exempt% then exempt$ = exempt$ + "LWT " > if emp.fica.exempt% then exempt$ = exempt$ + "FICA " > if emp.sdi.exempt% then exempt$ = exempt$ + "SDI " > if emp.co.futa.exempt% then exempt$ = exempt$ + "FUTA " > if emp.co.sui.exempt% then exempt$ = exempt$ + "SUI " > for i% = 1 to pr1.max.sys.eds% > if emp.sys.exempt%(i%) \ > then exempt$ = exempt$ + "SYS" + str$(i%) + " "
*> next i%
03 line 22.
05 col 32 value "Maximum".
05 col 47 pic zzz,zz9.99 source Emp-Max-Pay.
05 col 62 value "Earned Income Credit: ".
05 col 84 value "Eligible" present when
Emp-Eic-Used = "Y".
05 col 84 value "Ineligible" present when
Emp-Eic-Used = "N". >
03 line 23. > print tab(62);pr1.rate.name$(4)+" EXCLUSION CODE: "+ \
*> str$(emp.rate4.exclusion%)
> 05 col 62 source PY-PR1-Rate-Name (4)+
value " EXCLUSION CODE: "+ > Emp-Rate4-Exclusion.
05 col 62 pic x(48) source WS-Exclusion-Code. >
03 line 24.
05 col 32 value "Auto Generated Units:".
05 col 53 pic zz9 source Emp-Auto-Units.
05 col 62 value "Normal Pay Units:".
05 col 81 pic zz9 source Emp-Normal-Units. >
03 line 25.
05 col 63 value "Employee Specific
Deductions".
03 line 26.
05 col 36 value "Description
Acct Factor "&
"Limit Xcld Chk Cat". > > This is present to 3 occurances but it 'could' be higher - may be ?
Emp record would need changes >
03 line 28.
05 col 22 value "Not" present when
Emp-ED-Chk-Cat (1) = zero.
05 col 26 value "Used".
05 col 31 value "1:".
05 col 34 pic x(15) source Emp-ED-Desc (1).
05 col 52 value "Earning" present when
Emp-ED-Earn-Ded (1) = "E".
05 col 52 value "Deduction" present when
Emp-ED-Earn-Ded (1) = "D".
05 col 64 pic zz9 source Emp-ED-Acct-No (1).
05 col 70 value "Amount" present when
Emp-ED-Amt-Pcent (1) = "A".
05 col 70 value "Percent" present when
Emp-ED-Amt-Pcent (1) not = "A".
05 col 78 pic zzz,zz9.99 source Emp-ED-Factor (1).
05 col 89 value "Limited" present when
Emp-ED-Limit-Used (1) = "Y".
05 col 89 value "No Limit" present when
Emp-ED-Limit-Used (1) = "N".
05 col 99 pic z,zzz,zz9.99 source Emp-ED-Limit (1).
05 col 113 pic 9 source Emp-ED-Exclusion (1).
05 col 117 pic z9 source Emp-ED-Chk-Cat (1).
03 line 29.
05 col 22 value "Not" present when
Emp-ED-Chk-Cat (2) = zero.
05 col 26 value "Used".
05 col 31 value "1:".
05 col 34 pic x(15) source Emp-ED-Desc (2).
05 col 52 value "Earning" present when
Emp-ED-Earn-Ded (2) = "E".
05 col 52 value "Deduction" present when
Emp-ED-Earn-Ded (2) = "D".
05 col 64 pic zz9 source Emp-ED-Acct-No (2).
05 col 70 value "Amount" present when
Emp-ED-Amt-Pcent (2) = "A".
05 col 70 value "Percent" present when
Emp-ED-Amt-Pcent (2) not = "A".
05 col 78 pic zzz,zz9.99 source Emp-ED-Factor (2).
05 col 89 value "Limited" present when
Emp-ED-Limit-Used (2) = "Y".
05 col 89 value "No Limit" present when
Emp-ED-Limit-Used (2) = "N".
05 col 99 pic z,zzz,zz9.99 source Emp-ED-Limit (2).
05 col 113 pic 9 source Emp-ED-Exclusion (2).
05 col 117 pic z9 source Emp-ED-Chk-Cat (2).
03 line 30.
05 col 22 value "Not" present when
Emp-ED-Chk-Cat (3) = zero.
05 col 26 value "Used".
05 col 31 value "1:".
05 col 34 pic x(15) source Emp-ED-Desc (3).
05 col 52 value "Earning" present when
Emp-ED-Earn-Ded (3) = "E".
05 col 52 value "Deduction" present when
Emp-ED-Earn-Ded (3) = "D".
05 col 64 pic zz9 source Emp-ED-Acct-No (3).
05 col 70 value "Amount" present when
Emp-ED-Amt-Pcent (3) = "A".
05 col 70 value "Percent" present when
Emp-ED-Amt-Pcent (3) not = "A".
05 col 78 pic zzz,zz9.99 source Emp-ED-Factor (3).
05 col 89 value "Limited" present when
Emp-ED-Limit-Used (3) = "Y".
05 col 89 value "No Limit" present when
Emp-ED-Limit-Used (3) = "N".
05 col 99 pic z,zzz,zz9.99 source Emp-ED-Limit (3).
05 col 113 pic 9 source Emp-ED-Exclusion (3).
05 col 117 pic z9 source Emp-ED-Chk-Cat (3). >
03 line 32.
05 col 63 value "Cost Distribution".
03 line 33.
05 col 50 value "Acct".
05 col 67 value "Name".
05 col 87 value "Percent". > > create act table for the possible 5 entries NEEDS CHANGES > > THIS IS A TEST FOR VARYING until ONLY produces same error without
the until.
03 line + 1 varying A from 1 by 1 until A >
PY-PR1-Max-Dist-Accts.
05 col 51 pic zzz9 source Emp-Dist-Acct (A) present
when Emp-Dist-Acct (A) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (A).
*>
03 line 35 present when
PY-PR1-Max-Dist-Accts > 0.
05 col 51 pic zzz9 source WS-Act Emp-Dist-Acct (1)
present when Emp-Dist-Acct (1) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (1).
03 line + 1 present when
PY-PR1-Max-Dist-Accts > 1.
05 col 51 pic zzz9 source Emp-Dist-Acct (2) present
when Emp-Dist-Acct (2) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (2).
03 line + 1 present when
PY-PR1-Max-Dist-Accts > 2.
05 col 51 pic zzz9 source Emp-Dist-Acct (3) present
when Emp-Dist-Acct (3) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (3).
03 line + 1 present when
PY-PR1-Max-Dist-Accts > 3.
05 col 51 pic zzz9 source Emp-Dist-Acct (4) present
when Emp-Dist-Acct (4) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (4).
03 line + 1 present when
PY-PR1-Max-Dist-Accts > 4.
05 col 51 pic zzz9 source Emp-Dist-Acct (5) present
when Emp-Dist-Acct (5) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (5).
So you can see it would not be that easy and is in any event a long
drawn out process :(
Vince
On 30/01/2026 02:40, Chuck Haatvedt wrote:
Vince have you tried using something like the following
Method 2: Single Detail Line with Loop
Use a single detail line definition and loop through subscripts:
such as process will only work on a simple RD area but as I use a lot of line reporting amny with the same issues I think it would be difficult to implement.
Of course option two is to do it the old way via PD and print file layouts etc.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
what changes would be needed to the codegen process to support the cobol code as written ?
Fast
To support the COBOL Report Writer LINE OCCURS ... VARYING ... VARYING ... as written, codegen needs to iterate the parsed report_vary_list and emit nested C loops at GENERATE time, while integrating with existing report field emission and runtime initialization. Here’s what’s required and where to make the changes.
High-level required changes
In cobc/codegen.c, add a function to emit VARYING loops, called from the report GENERATE path.
Iterate f->report_vary_list on the LINE field; for each entry emit a C for loop using the FROM/BY values stored in the AST tree.h:900-935 .
Ensure step_count is applied for STEP clauses on nested OCCURS fields tree.h:935 .
Integrate with existing report emission
Reuse output_emit_field to emit cob_field structures for each column within the loops codegen.c:2342-2394 .
At GENERATE, emit calls to runtime report functions (e.g., cob_report_generate) inside the generated loops.
Ensure INITIATE/TERMINATE setup remains unchanged (see report init emission in codegen.c) codegen.c:4125-4201 .
Validation and error handling
During codegen, validate that each VARYING variable is integer-typed; otherwise emit code that raises EC-REPORT-VARYING exception.def:532-534 .
Preserve the existing -Wpending warning until the feature is complete.
Testing
Add a test case in tests/testsuite.src/run_reportwriter.at using the user’s pattern to ensure nested VARYING loops generate the expected output.
I am trying to use RWCS but get issues where the VARYING clause is not implemented which forces me to add a lot of extra coding lines.
Any one know if Ron Norman is still around and if so :-
@rjnorman74
Any change of fixing the missing VARYING clause ?
I have to admit my use of RWCS is weak because for almost all of the sites I worked at this was an extra charge faciltiy and they did not want to pay any more :(
It is only on old m/f kit from ICL that I used it as against IBM, Honeywell, Burroughs, Dec, Univax etc, etc.
I now am using it for a very old Payroll (USA) application that I have decided to rewrite it into Cobol from CBasic usibng RW in the hope it will cut down coding - but fo far not so much :(
And no, I am based in the UK so I am strongly using the old code base for payroll proceses and procedures etc. with the intention of adding it into my Open Source ACAS Accounting systems.
At almost 79 - I need something to occupy my mind etc.
CBasic, that is going back.
In my experience, I have never encountered any shop using Report Writer.
Control break programming is generally used.
Report Writer is generally easy to use but time consuming to setup.
And requires good knowledge of it's features
It would probably would have been easier to convert the code to use control break's.
Secondly, no one uses fixed font line printers any more.
The data is used as input to other programs, such as spreadsheet's or programs that create PDF's.
Hi;
On 07/02/2026 16:28, appletonc wrote:
True but so do I.
A lot of my code does not make use of RW at least for the rest of my
ACAS application but as I started coding Payroll I decided to use it as
it does keep the PD area light weight and yes it does seem to create a
lot more coding in the RD areas but what you loose from PD it make up
for in RD but it is easier to read should the need arise to do so some
months later.
Well I have a reasonable knowledge of it but it does go back a long time
This was mostly m/f and not ever shop bought the RW modules from what
ever 3rd party supplier was supplying it. Not so many Cobol compilers
had it inbuilt.
However MF compilers did do so but these days it is far too rich for my
wallet at least now I? have made all the code O/S.
I have a Linux script that runs Enscript to convert a text file as
created by any program for its reporting to a pdf that can be printed or
just read as user needs it.
After the print file is closed I have a internal script that runs lpr
with various settings depending on if report is < 85 chars or 120 or
greater.
This gets issued after file closed and before program terminates.
There is not a lot of scope using GnuCobol any way.
For example using ACCEPT verb with numbers such as money it is extremely
basic with no editing capability so I am forced to try using Chucks
accept_numeric routine as it acts like a calculator for input. This has
been a major problem since the early days of v0.33
Can you please give a minimal example that doesn't but should work?
Also: have you tried that with GC4 (not sure but there are possibly unmerged RW changes if they happened after 3.1).
No only v3.2 and for example the lines :
The sub clause was in containing until ... but had same error so kept it simple but not logical as will not work as need a stop after 5 etc.
As it is had to do the same text for all occurrences of the data.
I.E.,
My experiments with v3.3 falls in various places so sticking to v3.2 and as v4 is very alpha I am keeping well away from it and no do not remember what was wrong with v3.3 but did also play with a special version of it from Chuck.
I need the programs to work !
The above code is my attempt to convert a old cbasic application of Payroll for the USA. IT give me some thing to do which I consider wise as I am 79 in June.
Vince
Last edit: Simon Sobisch 2026-01-28
again: if you provide a minimal, complete example, then I can ensure that it works, ideally by including it in the testsuite - otherwise its just "something doesn't work as you expected" but I'm not 100% sure what and can't test it.
Also: if there are any "failing experiments" with 3.3 - please say exactly which, as the RC1 is now planned for February (not sure that I'll make it, but still).
That will take far too long to edit for but here is a edited copy of the .prn file to use as input.
There are some errors for fileds missing - thats ok I took the code from another simlar program but have not got to that point yet for changing the code.
compile as cobc -m empprint.pro -T empprint.prn
Then look at lines at bottom showing :
empprint.pro:1686: warning: RW VARYING clause is not implemented
empprint.pro:1686: error: A is not valid for VARYING
In this instance I remarked out the "until A > PY-PR1-Max-Dist-Accts." to keep it simplier
Vince have you tried using something like the following
Method 2: Single Detail Line with Loop
Use a single detail line definition and loop through subscripts:
01 DEPT-TOTAL TYPE DETAIL LINE PLUS 2.
03 COLUMN 05 PIC 9(02) SOURCE DE-NUMBER (SUB-IX).
03 COLUMN 08 PIC X(15) SOURCE DE-NAME (SUB-IX).
03 COLUMN 38 PIC $$,$$9.99 SOURCE DE-GROSS (SUB-IX).
Then in procedure division:
PERFORM VARYING SUB-IX FROM 1 BY 1 UNTIL SUB-IX > MAX-DEPTS
GENERATE DEPT-TOTAL
END-PERFORM
ps... I got this suggestion form the https://deepwiki.com/ website by searching for the gnucobol repository and then asking a question
Chuck Haatvedt
I gave but a small element for what I had tried to do but the code is a
lot more for example here is the real coding that includes the problem
areas : (Warning it s along block)
RD Employee-Master-Report
control Final
Page Limit WS-Page-Lines
Heading 1
First Detail 5
Last Detail WS-Page-Lines.
>
> Print layouts to 132 cols Landscape
>
01 Report-Emp-Head Type is Page Heading.
03 line 1.
05 col 50 pic x(40) source UserA.
05 col 110 pic x(10) source WS-Date. > IS this
correct format ? Check report
05 col 122 pic x(8) source WSD-Time.
03 line 2.
05 col 1 pic x(17) source Prog-Name.
05 col 51 pic x(19) value "ACAS Payroll System".
05 col 124 pic x(5) value "Page ".
05 col 129 pic zz9 source Page-Counter.
03 Line 3.
05 col 53 pic x(53) value "Employee Master Report".
03 line 4.
05 col 61 pic x(20) source WS-RS-Title.
>
01 Employee-Report-Foot Type Report Footing.
03 line + 2.
05 col 5 pic x(22) value "Total Records printed ".
05 col 28 pic zzz9 source WS-Rec-Cnt.
>
01 Employee-Detail type is detail. > ALL to be CHANGED
03 line 6.
05 col 39 value "Social Security".
05 col 69 value "Head of".
05 col 87 value "Taxing".
05 col 95 value "Pension".
05 col 107 value "Bank Account".
>
03 line 7.
05 col 3 value "No.".
05 col 11 value "Name and Address".
05 col 43 value "Number".
05 col 56 value "Sex".
05 col 60 value "Married".
05 col 68 value "Household".
05 col 79 value "Status".
05 col 88 value "State".
05 col 96 value "Plan".
05 col 110 value "Number".
>
03 line 9.
05 col 1 pic x(7) source Emp-No.
05 col 9 pic x(32) source Emp-Name.
05 col 41 pic x(11) source WS-SSN. > CHANGE - mod
frm ws-ssn9 rep / for - using ws-ssn
05 col 57 pic x source Emp-Sex.
05 col 63 pic x source Emp-Marital.
05 col 71 value "Yes" present when
Emp-Cal-Head-Of-House = "Y".
05 col 71 value "No" present when
Emp-Cal-Head-Of-House = "N".
>
05 col 77 value "Active" present when
Emp-Status = "A".
05 col 77 value "Terminated" present when
Emp-Status = "T".
05 col 77 value "On-Leave" present when
Emp-Status = "L".
05 col 77 value "Deleted" present when
Emp-Status = "D".
>
05 col 89 pic xx source PY-PR1-Co-State. >
Emp-Taxing-State$ NOT USED AT PRESENT << CHECK THIS !
05 col 97 value "No" present when
Emp-Pension-Used = "N".
05 col 97 value "Yes" present when
Emp-Pension-Used = "Y".
05 col 103 pic x(24) source Emp-Bank-Acct-No.
>
03 line 10.
05 col 9 pic x(32) source Emp-Address-1.
>
03 line 11.
05 col 9 pic x(32) source Emp-Address-2.
05 col 50 value "Date".
05 col 99 value "Rate".
05 col 108 value "Accumulated".
05 col 123 value "Used".
>
03 line 12.
05 col 9 pic x(28) source Emp-Address-3. > fld = 32 ch
05 col 38 value "Birth".
05 col 48 pic 99/99/9999 source WS-Emp-Birth. > needs to
be converted ditto
05 col 59 value "Job Code:".
05 col 69 pic xxx source Emp-Job-Code.
05 col 83 value "Vacation".
05 col 93 pic zzz,zz9.99 source Emp-Vac-Rate.
05 col 105 pic zzz,zz9.99 source Emp-Vac-Accum.
05 col 117 pic zzz,zz9.99 source Emp-Vac-Used.
>
03 line 13.
05 col 9 pic x(32) source Emp-Address-4. > fld = 32 ch
05 col 38 value "Start".
05 col 48 pic 99/99/9999 source WS-Start-Date. > Converted
05 col 59 value "Interval:".
05 col 69 value "Weekly" present when
Emp-Pay-Interval = "W".
05 col 69 value "Monthly" present when
Emp-Pay-Interval = "M".
05 col 69 value "Bi-Weekly" present when
Emp-Pay-Interval = "B".
05 col 69 value "Semi-Monthly" present when
Emp-Pay-Interval = "S".
05 col 83 value "Sick Leave".
05 col 93 pic zzz,zz9.99 source Emp-SL-Rate.
05 col 105 pic zzz,zz9.99 source Emp-SL-Accum.
05 col 117 pic zzz,zz9.99 source Emp-SL-Used.
>
03 line 14.
05 col 9 pic xx source Emp-State.
05 col 12 pic x(10) source Emp-Zip.
05 col 38 value "Terminate".
05 col 48 pic 99/99/9999 source WS-Term-Date. > Converted
05 col 59 value "Pay Type:".
05 col 69 pic x(8) value "Hourly" present when
Emp-HS-Type = "H".
05 col 69 pic x(8) value "Salaried" present when
Emp-HS-Type = "S".
05 col 83 value "Comp Time".
05 col 105 pic zzz,zz9.99 source Emp-Comp-Accum.
05 col 117 pic zzz,zz9.99 source Emp-Comp-Used.
>
03 line 15.
05 col 12 pic x(12) source WS-Phone-No. > converted
in Proc
05 col 59 value "Pay Frequency: ".
05 col 74 pic z9 source Emp-Pay-Freq.
>
03 line 17.
05 col 48 value "Pay Rates".
05 col 101 value "FWT SWT LWT".
>
03 line 18.
05 col 8 value "Current Apply No:".
05 col 26 pic z9 source Emp-Cur-Apply-No.
05 col 32 pic x(15) source PY-PR1-Rate-Name (1).
05 col 47 pic zzz,zz9.99 source Emp-Rate (1).
05 col 62 value "Number Of Witholding
Allowances:".
05 col 101 pic z9 source Emp-FWT-Allow.
05 col 106 pic z9 source Emp-SWT-Allow.
05 col 111 pic z9 source Emp-LWT-Allow.
>
03 line 19.
05 col 32 pic x(15) source PY-PR1-Rate-Name (2).
05 col 47 pic zzz,zz9.99 source Emp-Rate (2).
05 col 62 value "Number Of Deduction
Allowances (Cal):".
05 col 106 pic z9 source Emp-Cal-Ded-Allow.
>
03 line 20.
05 col 32 pic x(15) source PY-PR1-Rate-Name (3).
05 col 47 pic zzz,zz9.99 source Emp-Rate (3).
>
03 line 21.
05 col 32 pic x(15) source PY-PR1-Rate-Name (4).
05 col 47 pic zzz,zz9.99 source Emp-Rate (4).
05 col 62 value "Tax Exemptions:".
05 col 79 pic x(50) source WS-Tax-Exemptions. *>
Set in P D. created by ::
> REM OBTAIN EXEMPTION STRING
> exempt$ = null$
> if emp.fwt.exempt% then exempt$ = exempt$ + "FWT "
> if emp.swt.exempt% then exempt$ = exempt$ + "SWT "
> if emp.lwt.exempt% then exempt$ = exempt$ + "LWT "
> if emp.fica.exempt% then exempt$ = exempt$ + "FICA "
> if emp.sdi.exempt% then exempt$ = exempt$ + "SDI "
> if emp.co.futa.exempt% then exempt$ = exempt$ + "FUTA "
> if emp.co.sui.exempt% then exempt$ = exempt$ + "SUI "
> for i% = 1 to pr1.max.sys.eds%
> if emp.sys.exempt%(i%) \
> then exempt$ = exempt$ + "SYS" + str$(i%) + " "
*> next i%
03 line 22.
05 col 32 value "Maximum".
05 col 47 pic zzz,zz9.99 source Emp-Max-Pay.
05 col 62 value "Earned Income Credit: ".
05 col 84 value "Eligible" present when
Emp-Eic-Used = "Y".
05 col 84 value "Ineligible" present when
Emp-Eic-Used = "N".
>
03 line 23.
> print tab(62);pr1.rate.name$(4)+" EXCLUSION CODE: "+ \
*> str$(emp.rate4.exclusion%)
> 05 col 62 source PY-PR1-Rate-Name (4)+
value " EXCLUSION CODE: "+
> Emp-Rate4-Exclusion.
05 col 62 pic x(48) source WS-Exclusion-Code.
>
03 line 24.
05 col 32 value "Auto Generated Units:".
05 col 53 pic zz9 source Emp-Auto-Units.
05 col 62 value "Normal Pay Units:".
05 col 81 pic zz9 source Emp-Normal-Units.
>
03 line 25.
05 col 63 value "Employee Specific
Deductions".
03 line 26.
05 col 36 value "Description
Acct Factor "&
"Limit Xcld Chk Cat".
>
> This is present to 3 occurances but it 'could' be higher - may be ?
Emp record would need changes
>
03 line 28.
05 col 22 value "Not" present when
Emp-ED-Chk-Cat (1) = zero.
05 col 26 value "Used".
05 col 31 value "1:".
05 col 34 pic x(15) source Emp-ED-Desc (1).
05 col 52 value "Earning" present when
Emp-ED-Earn-Ded (1) = "E".
05 col 52 value "Deduction" present when
Emp-ED-Earn-Ded (1) = "D".
05 col 64 pic zz9 source Emp-ED-Acct-No (1).
05 col 70 value "Amount" present when
Emp-ED-Amt-Pcent (1) = "A".
05 col 70 value "Percent" present when
Emp-ED-Amt-Pcent (1) not = "A".
05 col 78 pic zzz,zz9.99 source Emp-ED-Factor (1).
05 col 89 value "Limited" present when
Emp-ED-Limit-Used (1) = "Y".
05 col 89 value "No Limit" present when
Emp-ED-Limit-Used (1) = "N".
05 col 99 pic z,zzz,zz9.99 source Emp-ED-Limit (1).
05 col 113 pic 9 source Emp-ED-Exclusion (1).
05 col 117 pic z9 source Emp-ED-Chk-Cat (1).
03 line 29.
05 col 22 value "Not" present when
Emp-ED-Chk-Cat (2) = zero.
05 col 26 value "Used".
05 col 31 value "1:".
05 col 34 pic x(15) source Emp-ED-Desc (2).
05 col 52 value "Earning" present when
Emp-ED-Earn-Ded (2) = "E".
05 col 52 value "Deduction" present when
Emp-ED-Earn-Ded (2) = "D".
05 col 64 pic zz9 source Emp-ED-Acct-No (2).
05 col 70 value "Amount" present when
Emp-ED-Amt-Pcent (2) = "A".
05 col 70 value "Percent" present when
Emp-ED-Amt-Pcent (2) not = "A".
05 col 78 pic zzz,zz9.99 source Emp-ED-Factor (2).
05 col 89 value "Limited" present when
Emp-ED-Limit-Used (2) = "Y".
05 col 89 value "No Limit" present when
Emp-ED-Limit-Used (2) = "N".
05 col 99 pic z,zzz,zz9.99 source Emp-ED-Limit (2).
05 col 113 pic 9 source Emp-ED-Exclusion (2).
05 col 117 pic z9 source Emp-ED-Chk-Cat (2).
03 line 30.
05 col 22 value "Not" present when
Emp-ED-Chk-Cat (3) = zero.
05 col 26 value "Used".
05 col 31 value "1:".
05 col 34 pic x(15) source Emp-ED-Desc (3).
05 col 52 value "Earning" present when
Emp-ED-Earn-Ded (3) = "E".
05 col 52 value "Deduction" present when
Emp-ED-Earn-Ded (3) = "D".
05 col 64 pic zz9 source Emp-ED-Acct-No (3).
05 col 70 value "Amount" present when
Emp-ED-Amt-Pcent (3) = "A".
05 col 70 value "Percent" present when
Emp-ED-Amt-Pcent (3) not = "A".
05 col 78 pic zzz,zz9.99 source Emp-ED-Factor (3).
05 col 89 value "Limited" present when
Emp-ED-Limit-Used (3) = "Y".
05 col 89 value "No Limit" present when
Emp-ED-Limit-Used (3) = "N".
05 col 99 pic z,zzz,zz9.99 source Emp-ED-Limit (3).
05 col 113 pic 9 source Emp-ED-Exclusion (3).
05 col 117 pic z9 source Emp-ED-Chk-Cat (3).
>
03 line 32.
05 col 63 value "Cost Distribution".
03 line 33.
05 col 50 value "Acct".
05 col 67 value "Name".
05 col 87 value "Percent".
>
> create act table for the possible 5 entries NEEDS CHANGES
>
> THIS IS A TEST FOR VARYING until ONLY produces same error without
the until.
03 line + 1 varying A from 1 by 1 until A >
PY-PR1-Max-Dist-Accts.
05 col 51 pic zzz9 source Emp-Dist-Acct (A) present
when Emp-Dist-Acct (A) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (A).
*>
03 line 35 present when
PY-PR1-Max-Dist-Accts > 0.
05 col 51 pic zzz9 source WS-Act Emp-Dist-Acct (1)
present when Emp-Dist-Acct (1) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (1).
03 line + 1 present when
PY-PR1-Max-Dist-Accts > 1.
05 col 51 pic zzz9 source Emp-Dist-Acct (2) present
when Emp-Dist-Acct (2) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (2).
03 line + 1 present when
PY-PR1-Max-Dist-Accts > 2.
05 col 51 pic zzz9 source Emp-Dist-Acct (3) present
when Emp-Dist-Acct (3) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (3).
03 line + 1 present when
PY-PR1-Max-Dist-Accts > 3.
05 col 51 pic zzz9 source Emp-Dist-Acct (4) present
when Emp-Dist-Acct (4) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (4).
03 line + 1 present when
PY-PR1-Max-Dist-Accts > 4.
05 col 51 pic zzz9 source Emp-Dist-Acct (5) present
when Emp-Dist-Acct (5) not = zero.
05 col 56 pic x(24) source Act-Desc .
05 col 87 pic zz9.99 source Emp-Dist-Pcent (5).
So you can see it would not be that easy and is in any event a long
drawn out process :(
Vince
On 30/01/2026 02:40, Chuck Haatvedt wrote:
such as process will only work on a simple RD area but as I use a lot of line reporting amny with the same issues I think it would be difficult to implement.
Of course option two is to do it the old way via PD and print file layouts etc.
the following example is from the IBM Report Writer PDF at the following link
https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://publibfp.dhe.ibm.com/epubs/pdf/c2643014.pdf&ved=2ahUKEwihodnjosiSAxUBj4kEHUz9NakQFnoECB8QAQ&usg=AOvVaw1MZ0sDCBqmg-zXr7vQSeoq
According to deepwiki.com gnucobol does not currently support varying in the report section.
Deepwiki does suggest changes to support this program but I'm not sure if this would meet Vince's needs.
from deepwiki.com
what changes would be needed to the codegen process to support the cobol code as written ?
Fast
To support the COBOL Report Writer LINE OCCURS ... VARYING ... VARYING ... as written, codegen needs to iterate the parsed report_vary_list and emit nested C loops at GENERATE time, while integrating with existing report field emission and runtime initialization. Here’s what’s required and where to make the changes.
High-level required changes
Where to implement
Extend codegen to walk report_vary_list
In cobc/codegen.c, add a function to emit VARYING loops, called from the report GENERATE path.
Iterate f->report_vary_list on the LINE field; for each entry emit a C for loop using the FROM/BY values stored in the AST tree.h:900-935 .
Ensure step_count is applied for STEP clauses on nested OCCURS fields tree.h:935 .
Integrate with existing report emission
Reuse output_emit_field to emit cob_field structures for each column within the loops codegen.c:2342-2394 .
At GENERATE, emit calls to runtime report functions (e.g., cob_report_generate) inside the generated loops.
Ensure INITIATE/TERMINATE setup remains unchanged (see report init emission in codegen.c) codegen.c:4125-4201 .
Validation and error handling
During codegen, validate that each VARYING variable is integer-typed; otherwise emit code that raises EC-REPORT-VARYING exception.def:532-534 .
Preserve the existing -Wpending warning until the feature is complete.
Testing
Add a test case in tests/testsuite.src/run_reportwriter.at using the user’s pattern to ensure nested VARYING loops generate the expected output.
Why this works with existing infrastructure
Notes