Page 1 of 1

Rexx calling DB2-Cobol

PostPosted: Fri Oct 18, 2019 11:52 am
by LasseH
Tried and tried but havn't succeeded.

I want to start a DB2-cobol program from a Rexx and send in 3 parms to that program

Like

queue "RUN PROGRAM(SQL2TAB)" ,            
      "    PLAN(SQL2TAB)"    ,            
      "    PARMS('"parm1 parm2 parm3"')"  
queue "END"
address TSO "DSN SYSTEM(DB2A)"


and I want to fetch the parms in the program like this (much easier to parse)


linkage                     section.                                    
01          l01-parm-len    pic s9(04)    binary.            
01          l01-parm1.                                                
    05      l01-parm1len    pic s9(04)    binary.            
    05      l01-parm1value.                                  
     10     l01-parm1char   pic  x(01)    occurs 1 to 008    
                                          depending on        
                                          l01-parm1len.      
01          l01-parm2.                                        
    05      l01-parm2len    pic s9(04)    binary.            
    05      l01-parm2value.                                  
     10     l01-parm2char   pic  x(01)    occurs 1 to 080    
                                          depending on        
                                          l01-parm2len.      
01          l01-parm3.                                        
    05      l01-parm3len    pic s9(04)    binary.            
    05      l01-parm3value.                                  
     10     l01-parm3char   pic  x(01)    occurs 1 to 006    
                                          depending on        
                                          l01-parm3len.    

procedure                   division         
                            using l01-parm1
                                  l01-parm2
                                  l01-parm3.  


Whatever I do it ends up in 1 string with a length infront
Someone having experience of this?

//Lasse

Re: Rexx calling DB2-Cobol

PostPosted: Fri Oct 18, 2019 1:56 pm
by willy jensen
I don't know DB2-Cobol but if you want 3 parameters you most likely need commas between the elements, like "PARMS('"parm1","parm2","parm3"')".

Re: Rexx calling DB2-Cobol

PostPosted: Fri Oct 18, 2019 3:17 pm
by LasseH
Nope
Tried
" PARMS('"parm1","parm2","parm3"')"
and got the same result abd I Think I saw in the manual stated that "separate parms by blank or ','

Re: Rexx calling DB2-Cobol

PostPosted: Fri Oct 18, 2019 4:32 pm
by LasseH
PARMS( parameter-string )
parameter-string is a list of parameters that are to be passed to your application program. Separate items in the list with commas, blanks, or both, and enclose the list between apostrophes.

Re: Rexx calling DB2-Cobol

PostPosted: Fri Oct 18, 2019 6:16 pm
by NicC
What does a trace show?

Re: Rexx calling DB2-Cobol

PostPosted: Fri Oct 18, 2019 6:24 pm
by LasseH
Running it this way now:
   29 *-* queue "RUN PROGRAM(SQL2TAB)" ,                                      
                  "    PLAN(SQL2TAB)"    ,                                    
                   "    PARMS("parms")"                                        
       >>>   "RUN PROGRAM(SQL2TAB)     PLAN(SQL2TAB)     PARMS('LASSE678 select
 * from db2u.teaf011forsatgtyp 10')"
                                         


And displaying first part of linkage gives
Offset Hex..... ........ ........ ........ ebcdic..........
  1-016 0030D3C1 E2E2C5F6 F7F840A2 85938583 ..LASSE678 selec
 17-032 A3405C40 86999694 408482F2 A44BA385 t * from db2u.te
 33-048 8186F0F1 F1869699 A281A387 A3A89740 af011forsatgtyp  
 49-064 F1F00000 00000000 00000000 00000000 10..............
 65-080 00000000 00000000 00000000 00000000 ................
 81-096 00000000 00000000 00000000 00000000 ................

Re: Rexx calling DB2-Cobol

PostPosted: Fri Oct 18, 2019 6:38 pm
by Robert Sample
From the Enterprise COBOL Programming Guide manual:
Accessing main program parameters under z/OS
When you run an Enterprise COBOL program under z/OS and pass the program a parameter string, for example, by using JCL or a TSO command, the parameter list consists of a character string that has a halfword prefix that contains the string length.
Note that the manual does NOT say you can have more than one parameter passed from JCL (or TSO command line) -- this is a COBOL limitation, not a REXX limitation. A COBOL (or other language) program directly calling another COBOL program can have up to the compiler limit (32767) parameters, but this limit is not applied when passing a parameter to the main program. The structure you gave in your original post is simply not possible under Enterprise COBOL.

Re: Rexx calling DB2-Cobol

PostPosted: Fri Oct 18, 2019 6:41 pm
by LasseH
Ok,
tnxs all, I'll have to live with that
//Lasse