IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Pass a parameter to Pgm. Cobol(DB2) from CLIST

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> CLIST & REXX
View previous topic :: View next topic  
Author Message
Celia Barossi



Joined: 28 Nov 2005
Posts: 1

Posted: Mon Nov 28, 2005 9:47 pm    Post subject: Pass a parameter to Pgm. Cobol(DB2) from CLIST  

I need to verify that is necessary to insert on program Cobol at linkage section any characters of control, before my parameters.
I'm trying to call a program with parameters by clist, and I saw that parameters are wrong, when it are displayed.

--PGM
Code:
  LINKAGE SECTION.                                                       
  01           WE000-LINKAGE       PIC X(00020).                         
  01           WE000-LINKAGE-R     REDEFINES     WE000-LINKAGE.         
      05       WE000-INPUT-PARMS.
       10      WE000-ANO           PIC X(00004).                         
       10      WE000-TMA           PIC X(00004).                         
       10      WE000-IMC           PIC X(00003).                         
      05       WE000-OUTPUT-PARMS.                                       
       10      WE000-MESSAGENO     PIC X(00006).                         
       10      FILLER              PIC X(00003).                         


-- CLIST
Code:
WRITE ### CHAMADA DO SUBPGM ###                                                 
DSN  SYSTEM(DB2B)                                                               
RUN  PROGRAM(WE000C00) LIB('AXG.LOAD')  +                                       
     PARMS('2005ABC WWWAAAAAAFFF')                                             
END                                                                             
WRITE ### RETORNO DO SUBPGM ###                                                 
END                                                                             


-- CLIST EXECUTION

### CHAMADA DO SUBPGM ###
DSN SYSTEM(DB2B)
RUN PROGRAM(WE000C00) LIB('AXG.LOAD') PARMS('2005ABC WWWAAAAAAFFF')
***--- VOU INICIALIZAR O PROGRAMA ---***
:20 / 05AB / C W
**ERRO***
**WE000-MESSAGENO 999993
### RETORNO DO SUBPGM ###
END
***
:?: :?: :?:
Back to top  
John_Deal



Joined: 28 Nov 2005
Posts: 4
Location: Montgomery, AL, USA

Posted: Mon Nov 28, 2005 11:49 pm    Post subject:  

You forgot the 4 bytes that are used for the LENGTH of the linkage section... Try adding 4 bytes to the front of your linkage section... :)
--)
Back to top  
DavidatK



Joined: 22 Nov 2005
Posts: 715
Location: Troy, Michigan USA

Posted: Thu Dec 01, 2005 4:42 am    Post subject: Re: Pass a parameter to Pgm. Cobol(DB2) from CLIST  

The Length of the string is two bytes, not four. Define as PIC 999 COMP

From the COBOL Reference Quote:
Specify run-time options in the PARM parameter of the EXEC statement that
starts execution. Code the PARM parameter as follows:

PARM='[user-parameter][/execution-options]'

user-parameter
Parameter to be passed to the VS COBOL II program being executed.
This parameter is then accessed by a USING phrase in your application
program.

If the user-parameter in the list contains a slash, add a trailing
slash. All data following this second slash is considered to be COBOL
run-time options. The last slash and the data following it are passed
to the program when the data following the last slash does not contain
any valid COBOL run-time options. In this case, the entire PARM
parameter is passed to the program and the COBOL run-time message
IGZ019I is sent. If there are no run-time options, failure to add the
trailing slash will cause the user-parameter data to the right of the
last slash to be treated (erroneously) as run-time options.

The Linkage Section record (level-01) that is to receive the
user-parameter data passed by the PARM string must be defined, taking
into account the halfword length field inserted in front of the string
by the system.
The program can test this field length for nonzero, to verify that
PARM-string data has in fact been passed. For example:

LINKAGE SECTION.
01 PARMDATA.
05 STRINGLEN PIC 999 USAGE COMP.
05 STRINGPARM PIC X(6).
PROCEDURE DIVISION USING PARMDATA.
IF STRINGLEN > 0 . . .
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> CLIST & REXX
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM