T24 : WRITESEQ Fails

209 views
Skip to first unread message

hareendra seneviratne

unread,
Apr 26, 2011, 12:20:36 AM4/26/11
to jB...@googlegroups.com
Hi,
 
I have following set of coding

GOSUB INIT
GOSUB PROCESS

INIT:
*****
...
EXECUTE 'SH -c "rm ETC.BP/CBSL1.TXT"'
OPENSEQ 'ETC.BP/CBSL1.TXT' TO TEXT.FILE ELSE PRINT "ERROR"
...

PROCESS:
********
...
  WHILE DRID:MORE
      CALL F.READ(FN.DRAWINGS,DRID,R.DR,F.DRAWINGS,ERR)
      Y.TMP.LINE = LINE
      Y.TMP.LINE := R.DR<TF.DR.DRAW.CURRENCY> :"|":R.DR<TF.DR.DOCUMENT.AMOUNT>
      WRITESEQ Y.TMP.LINE TO TEXT.FILE ELSE PRINT "ERROR"
  REPEAT
...
 
On the DEBUG data comes to  Y.TMP.LINE and the line is created as required.
But it does not generate the text file in ETC.BP/CBSL1.TXT as expected.
What might've gone wrong?
 
Thanks for ur replies.
 

Santosh

unread,
Apr 26, 2011, 2:02:55 PM4/26/11
to jb...@googlegroups.com
2 Solutions: (You can follow either one )
 
1. Create CBSL1.TXT under ETC.BP manually from your jbase prompt and execute the program it will write properly
2. In your program Change the OPENSEQ with the following:

OPENSEQ 'ETC.BP/CBSL1.TXT' TO TEXT.FILE ELSE CREATE TEXT.FILE ELSE PRINT "ERROR"
 
I suggest to go with 2nd option. So that manually you need not do anything.
 
Now you can check after fixing this.

--
Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines
 
IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24
 
To post, send email to jB...@googlegroups.com
To unsubscribe, send email to jBASE-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en



--
Mobile: 973-39406098

"Nobody can go back and start a new beginning, but anyone can start today and make a new ending"

Jim Idle

unread,
Apr 26, 2011, 2:32:33 PM4/26/11
to jb...@googlegroups.com

Don’t ever program an error clause that prints “ERROR” and then carries on anyway. You need to abort the program sensibly.

 

You can also do:

 

EXECUTE 'SH -c "rm –f ETC.BP/CBSL1.TXT; touch ETC.BP/CBSL1.TXT "'

 

But are you sure that you want to create a data file in a .BP directory – I don’t believe you wanted to do that!

 

Jim

hareendra seneviratne

unread,
Apr 27, 2011, 4:26:11 AM4/27/11
to jb...@googlegroups.com
The issue was on RETURN statement in the end of PROCESS. Once the cursor returns from the PROCESS it executes the INIT again. So the satement EXECUTE 'SH -c "rm ETC.BP/CBSL1.TXT"' in INIT deletes the generated text file.
 
I removed RETURN statement from the PROCESS and it works fine. Now the program is like this
 
GOSUB INIT
GOSUB PROCESS
 
INIT:
...
...
RETURN
 
PROCESS:
...
...
 
END
 
Any way I want to know the correct way of using GOSUB and RETURN statements. Can sm one illustrate pls?
Reply all
Reply to author
Forward
0 new messages