HP3000-L Archives

December 1997, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Gary L. Biggs" <[log in to unmask]>
Reply To:
Gary L. Biggs
Date:
Thu, 18 Dec 1997 18:25:02 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (157 lines)
Mark, I don't know if this will help or not but:

1) Subfiles are not limited to the page width, you may be able to generate
a fixed record length file by reporting your items to a subfile.

2) If you are going to a PC Application, You can us a comma delimited format
and some tricky compression and get away with a whole lot. Here is a sample
COMMAEXT report that I occasionally use for this type of work.


------------------------------------------------------------------------------
;Dumps Patron data to a self-describing, comma delimited
;file for importing to a PC Application

;Each field is described in the initial header and
;the data in each field is protected by embedding
;in quotes.

;The pack function is used to compress data so that as many
;fields as possible can be transferred. The fields in this
;file were chosen to be the most useful for importing to
;other applications. In rare cases (approx. .1%) the data
;being transferred will be slightly truncated due to the
;256 byte limit imposed by QUIZ on report width.

;If you need to add fields to the output add your most
;important field to the packed output first. If you
;do exceed the size of the 255 byte buffer, your
;data will still be intact up to the 255th char.

set database pactdbe

sql declare desired_patrons cursor for &
    select patron_number, name, first_name, middle_name, last_name, &
           long_suffix, long_salutation, company_name, title, &
           address_1, address_2, address_3, city, state, zip, &
           zip_plus_4, mail_add_type, patron_type, patron_status, &
           carrier_route, carrier_route_id, address_date, &
           h_area_code, h_phone_number, h_extension, &
           b_area_code, b_phone_number, b_extension, &
           address_info_ok, last_yr_subscr , last_yr_single, &
           last_yr_donated, last_cont_date, misc_area, date_added, &
           maint_date &
      from desktop.patrons &
     order by name

access desired_patrons

select if address_info_ok <> " " and patron_status = "A" and &
          address_1 <> " "

define delimiter character*3= '","'

define plus_4 character*4 = zip_plus_4[6:4]

define formatted_zip character *10 = zip + "-" + plus_4 &
                                     if zip < "A" and plus_4 > "-" &
                                else zip_plus_4

define company_name_x character*40 = &
       company_name if patron_type = 'I'and &
                       mail_add_type = 'B' &
  else name if mail_add_type = 'B'

define title_x character*40 = title if mail_add_type = 'B'

define phone_number character*10 = right justify(pack(ascii(b_area_code) +  &

ascii(b_phone_number))) &
                                   if mail_add_type = "B" &
                            else   right justify(pack(ascii(h_area_code) +  &
                                        ascii(h_phone_number)))

define header character*255 = pack('patron_number,' + &
                                   'patron_type,' + &
                                   'first_name,'  + &
                                   'middle_name,'  + &
                                   'last_name,'  + &
                                   'long_suffix,'  + &
                                   'long_salutation,' + &
                                   'address_type,' + &
                                   'title,'  + &
                                   'company_name,' + &
                                   'address_1,' + &
                                   'address_2,' + &
                                   'address_3,' + &
                                   'city,'  + &
                                   'state,' + &
                                   'zip,' + &
                                   'phone,'  + &
                                   'last_yr_subscr,' + &
                                   'last_yr_single,' + &
                                   'last_yr_donated,' + &
                                   'last_cont_date,'  + &
                                   'misc_area,'  + &
                                   'maint_date,')

define buffer character*255 = pack('"'+patron_number + delimiter + &
                                   truncate(patron_type) + delimiter + &
                                   truncate(first_name) + delimiter + &
                                   truncate(middle_name) + delimiter + &
                                   truncate(last_name) + delimiter + &
                                   truncate(long_suffix) + delimiter + &
                                   truncate(long_salutation) + delimiter + &
                                   truncate(mail_add_type) + delimiter + &
                                   truncate(title_x) + delimiter + &
                                   truncate(company_name_x) + delimiter + &
                                   truncate(address_1) + delimiter + &
                                   truncate(address_2) + delimiter + &
                                   truncate(address_3) + delimiter + &
                                   truncate(city) + delimiter + &
                                   truncate(state) + delimiter + &
                                   truncate(formatted_zip) + delimiter + &
                                   truncate(phone_number) + delimiter + &
                                   ascii(last_yr_subscr) + delimiter + &
                                   ascii(last_yr_single) + delimiter + &
                                   ascii(last_yr_donated) + delimiter + &
                                   ascii(last_cont_date) + delimiter + &
                                   truncate(misc_area) + delimiter + &
                                   ascii(maint_date) + &
                                   '"');

define buffer2 character*256 = buffer[1:254] + '"' &
                               if buffer[255:1] > ' ' and &
                                  buffer[255:1] <> '"' &
                          else buffer[1:254] + '"' &
                               if buffer[254:1] > ' ' and &
                                  buffer[253:2] = ',"' &
                          else buffer

set report spacing 1
set nohead noblanks noduplicates

:purge commadat

set report device disc name commadat
set page width 256
set report limit 50000
set subfile name commasub

initial heading header

report tab 1 buffer2

final footing

go
exit


Gary L. Biggs, N5TTO
[log in to unmask]
Interex SIG Allbase Chair

"Abandon all hope, Ye who Inter(net) here" --
Dante, over the portal(router) to Hell

ATOM RSS1 RSS2