Thank you Razzak and Buddy,


Wow indeed when you have the code tweaked!  I'm also able to double space the 
result for better clarity.



[cid:[email protected]]



Claudine



-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Claudine Robbins
Sent: Saturday, February 24, 2018 8:01 PM
To: [email protected]
Subject: Re: [RBASE-L] - Formatting OUTPUT



I can’t wait to try it tomorrow!



Thank you very much.



Claudine



Sent from my iPhone



On Feb 24, 2018, at 4:59 PM, A. Razzak Memon 
<[email protected]<mailto:[email protected]>> wrote:



Hi Claudine,



Here is an example of using the sample RRBYW19 database that demonstrates the 
use of SFIL, SPUT, WRITE, FORMAT, APPEND commands to create fixed-field plain 
text file.



Save this code as a command file in c:\RBTI\RBGXE\Samples\RRBYW19\ and then 
just RUN that command.



Take a close look at the resulting RRBYW19_FixedFieldFile.txt file. Wow!!!!



Hope that helps you understand the technique and what you are trying to 
accomplish.



Please feel free to modify and adapt to your situation as you see fit.



Very Best R:egards,



Razzak



-- Start here

-- SFIL_And_SPUT_Commands_To_Create_Fixed_Field_Text_File.rmd

-- Author: A. Razzak Memon

-- Date Created: February 19, 2018

-- Last Updated:

  -- Check Database Connection

IF (CVAL('DATABASE')) <> 'RRBYW19' OR (CVAL('DATABASE')) IS NULL THEN

  CONNECT RRBYW19 IDENTIFIED BY NONE

ENDIF

  -- Pre-Define All Variables

  SET VAR vOutputFileName TEXT = 'RRBYW19_FixedFieldFile.txt'

  SET VAR vWrite TEXT = NULL

  SET VAR vTransID INTEGER = NULL

  SET VAR vCustID INTEGER = NULL

  SET VAR vCompany TEXT = NULL

  SET VAR vDescription TEXT = NULL

  SET VAR vTransDate DATE = NULL

  SET VAR vInvoiceTotal CURRENCY = NULL

  SET VAR vAmount CURRENCY = NULL

  SET VAR vCredit TEXT = 'CREDIT'

  -- Create empty file

  SET EOFCHAR OFF

  OUTPUT .vOutputFileName

  OUTPUT SCREEN

  SET EOFCHAR ON

  -- Create Empty Line

  SET VAR vWrite = (SFIL((CHAR(00)),80))

  -- Get Data

  SET ERROR MESSAGE 705 OFF

  DROP CURSOR c1

  DECLARE c1 CURSOR FOR SELECT +

  TransID,CustID,TransDate,InvoiceTotal FROM InvoiceHeader ORDER BY TransID

  OPEN c1

  FETCH c1 INTO +

  vTransID INDIC iv1, +

  vCustID INDIC iv1, +

  vTransDate INDIC iv1, +

  vInvoiceTotal INDIC iv1

WHILE SQLCODE <> 100 THEN

  SELECT Company INTO vCompany INDIC iv1 FROM Customer WHERE CustID = .vCustID

  SET VAR vDescription = ((CTXT(.vCustID))&.vCompany)

  SET VAR vAmount = (.vInvoiceTotal*100)

  SET VAR vWrite = (SPUT(.vWrite,(CTXT(.vTransID)),1))

 SET VAR vWrite = (SPUT(.vWrite,.vDescription,6))

  SET VAR vWrite = (SPUT(.vWrite,(CTXT(FORMAT(.vTransDate,'YYMMDD'))),44))

  SET VAR vWrite = (SPUT(.vWrite,(CTXT(FORMAT(.vAmount,'00000000000'))),50))

  SET VAR vWrite = (SPUT(.vWrite,.vCredit,63))

  SET EOFCHAR OFF

  OUTPUT .vOutputFileName APPEND

  WRITE .vWrite

  OUTPUT SCREEN

  SET EOFCHAR ON

  SET VAR vWrite = (SFIL((CHAR(00)),80))

  SET VAR vTransID = NULL

  SET VAR vCustID = NULL

  SET VAR vCompany = NULL

  SET VAR vDescription = NULL

  SET VAR vTransDate = NULL

  SET VAR vInvoiceTotal = NULL

  SET VAR vAmount = NULL

  FETCH c1 INTO +

  vTransID INDIC iv1, +

  vCustID INDIC iv1, +

  vTransDate INDIC iv1, +

  vInvoiceTotal INDIC iv1

ENDWHILE

  DROP CURSOR c1

  LAUNCH &vOutputFileName

  CLEAR VARIABLES iv%,vOutputFileName,vWrite,vTransID,vCustID,vCompany, +

  vDescription,vTransDate,vInvoiceTotal,vAmount,vCredit

  RETURN

-- Start here





At 10:54 PM 2/23/2018, Claudine Robbins wrote:



> Either I output as ASCII or CSV and I still get those extra quotes and return.

>

> Any idea how I can suppress those?











--

For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php

--- You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.

For more options, visit https://groups.google.com/d/optout.



--

For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php

---

You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.

For more options, visit https://groups.google.com/d/optout.

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to