No offense, but do you realize that big CASE statement could be reduced to
three lines?

If (Width LT 1 or Width GT 20) Then Width = 6
Mask = "L#" : Width
print R.File<This.Field, This.Count> Mask : Red : '_' : Grn :

On Tue, Jul 29, 2008 at 2:48 PM, Brutzman, Bill <[EMAIL PROTECTED]>wrote:

> Following John Reid's wish list, the following hack may be of some use...
>
> --Bill
>
>
> *---------------------------------------------------------------------------
> ---
> *R0  Bill Brutzman  Jul.2008
>
>  prompt ''
>
>  equate AM to char(254)
>  equate VM to char(253)
>
>  equate true to 1, false to 0
>
>  Red = @(-5)
>  Grn = @(-6)
>
>  Width = 6
>
>
> *---------------------------------------------------------------------------
> ---
> Main.Program:
>
>  gosub Access.Check
>
>  gosub First.Screen
>
>  gosub Prompt.Fields.To.Show
>
>  gosub Displayer
>
>  go Main.Program
>
>
> *---------------------------------------------------------------------------
> ---
>
> *---------------------------------------------------------------------------
> ---
> First.Screen:
>
>  crt @(-1)
>
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt '      ______                     '
>  crt '     /      \                    '
>  crt '     \  DD  /   Data.Displayer   '
>  crt '      \____/                     '
>
>  crt @(2,18) : @(-4) : '    <File>  [X]  '  :
>
>  input Ans.1, 1 :
>        Ans.1 = upcase(Ans.1)
>
>  begin case
>        case     Ans.1 = 'X'  ;  go The.End
>  end   case
>
>  input Ans.2
>        Ans.2 = upcase(Ans.2)
>
>  File.Name = Ans.1 : Ans.2
>
>  open File.Name to F.File  else  null
>
>
> *---------------------------------------------------------------------------
> ---
>
>  crt @(2,20) : '  <Record>  <X>  '  :
>
>  input Record
>        Record = upcase(Record)
>
>  begin case
>        case     Record = 'X'  ;  return to Main.Program
>  end   case
>
> *--------------------------------------
>
>  read R.File from F.File, Record  else  go Error.Not.On.File
>
> return
>
>
> *---------------------------------------------------------------------------
> ---
> Prompt.Fields.To.Show:
>
>  crt @(-1)
>
>  Field.Array = ''
>
>  for This.Field.Count = 1 to 200
>
>    crt @(4, This.Field.Count) : @(-4) :  '  <Field.#>  <X>  '  :
>
>    input Field.Nbr
>          Field.Nbr = upcase(Field.Nbr)
>
>    begin case
>          case Field.Nbr = 'X'  ;  exit
>    end   case
>
>    Field.Array<-1> = Field.Nbr
>
>  next This.Field.Count
>  Next.This.Field.Count:
>
> return
>
>
> *---------------------------------------------------------------------------
> ---
> Displayer:
>
>  crt @(-1)
>
>  print
>  print '   ' : File.Name : '  ' : Record
>  print
>
>                      Field.1 = Field.Array<1>
>  This.Field = R.File<Field.1>
>
>  Total.Nbr.Entries = dcount(This.Field, VM)
>
>                        Total.Nbr.Fields = dcount(Field.Array, AM)
>                        Field.Last = Field.Array<Total.Nbr.Fields>
>
>  for This.Field = Field.1 to Field.Last
>
>        print This.Field 'R#2' : Red : ':' : Grn :
>
>  for This.Count = 1 to Total.Nbr.Entries
>
>     begin case
>           case Width =  1  ;  print R.File<This.Field, This.Count> 'L#1'  :
> Red : '_' : Grn :
>           case Width =  2  ;  print R.File<This.Field, This.Count> 'L#2'  :
> Red : '_' : Grn :
>           case Width =  3  ;  print R.File<This.Field, This.Count> 'L#3'  :
> Red : '_' : Grn :
>           case Width =  4  ;  print R.File<This.Field, This.Count> 'L#4'  :
> Red : '_' : Grn :
>           case Width =  5  ;  print R.File<This.Field, This.Count> 'L#5'  :
> Red : '_' : Grn :
>           case Width =  6  ;  print R.File<This.Field, This.Count> 'L#6'  :
> Red : '_' : Grn :
>           case Width =  7  ;  print R.File<This.Field, This.Count> 'L#7'  :
> Red : '_' : Grn :
>           case Width =  8  ;  print R.File<This.Field, This.Count> 'L#8'  :
> Red : '_' : Grn :
>           case Width =  9  ;  print R.File<This.Field, This.Count> 'L#9'  :
> Red : '_' : Grn :
>           case Width = 10  ;  print R.File<This.Field, This.Count> 'L#10' :
> Red : '_' : Grn :
>           case Width = 11  ;  print R.File<This.Field, This.Count> 'L#11' :
> Red : '_' : Grn :
>           case Width = 12  ;  print R.File<This.Field, This.Count> 'L#12' :
> Red : '_' : Grn :
>           case Width = 13  ;  print R.File<This.Field, This.Count> 'L#13' :
> Red : '_' : Grn :
>           case Width = 14  ;  print R.File<This.Field, This.Count> 'L#14' :
> Red : '_' : Grn :
>           case Width = 15  ;  print R.File<This.Field, This.Count> 'L#15' :
> Red : '_' : Grn :
>           case Width = 16  ;  print R.File<This.Field, This.Count> 'L#16' :
> Red : '_' : Grn :
>           case Width = 17  ;  print R.File<This.Field, This.Count> 'L#17' :
> Red : '_' : Grn :
>           case Width = 18  ;  print R.File<This.Field, This.Count> 'L#18' :
> Red : '_' : Grn :
>           case Width = 19  ;  print R.File<This.Field, This.Count> 'L#19' :
> Red : '_' : Grn :
>           case Width = 20  ;  print R.File<This.Field, This.Count> 'L#20' :
> Red : '_' : Grn :
>           case 1           ;  print R.File<This.Field, This.Count> 'L#6'  :
> Red : '_' : Grn :
>     end   case
>
>  next This.Count
>  print
>  next This.Field
>
>  gosub Bottom.Prompt
>
> return
>
>
> *---------------------------------------------------------------------------
> ---
> Bottom.Prompt:
>
>  crt
>  crt ' [<]  <Width.##>  [XX]' :
>
>  input Ans, 2
>        Ans = upcase(Ans)
>
>  begin case
>        case Ans = 'XX'  ;  go The.End
>        case 1           ;  Width = Ans  ;  return to Displayer
>  end   case
>
>
> *---------------------------------------------------------------------------
> --
> Access.Check:
>
>  Access.Depts  = ' '        : VM
>  *Access.Depts := 'Acct'     : VM
>  *Access.Depts := 'Cust'     : VM
>  *Access.Depts := 'Dock'     : VM
>  *Access.Depts := 'Eng'      : VM
>  *Access.Depts := 'Est'      : VM
>  Access.Depts := 'Exec'     : VM
>  *Access.Depts := 'Packing'  : VM
>  *Access.Depts := 'Prod.Mgr' : VM
>  *Access.Depts := 'Prod'     : VM
>  *Access.Depts := 'Purch'    : VM
>  *Access.Depts := 'Qual.Mgr' : VM
>  *Access.Depts := 'Quality'  : VM
>  *Access.Depts := 'Sales'    : VM
>  *Access.Depts := 'Tool.Mgr'
>
>  call *ACCESS.CHECK.R9(Access.Depts, Access.Status)
>                                   if Access.Status # 'Granted'  then  go
> The.End
> return
>
>
> *---------------------------------------------------------------------------
> ---
> Error.Not.On.File:
>
>  crt @(-1)
>
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt
>  crt '__________                           '
>  crt '\         \                          '
>  crt ' \  Error  \   Record Not On File    '
>  crt '  \_________\                        '
>  crt '                               [X]   '
>  crt '                                ' :
>
>  input Ans.Error, 1
>        Ans.Error = upcase(Ans.Error)
>
> return to Main.Program
>
>
> *---------------------------------------------------------------------------
> ---
> The.End:
>
>  crt @(-1)
>
>  END
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of john reid
> Sent: Tuesday, July 29, 2008 8:38 AM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] Data Editor
>
>
> A nice multivalue subroutine for interactive screens, that takes row
> and column start points and headings for associated attributes,
> conversion and formatting of same, number of data rows displayed, and
> (A)dd, (I)nsert, (D)elete, (P)age, (E)nter (for next or field), and
> (S)ave prompts would be a nice gift for the group.  Can someone fork
> one over to the group?
> john
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
>



-- 
-Kevin
http://www.PrecisOnline.com
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to