I have been carefully working away with cobjapi and postgresql and gixsql as you probably know.
I ran into a small sample of code that i don't have a fix for. I can't get the text area to append to itself on a j-settext method.
Here is the small code sample. Please assist or give me a hint.
PERFORM UNTIL WS-EOF = 'YES'
READ REPT-FILE INTO WS-TEMP-BUFFER
AT END
MOVE 'YES' TO WS-EOF
DISPLAY 'REACHED END OF FILE'
MOVE WS-TEMP-BUFFER TO WS-FILE-CONTENT
MOVE J-SETTEXT(WS-TEXTAREA, WS-TEMP-BUFFER)
TO WS-RET
NOT AT END
DISPLAY "Read Data: " WS-TEMP-BUFFER
MOVE WS-TEMP-BUFFER TO WS-FILE-CONTENT
DISPLAY WS-FILE-CONTENT
DISPLAY 'NOT AT END'
END-PERFORM
CLOSE REPT-FILE
it wants to keep over writing in that perform read loop.
thanks,
j.mcnamara
Sent with Proton Mail secure email.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found j-appendtext - that did the trick.
So now I can write queries from declarative cursors to an output file and read them back into a textarea in cobjapi so that i have a print out of the query.
this is very cool.
thanks,
jim
Last edit: Simon Sobisch 2024-12-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is in some kind of loop mode a vicious loop cycle, and i can't get it to append during the loops. Someday when i am a little better i will know how to get things to append in a loop but for now i struggled with that one. It is my lack of true cobol knowledge showing through. Some things are a little easier, but i need more cobol experience.
I will experiment with things like move concatenate (var1 var2) to var3 or something in the future.
It just seems for now easier to write it to a file but I will definitely be looking to refactor with appendtext now that i can use that.
I hope to implement changes in a few days. i have to run errands now.
Sorry simon,
jim
Last edit: Simon Sobisch 2024-12-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I haven't checked the details of that, but if you can pass that a fixed-size buffer then it would be reasonable to use STRING db-text-var INTO japi-buffer WITH POINTER str-pointer (set it to 1 before the fetch-loop; and after that loop check if it is not 1, then do the JAPI call passing the buffer; if that isn't "full", you likely would want to STRING FUNCTION TRIM (db-text-var TRAILING) instead.
... just an idea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I haven't checked the details of that, but if you can pass that a fixed-size buffer then it would be reasonable to use STRING db-text-var INTO japi-buffer WITH POINTER str-pointer (set it to 1 before the fetch-loop; and after that loop check if it is not 1, then do the JAPI call passing the buffer; if that isn't "full", you likely would want to STRING FUNCTION TRIM (db-text-var TRAILING) instead.
Hi all-
I have been carefully working away with cobjapi and postgresql and gixsql as you probably know.
I ran into a small sample of code that i don't have a fix for. I can't get the text area to append to itself on a j-settext method.
Here is the small code sample. Please assist or give me a hint.
PERFORM UNTIL WS-EOF = 'YES'
READ REPT-FILE INTO WS-TEMP-BUFFER
AT END
MOVE 'YES' TO WS-EOF
DISPLAY 'REACHED END OF FILE'
MOVE WS-TEMP-BUFFER TO WS-FILE-CONTENT
MOVE J-SETTEXT(WS-TEXTAREA, WS-TEMP-BUFFER)
TO WS-RET
NOT AT END
DISPLAY "Read Data: " WS-TEMP-BUFFER
MOVE WS-TEMP-BUFFER TO WS-FILE-CONTENT
DISPLAY WS-FILE-CONTENT
DISPLAY 'NOT AT END'
END-PERFORM
it wants to keep over writing in that perform read loop.
thanks,
j.mcnamara
Sent with Proton Mail secure email.
hi all-
I found j-appendtext - that did the trick.
So now I can write queries from declarative cursors to an output file and read them back into a textarea in cobjapi so that i have a print out of the query.
this is very cool.
thanks,
jim
Last edit: Simon Sobisch 2024-12-30
Why putting that into a file and not directly into the textarea?
i knew you would wonder about that.
It is in some kind of loop mode a vicious loop cycle, and i can't get it to append during the loops. Someday when i am a little better i will know how to get things to append in a loop but for now i struggled with that one. It is my lack of true cobol knowledge showing through. Some things are a little easier, but i need more cobol experience.
I will experiment with things like move concatenate (var1 var2) to var3 or something in the future.
It just seems for now easier to write it to a file but I will definitely be looking to refactor with appendtext now that i can use that.
I hope to implement changes in a few days. i have to run errands now.
Sorry simon,
jim
Last edit: Simon Sobisch 2024-12-30
I haven't checked the details of that, but if you can pass that a fixed-size buffer then it would be reasonable to use
STRING db-text-var INTO japi-buffer WITH POINTER str-pointer
(set it to 1 before the fetch-loop; and after that loop check if it is not 1, then do the JAPI call passing the buffer; if that isn't "full", you likely would want toSTRING FUNCTION TRIM (db-text-var TRAILING)
instead.... just an idea.
very cool - thank you!
that is a definite idea worth pursuing.
first i am going to try jim tcl though. .I'd like to check out your way in case i don't want overhead of jim-tcl for some reason.
thanks for the cool tip.
I need to spend time going over code in cobol like the index of different functions each day for a long time until i become better.
thanks,
jim
Sent with Proton Mail secure email.
On Monday, December 30th, 2024 at 1:22 PM, Simon Sobisch sf-mensch@users.sourceforge.net wrote: