Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing and reading

Status
Not open for further replies.

gbr

Programmer
Joined
Jul 19, 1999
Messages
3
Location
UY
Hi people, I need some help.<br>
How can I write records ending in x"0D0A" instead of x"0D0D0A". I have trouble in reading these records.<br>
Thanks in advance.
 
gbr,<br>
<br>
What platform and release are you using? If you can post your code here, I'll take a look at it.<br>
<br>
<br>
Matt Dean<br>
dean@deskware.com
 
Dear Matt,<br>
Excuse me for the time it took me to answer you.<br>
The plataforms I am using are Windows 95(b) and Windows 98.<br>
Here is the code, and thanks for your time.<br>
Gustavo Barreto<br>
---------------<br>
IDENTIFICATION DIVISION.<br>
PROGRAM-ID. VISANET.CBL<br>
AUTHOR. gbr.<br>
ENVIRONMENT DIVISION.<br>
DATA DIVISION.<br>
FILE SECTION.<br>
FD a:\VisaNet2.txt RECORD IS 128 BYTES. <br>
FD a:\VisaNet1.txt RECORD IS 128 BYTES.<br>
WORKING-STORAGE SECTION.<br>
1 VN2.<br>
3 regtipo2 PIC X(1) VALUE &quot;1&quot;.<br>
3 cabnum2 PIC 9(7) VALUE 0.<br>
3 comnum2 PIC 9(8) VALUE 2009043.<br>
3 comsuc2 PIC 9(4) VALUE 99.<br>
3 fechalot2 PIC 9(8) VALUE 0.<br>
3 mon2 PIC 9(4) VALUE 840.<br>
3 cantcuot2 PIC 9(2) VALUE 1.<br>
3 planven2 PIC 9(4) VALUE 1.<br>
3 trantipo2 PIC 9(2) VALUE 5.<br>
3 tottran2 PIC 9(7) VALUE 0.<br>
3 totimp2 PIC 9(15) VALUE 0.<br>
3 resto2 PIC X(66) VALUE &quot; &quot;.<br>
1 VN2T.<br>
3 regtipo2t PIC X(1) VALUE &quot;T&quot;.<br>
3 comnum2t PIC 9(8) VALUE 2009043.<br>
3 comsuc2t PIC 9(3) VALUE 99.<br>
3 fechaarc2t PIC 9(8) VALUE 0.<br>
3 fechaseq2t PIC 9(8) VALUE 0.<br>
3 tot85812t PIC 9(7) VALUE 0.<br>
3 tot85822t PIC 9(15) VALUE 0.<br>
3 tot85832t PIC 9(15) VALUE 0.<br>
3 tottran2t PIC 9(7) VALUE 0.<br>
3 totimp2t PIC 9(15) VALUE 0.<br>
3 tot062t PIC 9(15) VALUE 0.<br>
3 arctipo2t PIC X(10) VALUE &quot;NORMAL&quot;.<br>
3 resto2t PIC X(16) VALUE &quot; &quot;.<br>
1 VN1.<br>
3 regtipo1 PIC X(1) VALUE &quot;1&quot;.<br>
3 cabnum1 PIC 9(7) VALUE 0.<br>
3 trannum1 PIC 9(7) VALUE 1.<br>
3 comnum1 PIC 9(8) VALUE 2009043.<br>
3 comsuc1 PIC 9(3) VALUE 99.<br>
3 fechalot1 PIC 9(8) VALUE 0.<br>
3 mon1 PIC 9(4) VALUE 840.<br>
3 cantcuot1 PIC 9(2) VALUE 1.<br>
3 planven1 PIC 9(4) VALUE 1.<br>
3 trantipo1 PIC 9(2) VALUE 5.<br>
3 tarjnum1 PIC X(19) VALUE &quot;*&quot;.<br>
3 tarjvenc1 PIC 9(4) VALUE 0.<br>
3 tranfecha1 PIC 9(8) VALUE 0.<br>
3 imp1 PIC 9(15) VALUE 0.<br>
3 autnum1 PIC X(6) VALUE &quot; &quot;.<br>
3 per1 PIC X(6) VALUE &quot; &quot;.<br>
3 resto1 PIC X(24) VALUE &quot; &quot;.<br>
1 eod PIC X(1) VALUE &quot;*&quot;.<br>
1 eodsw PIC X(1) VALUE &quot;*&quot;.<br>
PROCEDURE DIVISION.<br>
CALL &quot;cls&quot;.<br>
DISPLAY &quot;**** NO OLVIDAR DE PONER UN DISQUETTE EN LA UNIDAD ****&quot;.<br>
DISPLAY &quot;&quot;.<br>
DISPLAY &quot;Ingreso de datos y grabaci¢n del disquette para VISA&quot;.<br>
DISPLAY &quot;----------------------------------------------------&quot;.<br>
ACCEPT cabnum2 FROM KEYBOARD PROMPT &quot; N§ de cabezal: &quot;.<br>
DISPLAY &quot; Fecha del lote&quot;.<br>
ACCEPT fechalot2 FROM KEYBOARD PROMPT &quot; aaaammdd: &quot;.<br>
MOVE cabnum2 TO cabnum1.<br>
MOVE fechalot2 TO fechalot1.<br>
OPEN a:\VisaNet1.txt FOR WRITING.<br>
MOVE 0 to trannum1.<br>
MOVE &quot;N&quot; TO eod.<br>
PERFORM GRABA-1 UNTIL eod = &quot;S&quot;.<br>
CLOSE a:\VisaNet1.txt.<br>
OPEN a:\VisaNet2.txt FOR WRITING.<br>
WRITE VN2 TO a:\VisaNet2.txt<br>
WRITE VN2T TO a:\VisaNet2.txt<br>
CLOSE a:\VisaNet2.txt.<br>
CALL &quot;copy /v/y a:\VisaNet?.txt p:\visanet&gt;nul&quot;.<br>
STOP RUN.<br>
GRABA-1.<br>
DISPLAY &quot; --------------------------&quot;.<br>
ADD 1 to trannum1.<br>
DISPLAY &quot; N§ de transacci¢n: &quot; trannum1.<br>
DISPLAY &quot; Moneda: &quot; mon1 &quot; - U$S&quot;.<br>
DISPLAY &quot; Cantidad de cuotas: &quot; cantcuot1 &quot; - Contado&quot;.<br>
DISPLAY &quot; Plan de venta: &quot; planven1 &quot; - Transacciones Contado&quot;.<br>
DISPLAY &quot; Tipo de transacci¢n: &quot; trantipo1 &quot; - Compra&quot;.<br>
ACCEPT tarjnum1 FROM KEYBOARD PROMPT &quot; N§ de tarjeta: &quot;.<br>
DISPLAY &quot; Vencimiento tarjeta&quot;.<br>
ACCEPT tarjvenc1 FROM KEYBOARD PROMPT &quot; aamm: &quot;.<br>
DISPLAY &quot; Fecha de transacci¢n&quot;.<br>
ACCEPT tranfecha1 FROM KEYBOARD PROMPT &quot; aaaammdd: &quot;.<br>
DISPLAY &quot; Importe&quot;.<br>
ACCEPT imp1 FROM KEYBOARD PROMPT &quot; contar con 2 decimales: &quot;.<br>
ACCEPT autnum1 FROM KEYBOARD PROMPT &quot; N§ de autorizaci¢n: &quot;.<br>
WRITE VN1 TO a:\VisaNet1.txt<br>
ADD 1 TO tottran2.<br>
ADD imp1 TO totimp2.<br>
ADD 1 TO tottran2t.<br>
ADD imp1 TO totimp2t.<br>
MOVE &quot;N&quot; TO eodsw.<br>
PERFORM ACCEPT-EOD UNTIL eodsw = &quot;S&quot;.<br>
ACCEPT-EOD.<br>
DISPLAY &quot;&quot;.<br>
ACCEPT eod FROM KEYBOARD PROMPT &quot; ¨Otra transacci¢n? [sn]: &quot;.<br>
DISPLAY &quot;&quot;.<br>
IF eod = &quot;s&quot; THEN<br>
MOVE &quot;N&quot; TO eod<br>
MOVE &quot;S&quot; TO eodsw<br>
ELSE<br>
IF eod = &quot;S&quot; THEN<br>
MOVE &quot;N&quot; TO eod<br>
MOVE &quot;S&quot; TO eodsw<br>
ELSE<br>
IF eod = &quot;n&quot; THEN<br>
MOVE &quot;S&quot; TO eod<br>
MOVE &quot;S&quot; TO eodsw<br>
ELSE<br>
IF eod = &quot;N&quot; THEN<br>
MOVE &quot;S&quot; TO eod<br>
MOVE &quot;S&quot; TO eodsw<br>
ENDIF<br>
ENDIF<br>
ENDIF<br>
ENDIF.<br>
------------------
 
Since this is a PC project, you might try <br>
ORGANIZATION IS LINE SEQUENTIAL<br>
for both your files. <br>
Try this and see if this helps.<br>

 
I tried your suggestion and it didn't work.<br>
And more, as a test, I used the constant CRLF and it also produces x'0d0d0a'
 
if your compiler supports a 'binary sequential' file type you can put your own '0d0a' at the end of the record.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top