Call Assembler from REXX with parameters



IBM's Command List programming language & Restructured Extended Executor

Call Assembler from REXX with parameters

Postby Greenhouse » Tue Jan 11, 2011 3:33 pm

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
Greenhouse
 
Posts: 25
Joined: Tue Sep 02, 2008 1:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Call Assembler from REXX with parameters

Postby prino » Tue Jan 11, 2011 6:01 pm

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);
***********************************************************************/
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Call Assembler from REXX with parameters

Postby Greenhouse » Tue Jan 11, 2011 6:23 pm

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
Greenhouse
 
Posts: 25
Joined: Tue Sep 02, 2008 1:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Call Assembler from REXX with parameters

Postby prino » Tue Jan 11, 2011 10:27 pm

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.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Call Assembler from REXX with parameters

Postby Pedro » Wed Jan 12, 2011 2:52 am

... and I get abend 0C4


Likely, it is a problem with your assembler program.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Call Assembler from REXX with parameters

Postby Greenhouse » Wed Jan 12, 2011 11:26 am

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.
Greenhouse
 
Posts: 25
Joined: Tue Sep 02, 2008 1:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Call Assembler from REXX with parameters

Postby dick scherrer » Wed Jan 12, 2011 11:33 am

Hello,

What happens if you call this assembler program from a cobol "driver"?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Call Assembler from REXX with parameters

Postby steve-myers » Wed Jan 12, 2011 11:33 am

Just an idea: check if your program runs AMODE 31.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Call Assembler from REXX with parameters

Postby Greenhouse » Wed Jan 12, 2011 12:19 pm

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.
Greenhouse
 
Posts: 25
Joined: Tue Sep 02, 2008 1:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Call Assembler from REXX with parameters

Postby Greenhouse » Wed Jan 12, 2011 3:10 pm

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?
Greenhouse
 
Posts: 25
Joined: Tue Sep 02, 2008 1:53 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post