1

I am trying to get the customers last name, first name - dob, I am getting all but everything printing the same place, any idea?

         declare n_curs cursor for
              select unique pin,surname,given1,given2,dob from crcharge where
              chargenum in (select chargenum from crbookdd where book_no = rpt.book_no)
         order by surname,given1

            print ESC, "&l4E"

      foreach n_curs into t_pin, t_surname, t_given1, t_given2, t_dob
          if kick_new then
            print column 1, ESC, "&a0G", ESC, "&l3O", ESC, "&f4y3X",
                            ESC, "&l8D",ESC, "&l4E"
         end if
           let shtwrd_count = 0
        if shtwrd_count > 6 then
            let shtwrd[shtwrd_count] = t_shtwrd
            let shtwrd_count = shtwrd_count + 1
      Exit foreach
        end if
           print
           print  ESC,"&a6R", ESC, "&a3C",
                  upshift(t_surname) clipped, ",",
                  updown(t_given1) clipped," " ,
                  updown(t_given2) clipped,"-", t_dob clipped;

       end foreach
MJJ3
  • 127
  • 1
  • 12

2 Answers2

1

Because your escape sequence is suppressing the LF (Line Feed) after the CR (Carriage return).

Joe R.
  • 2,032
  • 4
  • 36
  • 72
1

The semi-colon after the PRINT statement means 'suppress newline'. The next PRINT statement continues on the same line, therefore. Very useful when that's the effect you want; otherwise, not good.

Separately, as some advice, you should parameterize the escape sequences. If you don't, then life will become really difficult when you need to change printer or terminal type. Create functions which name the effect and return the correct string:

FUNCTION extra_bold()
    RETURN ESC, "&a6R"   -- Or whatever
END FUNCTION

Then use them:

PRINT extra_bold(), info.field
Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278