Call jBASE Function from Within a Proc?

已查看 106 次
跳至第一个未读帖子

Joyce White

未读,
2021年5月20日 12:01:222021/5/20
收件人 jBASE
Hi, I have a proc (jcl program) that needs a "date check". I'd like to write a jBASE function for the date check, then call it from within the proc, having it return to the proc after it checks the date. Is this doable? If so, what syntax would I use to call the jBASE function (LIFE.LEFT.b) from within the proc?

I'm trying the line below and it's not working. My function is LIFE.LEFT, and it takes a parameter that the user enters in the previous line (%3).

IF [LIFE.LEFT(%3)] = 1 GO 999

Thanks,
Joyce

Ed Clark

未读,
2021年5月20日 12:32:252021/5/20
收件人 jb...@googlegroups.com
Unless there have been some enhancements to icl, I don’t think that you can call a subroutine with parameters.
Your validation program can either parse the parameter from the command line, or retrieve it with PROCREAD. It can use PROCWRITE to return its result, or use STOP, and then the proc can check IF E

--
--
IMPORTANT: T24/Globus posts are no longer accepted on this forum.
 
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

---
You received this message because you are subscribed to the Google Groups "jBASE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbase+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jbase/54d2fd8d-7d18-4e88-804d-a447e01a689dn%40googlegroups.com.

brucew...@comcast.net

未读,
2021年5月20日 12:32:252021/5/20
收件人 jb...@googlegroups.com

Here’s a thought. Can you store your parameter in one of the Proc Buffers and then instead of a Function, write a program that performs a PROCREAD to get the buffer contents, and puts the result back into the Buffer?

--

Joyce White

未读,
2021年5月20日 13:26:012021/5/20
收件人 jBASE
So from your answer, it seems like I CAN call a jBASE subroutine from a proc, just not with parameters? What is the syntax I would use to call a subroutine with no parameters from a proc?
Joyce

Ed Clark

未读,
2021年5月20日 14:52:002021/5/20
收件人 jb...@googlegroups.com
No, I don’t think you can call it from proc directly. You would have to run it. You probably need a wrapper program that would call your subroutine—unless jBase lets you run subroutines now. Last time I used jBase (quite a while ago) IIRC it didn’t allow you to CALL a program, or to EXECUTE a subroutine. 
A wrapper program can use SYSTEM(27) to determine if it is running from a proc and use PROCREAD to get the parameter from the input buffer, or SENTENCE() to get it from the command line (proc primary output buffer).

Joyce White

未读,
2021年5月20日 15:03:032021/5/20
收件人 jBASE
Thanks, I find procs to be challenging because I'm not in them often. In this case, I think I'm just going to write the check into the PROC. It should be a pretty simple check. Thanks for the suggestions - I appreciate the advice and help!
Joyce

ma...@proman.com

未读,
2021年5月20日 15:24:032021/5/20
收件人 jb...@googlegroups.com

jBase used to support proc user exits, for compatibility with the old assembler versions.

I suspect the code still works.

We don’t use them but here’s a sample, docs might still be out there somewhere.

The jpq_namedcommon variables allow for query and setting of the buffer pointers.

 

  SUBROUTINE U088(result, source, code, type, error)

  INCLUDE jpq_namedcommon

  Ptr = IPBUFFPTR

  IF Ptr > 1 THEN Ptr +=1 ; ! skip over the blank

  IF PQproc THEN

     Delim = " "

  END ELSE

     Delim = CHAR(254)

  END

  ucode = code<1,1,1>

! if called as U1088 then the prompt will be :

! if called as U(2-F) then the prompt will be "?"

! can thus be customized for 16 prompt chars

  BEGIN CASE

  CASE ucode = "1"

     PROMPT ":"

  CASE 1

     PROMPT "?"

  END CASE

  INPUT Q

  CurrData = IPBUFFER[Ptr,9999]

  CData = FIELD(CurrData,Delim,1)

  IF Q # "" THEN

    P1 = IPBUFFER[1,Ptr-1]

    P2 = CurrData[COL2(),999]

    IPBUFFER = P1:Q:P2

  END

  RETURN

 

From: jb...@googlegroups.com <jb...@googlegroups.com> On Behalf Of Joyce White
Sent: Thursday, May 20, 2021 12:03 PM
To: jBASE <jb...@googlegroups.com>

Peter Falson

未读,
2021年5月20日 15:33:392021/5/20
收件人 jb...@googlegroups.com
Additionally, depending on your jBASE version, you can place DEBUG ON in your proc (after the PQ) and view the buffers.

Sent from my iPhone

On May 20, 2021, at 12:24 PM, ma...@proman.com wrote:



Joyce White

未读,
2021年5月24日 17:11:462021/5/24
收件人 jBASE
Thanks for the advice! My validation check is pretty simple, I've decided to just include it in the proc. Now I have another issue with it, but I'll submit another question because it's a different topic.
Joyce

回复全部
回复作者
转发
0 个新帖子