[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Printing Value above read line



In this program, you read a line, then write it, then examine it.  You could
read a line, examine it, write a new line before (above) it, then write the
line you read.

-----Original Message-----
From: Darrel Scott [mailto:darrel_1977@yahoo.com]
Sent: Wednesday, November 05, 2003 7:32 AM
To: sqr-users@sqrug.org
Subject: [sqr-users] Printing Value above read line


Hello again...
 
I'm in the process of modifying my existing program to print the output
value above the line in which was read to obtain that value. Here's a sample
of my existing code:
 
********************************************************************

Open $Orig AS 1 for-reading record=132 Status=#Global-Proc-ErrNbr
If #Global-Proc-ErrNbr != 0
 Let $Global-Proc-ErrMsg = 'Could not open file '|| $Orig
 Do Global-Got-Fatal-Data-Error
End-If

Open $Out As 2 for-writing record=132 Status=#Global-Proc-ErrNbr
If #Global-Proc-ErrNbr != 0
 Let $Global-Proc-ErrMsg = 'Could not open file '|| $Out
 Do Global-Got-Fatal-Data-Error
End-If

While 1
 Read 1 into $line:132
 If #end-file    
  Break    
 End-If

 Write 2 from $line

 If substr($line, 1, 22) = 'Original Value: 1'
  Let $Original_Value = substr($line, 22, 8)
  Move ' ' To $Output_Value
  Begin-Select
  value &output_value
   Move &output_value To $Output_Val
  FROM TABLE
  WHERE nbr = $Original_Value
  End-Select

  Read 1 into $line:132
  If #end-file    
   Break    
  End-If

  If isnull($Output_Val)
   Write 2 from $line
  Else
   If isblank($Output_Val)
    Write 2 from $line
   Else
    If $Output_Val = ''
     Write 2 from $line
    Else
     Let $seg_1 = $Output_Val
     Let $seg_2 = substr($line,34,96)
     String '  Output Value:      ' $seg_1 $seg_2 by '' into $line
     Write 2 from $line
    End-If
   End-If
  End-If

 End-If

End-While

Close 1
Close 2

********************************************************************

Is there any way I can tell the code to print the "Output Value:" line above
the "Original Value:" line? I'm juggling some ideas in my head, but I would
like to hear from you guys to make sure I'm on the right track and not going
off on an unnecessary tangent.

Thanks, Darrel.


---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users