USPS Barcode Printing with Visual COBOL

In RM-COBOL Liant\MicroFocus gave us a program to Print USPS Barcodes.  (I have attached it to this question).  Is there a way to do this with Visual COBOL?

I have been trying to compile the program with the RM Directive AND nestcall - but I keep getting errors on routines like the one below.  The error is it doesn't like the "count of bit-value".

               set cbt-char to char-inx
               perform varying cbt-bit from 1 by 1
                         until cbt-bit > count of bit-value
                   call "C$LogicalAnd" using bit-value (cbt-char, cbt-bit), test-result
                   call "C$LogicalShiftRight" using test-result
               end-perform

bit-value is defined as

       01  character-bit-table binary(1).
           02  occurs 10 indexed by cbt-char.
               03  bit-value pic 9 occurs 13 indexed by cbt-bit.
               *> note: LSB is bit-value (n, 1)
               *>       USB is bit-value (n, 13)

Here is the link to the RM-COBOL Page about printing USPS Barcodes

https://community.microfocus.com/cobol/rmcobol/w/wikiid-123/32259/generating-usps-intelligent-mail-barcode

  • I am not familiar with the COUNT OF special register and I cannot find it documented even in the RM documentation but it appears that it simply substitutes the value of the highest occurs level for the specified data item.  In this case I believe you could simply substitute the numeric literal 13 for count-of-bit-value. 

               set cbt-char to char-inx
               perform varying cbt-bit from 1 by 1
                  until cbt-bit > 13
                  call "C$LogicalAnd" using bit-value (cbt-char, cbt-bit), test-result
                  call "C$LogicalShiftRight" using test-result
               end-perform
               goback.

    The sample program referenced in the article to which your link points appears to be missing as an attachment.

  • Whoops! Sorry about that - I thought I had attached it - here is the program and the copybooks.

    USPS BARCODE Program.zip

  • The changing of the count of to the number worked! Thanks!

    I'm getting errors now on the C$CARG - and the documentation tells me to change those to C$DARG.

    BUT my code is not Native so that won't work...

  • If you are compiling to managed .NET code then it appears that this routine is not supported. In your program it looks like it may be using this routine to get the length of certain parameters. Instead of using this routine you may try using the LENGTH OF special register to accomplish the same thing?

    Example:

    move length of mailer-identifier to mailer-identifier-length