Rexx calling DB2-Cobol

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS
LasseH
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Skillset: ISPF/REXX
Referer: Internet

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

Code: Select all


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)

Code: Select all


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

willy jensen
Posts: 474
Joined: Thu Mar 10, 2016 5:03 pm
Skillset: assembler rexx zOS ispf racf smf
Referer: saw it in the experts foprum thought I could help here

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"')".

LasseH
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Skillset: ISPF/REXX
Referer: Internet

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: 70
Joined: Mon Nov 08, 2010 2:51 pm
Skillset: ISPF/REXX
Referer: Internet

Re: Rexx calling DB2-Cobol

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

Code: Select all

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.

NicC
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
Referer: Google
Location: Pushing up the daisies (almost)

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

LasseH
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Skillset: ISPF/REXX
Referer: Internet

Re: Rexx calling DB2-Cobol

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

Running it this way now:

Code: Select all

   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

Code: Select all

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 ................

Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
Referer: other forum
Location: Dubuque, Iowa, USA

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.

LasseH
Posts: 70
Joined: Mon Nov 08, 2010 2:51 pm
Skillset: ISPF/REXX
Referer: Internet

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


  • Similar Topics
    Replies
    Views
    Last post