BPXWDYN ERRORs TO S99MSG.



IBM's Command List programming language & Restructured Extended Executor

BPXWDYN ERRORs TO S99MSG.

Postby Steve Coalbran » Tue Nov 12, 2013 4:02 pm

Hi
    I've scanned this and many other fora for this and got nowhere.
    I've RTFMd too and there's no depth in any examples.
    I've tried various different approaches...

I want to call BPXWDYN to ALLOC/FREE/unameit and trap the error messages.
s99msg. never has anything, whatever weird errors I try to simulate, here the '.' instead of a ',' in the ALLOC.
Anyone got a nice little bit of working code that does this?
Here's my last futile attempt in function "BPX"...
(Details and comments removed for clarity.
The ABEXIT routine is just a standard error routine to ISPEXEC SETMSG the short&long messages)

-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  2 Line(s) not Displayed
sm = "BPXWDYN ERROR"                                                   
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  2 Line(s) not Displayed
ADDRESS TSO                                                             
CALL SYSCALLS "ON"                                                     
PARSE VALUE "" WITH cdd edd                                             
CALL BPX "ALLOC NEW REUSE",                                             
         "LRECL(255) RECFM(VB) DSORG(PS) BLKSIZE(32720)",               
         "RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE MSG(WTP)"         
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  8 Line(s) not Displayed
EXIT                                                                   
BPX:                                                                   
ARG __cmd                                                               
s99msg. = 0                                                             
retc = BPXWDYN(__cmd)                                                   
IF( retc<>0 )THEN DO                                                   
   lm = "CALL BPXWDYN:" __cmd,                                         
       "§ENDED RC="retc "X'"C2X(retc)"'"                               
   IF( s99msg.0<>0 )THEN DO                                             
      DO i = 1 TO s99msg.0                                             
         lm = lm"§"s99msg.i                                             
      END                                                               
      END                                                               
   ELSE NOP                                                             
   CALL ABEXIT sm,lm                                                   
   END                                                                 
ELSE NOP                                                               
RETURN                                                                 
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - 34 Line(s) not Displayed

Thanks in advance.
Steve
User avatar
Steve Coalbran
 
Posts: 102
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 5 times
Been thanked: 1 time

Re: BPXWDYN ERRORs TO S99MSG.

 

Re: BPXWDYN ERRORs TO S99MSG.

Postby enrico-sorichetti » Tue Nov 12, 2013 5:05 pm

my understanding of the manual tells that You got what You asked for :D
"RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE MSG(WTP)"   


MSG(WTP|default.S99MSG.|stemname|fdnum)
Direct allocation messages to your job log (WTP), a REXX stem, or a file identified by a file descriptor number. If this key is not specified, messages will be returned in the S99MSG. stem, if possible. If the program was not called by a REXX exec, the messages will be lost.


MSG(WTP) instructs the BPX... powers to write the messages to the JOB LOG

try without using the MSG key
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: BPXWDYN ERRORs TO S99MSG.

Postby Steve Coalbran » Tue Nov 12, 2013 6:16 pm

Hi Enrico
I Tried MSG(WTP) already.
I couldn't see any message in SDSF for my session and got nothing visible anywhere I could see.
I want to trap it in the steminside the subroutine. That's the point.
The error is deliberately to cause an error.
Steve
User avatar
Steve Coalbran
 
Posts: 102
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 5 times
Been thanked: 1 time

Re: BPXWDYN ERRORs TO S99MSG.

Postby Robert Sample » Tue Nov 12, 2013 6:47 pm

Did you not read the quote enrico posted? Here is the relevant portion again:
If this key is not specified, messages will be returned in the S99MSG. stem, if possible.
In other words, as long as you have MSG in your code, you will NOT be able to access the errors via S99MSG -- period.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: East Dubuque, Illinois
Has thanked: 1 time
Been thanked: 222 times

Re: BPXWDYN ERRORs TO S99MSG.

Postby Steve Coalbran » Tue Nov 12, 2013 10:30 pm

Hi Robert
Yes, I read it... many times.
It is exactly the s99msg. stem that I want loaded with the message lines. That is why I DO NOT NOW have MSG(stem) in my call - I just tried that along the way.
Do you have a working example?
Steve
User avatar
Steve Coalbran
 
Posts: 102
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 5 times
Been thanked: 1 time

Re: BPXWDYN ERRORs TO S99MSG.

Postby Steve Coalbran » Tue Nov 12, 2013 10:41 pm

I had cut&pasted the code before into a NotePad - apologies, the MSG(WTP) was not included.
I put a TRACE "I" around the check get this...
36 *-*    IF( s99msg.0<>0 )
   >V>      "0"             
   >L>      "0"             
   >O>      "0" 
41 *-*    ELSE   
   *-*     NOP     
Steve
User avatar
Steve Coalbran
 
Posts: 102
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 5 times
Been thanked: 1 time

Re: BPXWDYN ERRORs TO S99MSG.

Postby Steve Coalbran » Tue Nov 12, 2013 11:03 pm

Try again, here's the latest version, I try passing a stem of my own...
sm = "BPXWDYN ERROR"
CALL SYSCALLS "ON"
CALL BPX "ALLOC NEW REUSE",
         "LRECL(255) RECFM(VB) DSORG(PS) BLKSIZE(32720)",
         "RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE "
EXIT
BPX: TRACE "I"
ARG __cmd
__msg. = 0
__msg = "MSG(__msg.)"
__rc = BPXWDYN(__cmd __msg)
IF( __rc<>0 )THEN DO
   retx = C2X(__rc)
   /*
   */
   __lm = "CALL BPXWDYN:" __cmd,
        "§ENDED RC="__rc "X'"retx"'"
   IF( __msg.0<>0 )THEN DO
      DO i = 1 TO __msg.0
         __lm = __lm"§"__msg.i
      END
      END
   ELSE NOP
   CALL ABEXIT __sm,__lm
   END
ELSE NOP
RETURN
giving a TRACE output of...
    22 *-*  ARG __cmd
       >>>    "ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) BLKSIZE(32720) RT
DDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE "
    23 *-*  __msg. = 0
       >L>    "0"
    24 *-*  __msg = "MSG(__msg.)"
       >L>    "MSG(__msg.)"
    25 *-*  __rc = BPXWDYN(__cmd __msg)
       >V>    "ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) BLKSIZE(32720) RT
DDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE "
       >V>    "MSG(__msg.)"
       >O>    "ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) BLKSIZE(32720) RT
DDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE  MSG(__msg.)"
       >F>    "-930"
    26 *-*  IF( __rc<>0 )
       >V>    "-930"
       >L>    "0"
       >O>    "1"
       *-*   THEN
       *-*   DO
    27 *-*    retx = C2X(__rc)
       >V>      "-930"
       >F>      "60F9F3F0"
    28 *-*    /*
               */
    30 *-*    __lm = "CALL BPXWDYN:" __cmd,
                    "§ENDED RC="__rc "X'"retx"'"
       >L>      "CALL BPXWDYN:"
       >V>      "ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) BLKSIZE(32720)
RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE "
       >O>      "CALL BPXWDYN: ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) B
LKSIZE(32720) RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE "
       >L>      "§ENDED RC="
       >O>      "CALL BPXWDYN: ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) B
LKSIZE(32720) RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE  §ENDED RC="
       >V>      "-930"
       >O>      "CALL BPXWDYN: ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) B
LKSIZE(32720) RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE  §ENDED RC=-930"
       >L>      "X'"
       >O>      "CALL BPXWDYN: ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) B
LKSIZE(32720) RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE  §ENDED RC=-930 X'"
       >V>      "60F9F3F0"
       >O>      "CALL BPXWDYN: ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) B
LKSIZE(32720) RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE  §ENDED RC=-930 X'60F
9F3F0"
       >L>      "'"
       >O>      "CALL BPXWDYN: ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) B
LKSIZE(32720) RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE  §ENDED RC=-930 X'60F
9F3F0'"
    32 *-*    IF( __msg.0<>0 )
       >V>      "0"
       >L>      "0"
       >O>      "0"
    37 *-*    ELSE
       *-*     NOP
    38 *-*    CALL ABEXIT __sm,__lm
       >L>      "__SM"
       >V>      "CALL BPXWDYN: ALLOC NEW REUSE LRECL(255) RECFM(VB) DSORG(PS) B
LKSIZE(32720) RTDDN(SDD) RTDSN(SDS) SPACE(3.3)CYL RELEASE  §ENDED RC=-930 X'60F
9F3F0'"
    71 *-*     ABEXIT:
       *-*     PROCEDURE
       *-*     TRACE "O"
***
Spot the mistake? I can't. It's probably blindingly obvious?!
Steve
User avatar
Steve Coalbran
 
Posts: 102
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 5 times
Been thanked: 1 time

Re: BPXWDYN ERRORs TO S99MSG.

Postby enrico-sorichetti » Wed Nov 13, 2013 1:10 am

see here for a handy tool to display the names of the variables active in Your REXX
http://ibmmainframes.com/about59657.html
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: BPXWDYN ERRORs TO S99MSG.

Postby Pedro » Wed Nov 13, 2013 1:14 am

This works for me:
/* rexx */                                             
trace('r')                                             
parse UPPER arg dsn                                     
                                                       
ZZ =  BPXWDYN("ALLOC FI(TEMP1) DSN("dsn")     REUSE")   
say  zz s99msg.0                                       
                                                       
If s99msg.0 ¬= 'S99MSG.0' Then                         
  Do idx = 1 to s99msg.0                               
   say idx s99msg.idx                                   
  End                                                   
Address TSO "LISTDD TEMP1"                             

It results in four messages being shown. The problem is that 'duplicate name exists in catalog'.

I found it unforgiving in:
1. does not support dataset prefix. I had to fully qualify in parameter.
2. did not like REU. I had to specify REUSE.
3. needed to specify OLD to not get a message.

Your exec does not work because of this:
 SPACE(3.3)CYL

It should use a comma. Add a blank for readability.

It seems to have various return codes for syntax errors but does not provide messages for those. You will likely get messages when it is syntactically correct, but some error occurs when it tries to execute it.
Pedro Vera
User avatar
Pedro
 
Posts: 569
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 39 times

Re: BPXWDYN ERRORs TO S99MSG.

Postby Steve Coalbran » Wed Nov 13, 2013 10:19 am

Pedro wrote: Your exec does not work because ...
It should use a comma. ...

Thanks Pedro - the whole point of the dot instead of comma was to generate an error, __ I got the syntax down. :D
OK,
So, could you(/anyone) please let me know of a situation that will generate 'error messages' in the 'msg' stem/whatever?
Just to check the syntax.
BTW: Yes, I changed my check to be IF( DATATYPE(s99msg.0,"N") )THEN ...

Please excuse my REXX writing standard which can be accused of "over-bracketing"?
I like all REXX keywords & labels in uppercase, OK, weird or...? :?
Steve
User avatar
Steve Coalbran
 
Posts: 102
Joined: Wed Apr 06, 2011 11:49 am
Location: Stockholm, Sweden
Has thanked: 5 times
Been thanked: 1 time

Next

Return to CLIST & REXX