• Print statements not appearing

    From Ed Morton@21:1/5 to solitary....@gmail.com on Mon Feb 8 17:34:24 2021
    On 2/8/2021 4:04 PM, solitary....@gmail.com wrote:
    I use GNU Awk 5.0.0, API: 2.0 (GNU MPFR 4.1.0, GNU MP 6.2.0) on Windows 10 Home.

    I frequently use "print" and "print 1/zero" statements for debugging and for the first time in recent memory the print statements are apparently not executing.

    I have yet to figure out why this is not working now.

    Any suggestions would be appreciated.

    Thanks, Steve


    You'll have to provide a MINIMAL, complete awk script that exhibits that behavior for us to be able to help you debug it.

    Ed.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From solitary.wanderer52@gmail.com@21:1/5 to Ed Morton on Mon Feb 8 16:03:48 2021
    On Monday, February 8, 2021 at 3:34:26 PM UTC-8, Ed Morton wrote:
    On 2/8/2021 4:04 PM, xxx wrote:
    I use GNU Awk 5.0.0, API: 2.0 (GNU MPFR 4.1.0, GNU MP 6.2.0) on Windows 10 Home.

    I frequently use "print" and "print 1/zero" statements for debugging and for the first time in recent memory the print statements are apparently not executing.

    I have yet to figure out why this is not working now.

    Any suggestions would be appreciated.

    Thanks, Steve

    You'll have to provide a MINIMAL, complete awk script that exhibits that behavior for us to be able to help you debug it.

    Ed.

    Thank you for the offer, Ed.

    It errored out with a divide by 0 error on line 31 and none of the preceding print statements were executed:

    1 # Produce cumulative csv report with ClassName, RecordTypeId, and diffs for each week
    2 #
    3 # awk -F, -f make-cumulative-report.awk VX130vsVDI*.csv > cumulative-report-VX130vsVDI_through_20210109.csv
    4
    5 function compareDiffs(line, arr, count, counts, diffs, k, max, mim, n, numPieces) {
    6 print "2: " line;
    7 n = split(line,arr,",");
    8 numPieces = 2 + n + 1;
    9 for (k = 1; k <= 5; k++) {
    10 diffs[k] = arr[numPieces - k];
    11 print "diffs[" k "] = " diffs[k];
    12 counts[diffs[k]]++
    13 print "counts[" diffs[k] "] = " counts[diffs[k]]
    14 }
    15 if (counts[0] == 5) {
    16 rslt = "All zeroes"
    17 }
    18 else {
    19 if ((diffs[1] == diffs[2]) && (diffs[2] = diffs[3]) && (diffs[3] == diffs[4]) && (diffs[4] == diffs[5])) {
    20 rslt = "All same"
    21 }
    22 else {
    23 rslt = findRange(10);
    24 if (rslt == "") {
    25 rslt = findRange(50)
    26 }
    27 }
    28 }
    29 print "rslt = " rslt;
    30 zero = 0;
    31 print 1/0
    32
    33 return rslt
    34 }


    I rewrote it and now it seems fine.


    Steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ed Morton@21:1/5 to solitary....@gmail.com on Mon Feb 8 18:18:47 2021
    On 2/8/2021 6:03 PM, solitary....@gmail.com wrote:
    On Monday, February 8, 2021 at 3:34:26 PM UTC-8, Ed Morton wrote:
    On 2/8/2021 4:04 PM, xxx wrote:
    I use GNU Awk 5.0.0, API: 2.0 (GNU MPFR 4.1.0, GNU MP 6.2.0) on Windows 10 Home.

    I frequently use "print" and "print 1/zero" statements for debugging and for the first time in recent memory the print statements are apparently not executing.

    I have yet to figure out why this is not working now.

    Any suggestions would be appreciated.

    Thanks, Steve

    You'll have to provide a MINIMAL, complete awk script that exhibits that
    behavior for us to be able to help you debug it.

    Ed.

    Thank you for the offer, Ed.

    It errored out with a divide by 0 error on line 31 and none of the preceding print statements were executed:

    1 # Produce cumulative csv report with ClassName, RecordTypeId, and diffs for each week
    2 #
    3 # awk -F, -f make-cumulative-report.awk VX130vsVDI*.csv > cumulative-report-VX130vsVDI_through_20210109.csv
    4
    5 function compareDiffs(line, arr, count, counts, diffs, k, max, mim, n, numPieces) {
    6 print "2: " line;
    7 n = split(line,arr,",");
    8 numPieces = 2 + n + 1;
    9 for (k = 1; k <= 5; k++) {
    10 diffs[k] = arr[numPieces - k];
    11 print "diffs[" k "] = " diffs[k];
    12 counts[diffs[k]]++
    13 print "counts[" diffs[k] "] = " counts[diffs[k]]
    14 }
    15 if (counts[0] == 5) {
    16 rslt = "All zeroes"
    17 }
    18 else {
    19 if ((diffs[1] == diffs[2]) && (diffs[2] = diffs[3]) && (diffs[3] == diffs[4]) && (diffs[4] == diffs[5])) {
    20 rslt = "All same"
    21 }
    22 else {
    23 rslt = findRange(10);
    24 if (rslt == "") {
    25 rslt = findRange(50)
    26 }
    27 }
    28 }
    29 print "rslt = " rslt;
    30 zero = 0;
    31 print 1/0
    32
    33 return rslt
    34 }


    I rewrote it and now it seems fine.


    Steve


    That is not a **MINIMAL** script, nor is it even a complete script as
    it's just a standalone function. You should be able to reproduce this
    issue with a script that's less than 10 lines long and chances are by
    creating that minimal example you'll solve the problem yourself.

    Ed.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From solitary.wanderer52@gmail.com@21:1/5 to All on Mon Feb 8 14:04:24 2021
    I use GNU Awk 5.0.0, API: 2.0 (GNU MPFR 4.1.0, GNU MP 6.2.0) on Windows 10 Home.

    I frequently use "print" and "print 1/zero" statements for debugging and for the first time in recent memory the print statements are apparently not executing.

    I have yet to figure out why this is not working now.

    Any suggestions would be appreciated.

    Thanks, Steve

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)