It has always been thus. You will notice that you can execute a UV program OK.

The solution we set up over 10 years ago still stands: use execute to do subroutines.

3 UV programs named something like: SRTN1, SRTN2, SRTN3, all using SRTN.COMMON

You are welcome to use these: suggestions welcome.

Notes:
-    Our names are prefixed with PT (we call out utilities Pilot).
- the PTACT file contains a record for each active user, including if select list is active
-    SP TEST and TEST.S are used to track diagnostic data in the TEST file

SRTN.COMMON contains:
001: *
002: *  Common areas for PTSRTN1, PTSRTN2 & PTSRTN3
003: *   PTSRTN.COMMON vn 02 18 JUN 2003         Copyright: Walstan Systems
004: *
005:     COM /SRTN/ SID, ACNT, A1, A2, A3, A4, A5, A6 ;* For PTSRTN
006:     COM /SELS/ SLYN                              ;* Saved list Y/N

001: SUBROUTINE PTSRTN1(ID,SCNT,P1,P2,P3,P4,P5,P6)
002: *  Set up data for subroutine to execute from PC
003: *   PTSRTN1 vn 03 06 SEP 2007               Copyright: Walstan Systems
004: *
005: $INCLUDE BPT PTSRTN.COMMON
006: $INCLUDE BPT PT.COMMON
007:     FN = 'PTSRTN1 ':ID                          ;* Function name
008: $INCLUDE BPT TEST.COMMON                        ;* For SP.TEST
009:     SID = ID                                    ;* Name of srtn to call
010:     ACNT = SCNT                                 ;* No of arguments
011:     A1 = P1                                     ;* 1st argument
012:     A2 = P2                                     ;* 2nd argument
013:     A3 = P3                                     ;* 3rd argument
014:     A4 = P4                                     ;* 4st argument
015:     A5 = P5                                     ;* 5th argument
016:     A6 = P6                                     ;* 6th argument
017:     CALL READ.S(FN,ACTR,'PTACT',ACTF,@USERNO)   ;* User activity
018:     IF ACTR<25> NE "" THEN SLYN = 'Y' ELSE SLYN = 'N';* Active list
019:     IF SP.TEST<13> = 'Y' THEN GOSUB 200         ;* Save call detail
020:     RETURN
021: *--------------------*
022: *  Save call detail  *
023: *--------------------*
024: 200 MSG = 'Call   ':SID                         ;* Srtn to call
025:     IF ACNT > 0 THEN MSG := '(':A1              ;* 1st parameter
026:     IF ACNT > 1 THEN MSG := ',':A2              ;* 2nd parameter
027:     IF ACNT > 2 THEN MSG := ',':A3              ;* 3rd parameter
028:     IF ACNT > 3 THEN MSG := ',':A4              ;* 4th parameter
029:     IF ACNT > 4 THEN MSG := ',':A5              ;* 5th parameter
030:     IF ACNT > 5 THEN MSG := ',':A6              ;* 6th parameter
031:     IF ACNT > 0 THEN MSG := ')'                 ;* Close brackets
032:     CALL TEST.S(FN,MSG,TF)                      ;* To show user
033:     RETURN
034:   END

001: *
002: *  Execute a subroutine (so PC can provide user interface)
003: *   PTSRTN2 vn 02 18 JUN 2003               Copyright: Walstan Systems
004: *
005: $INCLUDE BPT PTSRTN.COMMON
013:     FN = 'PTSRTN2 ':SID                          ;* Function name
014:     PROG = SID                                   ;* Program to call
*  removed lines here from the test version capturing a specific call
021:     IF SLYN = 'Y' THEN                           ;* Has active list
022:       SLID = '&SL':@USERNO                       ;* Select list ID
023:       EXECUTE 'GET.LIST ':SLID CAPTURING X       ;* Activate the list
024:     END
025:     BEGIN CASE
026:       CASE ACNT = 0; CALL @PROG
027:       CASE ACNT = 1; CALL @PROG(A1)
028:       CASE ACNT = 2; CALL @PROG(A1,A2)
029:       CASE ACNT = 3; CALL @PROG(A1,A2,A3)
030:       CASE ACNT = 4; CALL @PROG(A1,A2,A3,A4)
031:       CASE ACNT = 5; CALL @PROG(A1,A2,A3,A4,A5)
032:       CASE ACNT = 6; CALL @PROG(A1,A2,A3,A4,A5,A6)
033:       CASE 1
034:         PRINT 'PTSRTN.COMMON areas not set up to execute subroutine'
035:     END CASE
036:  END

001: SUBROUTINE PTSRTN3(ID,PCNT,P1,P2,P3,P4,P5,P6)
002: *  Get results of executed subroutine
003: *   PTSRTN3 vn 02 06 SEP 2007               Copyright: Walstan Systems
004: *
005: $INCLUDE BPT PTSRTN.COMMON
006:     FN = 'PTSRTN3 ':SID                         ;* Function name
007: $INCLUDE BPT TEST.COMMON                        ;* For SP.TEST
008:     ID = SID                                    ;* Subroutine called
009:     PCNT = ACNT                                  ;* Arguments passed
010:     P1 = A1                                      ;* 1st argument
011:     P2 = A2                                      ;* 2nd argument
012:     P3 = A3                                      ;* 3rd argument
013:     P4 = A4                                      ;* 4st argument
014:     P5 = A5                                      ;* 5th argument
015:     P6 = A6                                      ;* 6th argument
016:     IF SP.TEST<14> = 'Y' THEN GOSUB 200         ;* Save details
017:     RETURN
018: *---------------------------------------*
019: *  Save details returned from the call  *
020: *---------------------------------------*
021: 200 MSG = 'From ':SID                           ;* Srtn to call
022:     IF ACNT > 0 THEN MSG := '(':A1              ;* 1st parameter
023:     IF ACNT > 1 THEN MSG := ',':A2              ;* 2nd parameter
024:     IF ACNT > 2 THEN MSG := ',':A3              ;* 3rd parameter
025:     IF ACNT > 3 THEN MSG := ',':A4              ;* 4th parameter
026:     IF ACNT > 4 THEN MSG := ',':A5              ;* 5th parameter
027:     IF ACNT > 5 THEN MSG := ',':A6              ;* 6th parameter
028:     IF ACNT THEN MSG := ')'                     ;* Close brackets
029:     CALL TEST.S(FN,MSG,TF)                      ;* Save details
030:     RETURN
031:   END

In addition, we have a "listen" process which looks at the "printed output" from PTSRTN2 to do specific tasks: set up printer, ask a Yes/No question, answer a prompt, etc. These are triggered by a character, we use CHAR(127), which is followed by data specifying he task for the client to do.

HTH

----- Original Message ----- From: "waivic" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Saturday, April 19, 2008 6:01 AM
Subject: [U2] UniSubroutine question with UOJ


I use the UniSubroutine object of Uinobject For Java to call a subroutine
with Unidata. But if I have any CRT or PRINT command inside Unidata
Subroutine, it will mess up the UniSubroutine call. Basically, it runs but
returns nothing. Anyone know why this happens and how I can prevent this
happen?
--
View this message in context: http://www.nabble.com/UniSubroutine-question-with-UOJ-tp16763989p16763989.html
Sent from the U2 - Users mailing list archive at Nabble.com.
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to