Page 1 of 3

Call Assembler from REXX with parameters

PostPosted: Tue Jan 11, 2011 3:33 pm
by Greenhouse
Hi,

I have assembler program that performs some sort of character conversions.

Input parameters that I need to pass it:
Type Digit Attribute
char 2
char 1
char 1
num 3 binary
char 501
char 501
char 1

COBOL calls to this Assembler:
in WORKING-STORAGE...
05  WK-P1.                                 
  10  WK-RC            PIC    X(0002).     
  10  WK-KBN           PIC    X(0001).     
  10  FILLER           PIC    X(0001).     
  10  WK-NUMBER        PIC    9(0003)  COMP.
05  WK-P2.                                 
  10  WK-BEFORE        PIC    X(0510).     
05  WK-P3.                                 
  10  WK-AFTER         PIC    X(0510).     
05  WK-P4.                                 
  10  WK-CANNOT-CODE   PIC    X(0002).     

in PROCEDURE...
CALL WK-PGMNAME  USING WK-P1
                       WK-P2
                       WK-P3
                       WK-P4

Re: Call Assembler from REXX with parameters

PostPosted: Tue Jan 11, 2011 6:01 pm
by prino
I'm using the following to invoke DSNTIAR from REXX, it might give you some pointers...

/* REXX exec to get a description of a SQLCODE                        */
/*** trace ?r ***************************************************** \| *
* SQLCODE is a REXX exec to display the description of an SQLCODE in a *
* pop-up panel. The description is obtained by invoking DSNTIAR.       *
***********************************************************************/
arg sqlcode

sqlcode = x2c(d2x(sqlcode, 8))

sqlca   = 'SQLCA   '          ||,
          x2c(00000088)       ||,
          sqlcode             ||,
          x2c(0000)           ||,
          copies(' ', 78)     ||,
          copies(x2c(00), 24) ||,
          copies(' ', 16)

tiar_msg = d2c(512) || copies(' ', 512)
text_len = x2c(00000050)

address attchpgm "dsntiar sqlca tiar_msg text_len"

p = pos('DSNT408I ', tiar_msg)
if p = 0 then
  p = 4
else
  p = p + 9

parse value tiar_msg with =(p) db2_msg 'DSNT415I' .

zerralrm = 'NO'
zerrsm   = ''
zerrhm   = '*'
zerrlm   = strip(space(db2_msg))
"ispexec setmsg msg(isrz002)"
exit

/***********************************************************************
* PL/I structure of SQLCA                                              *
************************************************************************
dcl 1 sqlca,
      2 sqlcaid    char       (8),
      2 sqlcabc    fixed bin (31),
      2 sqlcode    fixed bin (31),
      2 sqlerrm    char      (70) var,
      2 sqlerrp    char       (8),
      2 sqlerrd(6) fixed bin (31),
      2 sqlwarn,
        3 sqlwarn0 char       (1),
        3 sqlwarn1 char       (1),
        3 sqlwarn2 char       (1),
        3 sqlwarn3 char       (1),
        3 sqlwarn4 char       (1),
        3 sqlwarn5 char       (1),
        3 sqlwarn6 char       (1),
        3 sqlwarn7 char       (1),
      2 sqlext,
        3 sqlwarn8 char       (1),
        3 sqlwarn9 char       (1),
        3 sqlwarna char       (1),
        3 sqlstate char       (5);
***********************************************************************/

Re: Call Assembler from REXX with parameters

PostPosted: Tue Jan 11, 2011 6:23 pm
by Greenhouse
prino wrote:I'm using the following to invoke DSNTIAR from REXX, it might give you some pointers...


Thx. I think it sould be very same with my case.

I try to follow your pattern:
pgm_rc      = copies(' ',2) 
conv_type   = '1'           
reserved    = copies(' ',1) 
data_char#  = d2c(1,2)       
data_before = copies(' ',510)
data_after  = copies(' ',510)
data_unconv = copies(' ',2) 
...
do i = 10000 to 10003                                   
   hex_val = hex_array.i                                                               
   cmd = "data_before = '"hex_val"'x"                   
   interpret cmd                                       
                                                       
   parm1 = pgm_rc||conv_type||reserved||data_char#     
   parm2 = data_before                                 
   parm3 = data_after                                   
   parm4 = data_unconv                                 
                                                       
   address attchpgm "SNAC2000 parm1 parm2 parm3 parm4" 
   say rc                                               
   say pgm_rc                                           
end                                                                             


... and I get abend 0C4

Re: Call Assembler from REXX with parameters

PostPosted: Tue Jan 11, 2011 10:27 pm
by prino
You might want to try any of the other "address" options, like

  • address mvs, or
  • address linkpgm
I found the code to retrieve the SQL error message a long time ago and just use it.

Re: Call Assembler from REXX with parameters

PostPosted: Wed Jan 12, 2011 2:52 am
by Pedro
... and I get abend 0C4


Likely, it is a problem with your assembler program.

Re: Call Assembler from REXX with parameters

PostPosted: Wed Jan 12, 2011 11:26 am
by Greenhouse
prino wrote:You might want to try any of the other "address" options, like

  • address mvs, or
  • address linkpgm
I found the code to retrieve the SQL error message a long time ago and just use it.


I think that this abend because of not properly adopted parameters that I pass in call.

Pedro wrote:Likely, it is a problem with your assembler program.


Not think so. Really.

Re: Call Assembler from REXX with parameters

PostPosted: Wed Jan 12, 2011 11:33 am
by dick scherrer
Hello,

What happens if you call this assembler program from a cobol "driver"?

Re: Call Assembler from REXX with parameters

PostPosted: Wed Jan 12, 2011 11:33 am
by steve-myers
Just an idea: check if your program runs AMODE 31.

Re: Call Assembler from REXX with parameters

PostPosted: Wed Jan 12, 2011 12:19 pm
by Greenhouse
dick scherrer wrote:What happens if you call this assembler program from a cobol "driver"?


I haven't tried yet, but what do you mean?

steve-myers wrote:Just an idea: check if your program runs AMODE 31.


Yes.

Re: Call Assembler from REXX with parameters

PostPosted: Wed Jan 12, 2011 3:10 pm
by Greenhouse
dick scherrer wrote:What happens if you call this assembler program from a cobol "driver"?


Works ok.

Can someone that experienced in calling assembler from rexx with various parameters formats HELP?