Rexx calling DB2-Cobol



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Rexx calling DB2-Cobol

Postby LasseH » Fri Oct 18, 2019 11:52 am

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
LasseH
 
Posts: 62
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 5 times
Been thanked: 1 time

Re: Rexx calling DB2-Cobol

 

Re: Rexx calling DB2-Cobol

Postby willy jensen » Fri Oct 18, 2019 1:56 pm

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"')".
willy jensen
 
Posts: 266
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 38 times

Re: Rexx calling DB2-Cobol

Postby LasseH » Fri Oct 18, 2019 3:17 pm

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 ','
LasseH
 
Posts: 62
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 5 times
Been thanked: 1 time

Re: Rexx calling DB2-Cobol

Postby LasseH » Fri Oct 18, 2019 4:32 pm

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.
LasseH
 
Posts: 62
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 5 times
Been thanked: 1 time

Re: Rexx calling DB2-Cobol

Postby NicC » Fri Oct 18, 2019 6:16 pm

What does a trace show?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2937
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 133 times

Re: Rexx calling DB2-Cobol

Postby LasseH » Fri Oct 18, 2019 6:24 pm

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 ................
LasseH
 
Posts: 62
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 5 times
Been thanked: 1 time

Re: Rexx calling DB2-Cobol

Postby Robert Sample » Fri Oct 18, 2019 6:38 pm

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.

These users thanked the author Robert Sample for the post:
LasseH (Fri Oct 18, 2019 6:41 pm)
Robert Sample
Global moderator
 
Posts: 3620
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 267 times

Re: Rexx calling DB2-Cobol

Postby LasseH » Fri Oct 18, 2019 6:41 pm

Ok,
tnxs all, I'll have to live with that
//Lasse
LasseH
 
Posts: 62
Joined: Mon Nov 08, 2010 2:51 pm
Has thanked: 5 times
Been thanked: 1 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post